HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

trigger help!!!

10-07-2003, 01:27 AM#1
drezman
im trying to make it so that when a unit is inside transport A it looses 10 hit points every 5 seconds, but no luck. someone hlp plz?
10-07-2003, 01:34 AM#2
Zachary_Shadow
U could use devouer ability..somehow? Although that is hard coded when it comes to damage.. So not totaly sure how :)

Think there is a trigger that says: Unit transported by...

or something..
10-07-2003, 01:36 AM#3
drezman
i no the different triggers, just cant figure it out....
10-07-2003, 01:39 AM#4
Zachary_Shadow
Lemme take a look...know it can be done :)
10-07-2003, 01:43 AM#5
Bhav_88
Unit is Loaded into Transport


Transporting Unit is (Your transport)



Set Variable (Unit) equal to Transported Unit





Another trigger...


Every 5 seconds

Set HP of (Unit) equal to (Unit)HP - 10






That will work for a single unit at a time. If you want multiple units, you'll need an array, with an If/Then/Else to define each variable.
10-07-2003, 01:53 AM#6
drezman
yes, but what about when the unit leaves the transport?
10-07-2003, 02:01 AM#7
Bhav_88
Just make one so that if a unit leaves said transport, it clears the variable.
10-07-2003, 02:03 AM#8
drezman
what trigger exactly would i use to make it every 5 seconds and for it to repeat the actions only?
10-07-2003, 02:05 AM#9
Zachary_Shadow
If u figure out what the Unload all order is called (need the right string) I got your trigger
10-07-2003, 02:52 AM#10
Zachary_Shadow
Here is what I have, works partially...so...figure out the rest by yourself :)

Trigger 1:

Untitled Trigger 001
Events
Unit - A unit Is loaded into a transport
Conditions
(Transport Car) Equal to (Transporting unit)
Actions
Unit - Set life of (Loading unit) to ((Life of (Loading unit)) - 50.00)
Trigger - Run Untitled Trigger 002 <gen> (checking conditions)

Trigger 2:

Untitled Trigger 002
Events
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Then - Actions
Wait 10.00 seconds
Game - Display to (Triggering player), at offset (0.00, 0.00) the text: 10 seconds passed -...
Unit - Set life of (Loading unit) to ((Life of (Loading unit)) - 50.00)
Trigger - Run Untitled Trigger 002 <gen> (checking conditions)
Else - Actions
Do nothing

Trigger 3:
Untitled Trigger 003
Events
Unit - A unit Is issued an order targeting a point
Conditions
(Issued order) Equal to (Order(unload))
Actions
Trigger - Turn off Untitled Trigger 002 <gen>

Last one don't work at all, but it's something like that. Or you need to do a variable for the unit taking the damage, and make a condition for it in trigger 2:
Untitled Trigger 002
Events
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
UnitInTransport = 1
Then - Actions
Wait 10.00 seconds
Game - Display to (Triggering player), at offset (0.00, 0.00) the text: 10 seconds passed -...
Unit - Set life of (Loading unit) to ((Life of (Loading unit)) - 50.00)
Trigger - Run Untitled Trigger 002 <gen> (checking conditions)
Else - Actions
Do nothing

And make trigger 3 do:
Trigger 3:
Untitled Trigger 003
Events
Unit - A unit Is issued an order targeting a point
Conditions
(Issued order) Equal to (Order(unload))
Actions
Set UnitInTransport = 0

Trigger 1, would need to look something like this:

Untitled Trigger 001
Events
Unit - A unit Is loaded into a transport
Conditions
(Transport Car) Equal to (Transporting unit)
Actions
Set UnitInTransport = 1
Unit - Set life of (Loading unit) to ((Life of (Loading unit)) - 50.00)
Trigger - Run Untitled Trigger 002 <gen> (checking conditions)


Should work for you then....

Try it out :)
10-07-2003, 07:56 AM#11
Illithid
this trigger handles loading of the units:
loading
Events
Unit - A unit Is loaded into a transport
Conditions
Actions
Set OccNum = (OccNum + 1)
Set occupants[OccNum] = (Loading unit)

this trigger handles unloading:
unloading1
Events
Unit - A unit Is issued an order with no target
Conditions
OccNum Greater than 0
(Issued order) Equal to (Order(stop))
Actions
For each (Integer A) from 0 to (OccNum - 1), do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Ordered unit) Equal to occupants[(OccNum - (Integer A))
Then - Actions
Set occupants[(OccNum - (Integer A))] = occupants[OccNum]
Set OccNum = (OccNum - 1)
Else - Actions

This trigger handles death aboard transport:
death on transpoert
Events
Unit Dies
Conditions
OccNum Greater than 0
Actions
For each (Integer A) from 0 to (OccNum - 1), do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Dying unit) Equal to occupants[(OccNum - (Integer A))
Then - Actions
Set occupants[(OccNum - (Integer A))] = occupants[OccNum]
Set OccNum = (OccNum - 1)
Else - Actions


And this is the damaging trigger:
transport damage
Events
Time - Every 5.00 seconds of game time
Conditions
OccNum Greater than 0
Actions
For each (Integer B) from 1 to OccNum, do (Actions)
Loop - Actions
Unit - Set life of occupants[(Integer B)] to ((Life of occupants[(Integer B)]) - 10.00)


This works for a single transport with OccNum being an integer variable starting at zero, and Occupants being a unit array variable with max size equal to the max number of occupants a transport can have. The reason why issued order = stop works is because as soon as a unit is unloaded from a transport it is given a stop order. If you want to make this work for multiple transports you will have to set up another array to store the transports and use methods of making double arrays to keep track of all units. Also, I wouldn't recommend using order(unloadall) because being issued an order doesn't necessarily mean the order is going to happen.
10-07-2003, 06:52 PM#12
drezman
all thats fine except, how do i loop? i cant find a loop action anywhere!
10-07-2003, 09:24 PM#13
Illithid
the loops are part of For Interger A, Do multiple Actions. I also modifed my previous post to include occupant changes due to death aboard transport.