HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Way to pass integers from ai to trigger

03-04-2003, 06:38 PM#1
PitzerMike
Just descovered a simple way to pass integers from an ai script to triggers. You just need to have an invisible unit owned by a bot player and a simple ai script for him. You just need to move the invisible unit instantly to a relative position of it's current position (distance = the number you want to pass). Then issue a stop command which will be detected by a trigger. Then you could get the distance, the unit is away from the original position... The trigger will move the unit back so this will work again and again.

This could be used in several ways, you could pass the gold and lumber costs of units and upgrades because there is no way to get them within triggers and also you could make use of other commands in common.ai that return integers (count the number of mines owned by a player.....).....
03-04-2003, 09:13 PM#2
AIAndy
You could also just use the gold and wood of an unused player to pass information from AI to trigger.
03-05-2003, 03:45 PM#3
PitzerMike
Thanks for your input. That's really much easier. And as I said above it offers a wide variety of uses.
03-05-2003, 04:01 PM#4
AIAndy
Since mana and life of a unit are reals you can use those to pass reals from AI to trigger.
03-05-2003, 05:20 PM#5
PitzerMike
Cool :D

Although it's not necessary because you could also use integers to pass reals by just multiplying them with 100 and then dividing again

Booleans would also be easy to pass but what about strings or units. Maybe you could use a function to assign a unique integer value to a unit and then set its PropWindow-Value or its Point Value to that unique integer.
Then You could pass the integer of the unit and in the trigger it would look up in the previously created unit array which unit it is.
04-13-2004, 02:53 AM#6
Vidstige
And I was so happy to have managed to pass data by using the custom data of a unit. :o I guess that units could be identified with their custom data value, if that is set uniquely. Strings could be chopped up and coded to integer, but that would probably be boring. Having pre-defined strings and just doing a simple table lookup could probably be useful sometimes.

Now I have tons of ideas to try. :>