Scripting Question #2

A forum for discussing map making ideas and problems for the Myth series.
Post Reply
Jon God
Posts: 1631
Joined: Sat Mar 25, 2006 11:24 pm
Location: Here
Contact:

Scripting Question #2

Post by Jon God »

I hit the maximum amount of scripting commands,(1024, I think), and I was able to delete 46 commands that were not being used, luckily I was close to done, and am doing one last thing, but:

I ran into a problem, and that is, I want to be able to search a group of units for a artifact, and then take the artifact away from him, but there is a catch. I don't want any of the other units to lose their artifacts, luckily they have different artifacts, but still.

The only way I can see of doing this is making a separate command for each unit, but I run into the problem, that I only have like 44 map actions left. And way to many units to do it unit by unit.

Any ideas?
Myrd
Site Admin
Posts: 4029
Joined: Fri Mar 19, 2004 10:17 pm

Post by Myrd »

MUNG maybe? Someone who've actually used the command should probably be of more help...
A-Red
Posts: 771
Joined: Fri Jul 23, 2004 8:36 pm

Post by A-Red »

Use a GEOM to find the units with that specific artifact, and filter them into a new subjects container. Remove artifacts from units in that container. You can set the GEOM to find a maximum of 1 unit if you like, but it sounds like there's only one artifact of this type anyway.

(Or, filter them directly into the artifact removal CTRL as subjects. That's only two map actions instead of three).
gugusm
Posts: 487
Joined: Mon Aug 22, 2005 1:16 pm
Location: Klucze, Poland
Contact:

Post by gugusm »

Yeah, A-Red is right, but I'm really curious, what map are you making, if you've hit map actions limit. Mine one which I've been doing recently has got about 800 and it is really huge number, but 1000? :shock:
Jon God
Posts: 1631
Joined: Sat Mar 25, 2006 11:24 pm
Location: Here
Contact:

Post by Jon God »

A-Red wrote:Use a GEOM to find the units with that specific artifact, and filter them into a new subjects container. Remove artifacts from units in that container. You can set the GEOM to find a maximum of 1 unit if you like, but it sounds like there's only one artifact of this type anyway.

(Or, filter them directly into the artifact removal CTRL as subjects. That's only two map actions instead of three).
Uh, could you explain that in a little more detail? I've never done it before.

Yeah, A-Red is right, but I'm really curious, what map are you making, if you've hit map actions limit. Mine one which I've been doing recently has got about 800 and it is really huge number, but 1000?
Yeah, to look at it, you wouldn't think it has so much scripting. In fact, it is a multiplayer map.
A-Red
Posts: 771
Joined: Fri Jul 23, 2004 8:36 pm

Post by A-Red »

If you have 1000 actions on a multimap, chances are good that you're not scripting as efficiently as you could be. One way to script efficiently is to use GEOMs, or Geometry Filters.

This particular GEOM, the one testing for a specific artifact, would look like:

GEOM Find Artifact X
Link--Player Team
Entire Map
Holding Inventory Object--artx*
Results Action Identifier--Unit Holding Artifact X
TIIFN--subj
Activates on Success--Remove Artifact X

NONE Unit Holding Artifact X
(leave this action empty)

CTRL Remove Artifact X
Link--Unit Holding Artifact X
Remove Artifact Flag**

For future reference, the purpose of a GEOM is to find things that meet a certain criterion and place them into another action. In the script above, you set the Results Action Identifier to be the unit container action, because that's the action you want to put the monster into. You set the Tested Items Inside Field Name (TIIFN) to be "subj" because that's the type of identifier you want it to be--subj is subject, obje is object, dest is destination, etc. So while you would normally put the subjects into the unit container when you create it, here you are using the GEOM to find and add one ingame.

*Don't really put "artx" here--it's just an example. Every tag has a four-letter header, which you can find by opening any tag and looking next to the name you gave it. Put the actual four-letter header for your artifact here. I'm not sure whether you need to use the artifact tag or the projectile tag, but I would bet it's the proj.

**This is the one thing I'm not really sure about. I haven't done much work with artifacts. The script will definitely work as I have written it, *if* the unit is only holding that one artifact. If the unit is holding multiple artifacts in its inventory, I don't know how you would remove one specifically without removing the others--you could try a CTRL with "Switch Artifact" to make that artifact active and then follow that with the CTRL that removes the artifact. Not really sure though.

A-Red
Jon God
Posts: 1631
Joined: Sat Mar 25, 2006 11:24 pm
Location: Here
Contact:

Post by Jon God »

Much and many thanks! That worked.
User avatar
ozone
Posts: 744
Joined: Wed Mar 24, 2004 5:05 pm

Post by ozone »

Since you have talked about being low on map actions to use I suggest not using a data container as A-red suggests...

instead of this:

GEOM Find Artifact X
Link--Player Team
Entire Map
Holding Inventory Object--artx*
Results Action Identifier--Unit Holding Artifact X
TIIFN--subj
Activates on Success--Remove Artifact X

NONE Unit Holding Artifact X
(leave this action empty)

CTRL Remove Artifact X
Link--Unit Holding Artifact X
Remove Artifact Flag**

USE THIS:

GEOM Find Artifact X
Link--Player Team
Entire Map
Holding Inventory Object--artx*
Results Action Identifier--Remove Artifact X
TIIFN--subj
Activates on Success--Remove Artifact X

CTRL Remove Artifact X
Remove Artifact Flag**



The Results Action Identifier for the GEOM is now the CTRL and not an empty map action. 2 actions instead of 3. This can be done with ALL geoms.
If you need to send that subject to multiple actions you can also do so with the same geom...like this for example:


GEOM Find Artifact X
Link--Player Team
Entire Map
Holding Inventory Object--artx*
Results Action Identifier--Switch to Artifact X; Remove Artifact X
TIIFN--subj; subj
Activates on Success--Remove Artifact X

CTRL Switch to Artifact X
Switch Artifact (swit, field name)

CTRL Remove Artifact X
Remove Artifact Flag**

>>>Notice that there are 2 Results Action Identifiers (Switch to Artifact X, Remove Artifact X) and 2 Tested Items Inside Field Name (subj, subj). The first results action identifier works with the first Field name and the second works with the second. If I havent explained this ok let me know and Ill try again.
do it.
Post Reply