| 07-23-2004, 01:54 AM | #1 |
I understand variables ands etc, and have done all i can think of, but i cannot figure this out. I wish to set the number of UNITS a certain OTHER UNIT (in this case a building with cargo hold ability) is transporting at a given time to a variable, and have this variable checked in another part of the trigger for ingame effects. If anyone can tell me, or give any isnight on how to do this (i.ie) ( set # of units beign transported to a integer variable..or any type of varialbe combo) Please reply to this thred. Thanks alot! -Fellow mapper Horus |
| 07-23-2004, 06:35 AM | #2 |
The only thing I can think of is using the custom value of the transport; whenever a unit is loaded into it, increase it's custom value by 1, whenever an unload order is given, decrease the value. When an unload all order is given, set the value to 0. Use the custom value of the transport in your trigger as you would the integer. |
| 07-24-2004, 02:12 AM | #3 | |
Quote:
By this i assume you mean...CHanging this in the Units Editor...but as i stated...the unit is a building with cargo hold ability...so it wouldn't have that...therefore i also assume i should choose a zeppellin and fix its hover height etc..and overlay it with the model of the building i;m using?...or what..sorry......if you cna clarify or restate once mroe...i'll be very grateful.. -Thanks, another mapper HOrus |
| 07-24-2004, 09:00 AM | #4 |
No, the custom value is a unit characteristic that can be freely modified during play. It can be used for adding a third "resource" to a unit, so it can have HP, mana, and the custom value used for ammo or something similar (of course, the custom value doesn't show like life and mana do). Use the action "unit - set custom value" to modify it and the integer function "unit - custom value of unit" to get the value of a unit. You can then use these values to store information about how many units are in a transport by modifying the value whenever a unit is loaded into a transport or ordered to unload. That way, the information is stored in the cargo unit itself, so you don't need any complicated variable arrays. |
| 07-24-2004, 08:44 PM | #5 |
i worship people like you. more reputation for you ^_^ |
| 07-25-2004, 01:34 AM | #6 | |
It appears i am stupid....But you said this: (i copy forum answers to a word file and then read them offline when i work on war3...so i am back) Quote:
I was unable to find such an action...or are you referring to jass?..or am i simply not looking hard enough..in my WE trigger module for ROC? (me stupid!) |
| 07-25-2004, 07:09 AM | #7 |
Nope, it's probably me stupid, I have only started world editing after tFT, so I have no idea which things were there before and which added later. I just checked and custom values are a TFT thing. However, variable arrays, the only other option I see to do this with, are a TFT thing as well, so I don't think I can help you. |
| 07-25-2004, 11:51 PM | #8 |
Reguardless, can u (for future reference when i egt tft) explain how to do this using variable arrays? Maybe i can somehow come up with some crazy method of making this work for roc.... Thanks for all your time btw |
| 07-26-2004, 08:55 AM | #9 |
Well, variable arrays are variables capable of storing multiple values. If you have a unit variable, and you make it an array, then it can store multiple units, one under each "index", that's an integer. So, you can have UnitVariable[1] = Footman0001 <gen>, UnitVariable[2] = Footman0002 <gen> ..... This is extremely useful for making stuff for more units, or for more players... A simple example would be spawning triggers for a defense type map. Without arrays, you would have to make a trigger for each wave of monsters. With arrays, you can first store the unit-types of attacking monsters for each wave in an unit-type variable array, and then use a single trigger that uses this variable to spawn any wave, depending on the integer variable you use in the trigger as the index of the array. In our case, we would use a unit variable array to store all the transports on the map. Then, we would have an additional integer variable array to store the ammount of units in each transport. Then a trigger would look something like this: Code:
Events:
A unit is issued an order with no target.
Conditions:
Issued order equal to unload
Actions:
For each integer A from 1 to NumberOfTransports, do actions
loop - actions:
If - Then - Else multiple functions
If - conditions:
(ordered unit) equal to (TransportVariable[(integer A)])
Then - actions:
set TransportNumberVariable[(integer A)] = TransportNumberVariable[(integer A)] - 1
skip remaining actions
Else - actions:
do nothing.Now this kind of trigger checks every transport you have stored in the variable array, and if that transport is the one that was issued the order, then it modifies the corresponding integer variable that says how many units are in the transport. |
