HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger Problem

07-21-2004, 07:47 PM#1
Arkidas
Greetings,

I have problem with my monster respawn system,it seems the units by player brown aint reviving,hope you can help.



Code:
Monster Respawning
    Events
        Unit - A unit owned by Player 12 (Brown) Dies
    Conditions
    Actions
        If ((Random integer number between 1 and 4) Equal to 3) then do (Item - Create (Random level (Random integer number between 0 and 4) item-type) at (Position of (Dying unit))) else do (Do nothing)
        Set LastCreatedItem = (Last created item)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Dying unit) is A Hero) Equal to False
            Then - Actions
                Wait 200.00 seconds
                Unit - Create 1 (Unit-type of (Dying unit)) for Player 12 (Brown) at (Position of (Dying unit)) facing Default building facing (270.0) degrees
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Dying unit) is A Hero) Equal to True
            Then - Actions
                Wait 300.00 seconds
                Unit - Create 1 (Unit-type of (Dying unit)) for Player 12 (Brown) at (Position of (Dying unit)) facing Default building facing (270.0) degrees
            Else - Actions
                Do nothing
07-21-2004, 08:33 PM#2
Shimrra
Does it create the item and are the Heroes, the units, or both not respawning?
07-23-2004, 12:37 AM#3
Arkidas
if you read the trigger closely you see both heros and units respawn,and that *lastcreateditem* is random item that will loot from unit.
07-23-2004, 10:02 AM#4
Azhag
Okay, take off the hero part at the very end, this part.
Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
                ((Dying unit) is A Hero) Equal to True
            Then - Actions
                Wait 300.00 seconds
                Unit - Create 1 (Unit-type of (Dying unit)) for Player 12 (Brown) at (Position of (Dying unit)) facing Default building facing (270.0) degrees
            Else - Actions
                Do nothing

Take that part out, make another trigger that is like this.

Code:
Events
        Unit - A unit owned by Player 12 (Brown) Dies
    Conditions
    Actions
        If ((Random integer number between 1 and 4) Equal to 3) then do (Item - Create (Random level (Random integer number between 0 and 4) item-type) at (Position of (Dying unit))) else do (Do nothing)
        Set LastCreatedItem = (Last created item)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Dying unit) is A Hero) Equal to True
            Then - Actions
                Wait 200.00 seconds
                Unit - Create 1 (Unit-type of (Dying unit)) for Player 12 (Brown) at (Position of (Dying unit)) facing Default building facing (270.0) degrees
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)


So essentually your cutting off the last part, and making a new trigger which is for heroes only. The first one is for none heroes. Hope that helped. ^_^
07-23-2004, 12:24 PM#5
Jeltz
The problem with this trigger is that after 200 seconds the units have decayed and don't exist. So when you test for poition and unit type there isn't any unit. One way to solve this is increasing the decay time in the gameplay constants. Another thing you could do is to use local variables.

Azhag, there's no reason for splitting this trigger up in two parts.