HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Response to "a unit dies"

01-04-2005, 10:54 PM#1
TheXenocide
Hey everybody, I am trying to make a trigger that will trigger whenever a unit dies, but i don't want it to trigger when a building is canceled, this is what i have tried:

Code:
Unit Removal
    Events
        Unit - A unit Dies
    Conditions
         (Triggering unit) Not equal to (Cancelled structure)
    Actions
       If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Unit-type of (Triggering unit)) Equal to Stasis
            Then - Actions
                Set Stasis[(Player number of (Owner of (Triggering unit)))] = (Stasis[(Player number of (Owner of (Triggering unit)))] - 1)
                Game - Display to (Player group((Owner of (Triggering unit)))) the text: (One of your Stasis' was destroyed now you have  + ((String(Stasis[(Player number of (Owner of (Triggering unit)))])) + Stasis'.))
                Wait 2.00 seconds
                Unit - Remove (Dying unit) from the game
                Unit - Remove (Decaying unit) from the game
            Else - Actions
                Do nothing
        
01-04-2005, 11:36 PM#2
duckduck
Quote:
Originally Posted by TheXenocide
Hey everybody, I am trying to make a trigger that will trigger whenever a unit dies, but i don't want it to trigger when a building is canceled, this is what i have tried:

Code:
Unit Removal
    Events
        Unit - A unit Dies
    Conditions
         (Triggering unit) Not equal to (Cancelled structure)
    Actions
       If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Unit-type of (Triggering unit)) Equal to Stasis
            Then - Actions
                Set Stasis[(Player number of (Owner of (Triggering unit)))] = (Stasis[(Player number of (Owner of (Triggering unit)))] - 1)
                Game - Display to (Player group((Owner of (Triggering unit)))) the text: (One of your Stasis' was destroyed now you have  + ((String(Stasis[(Player number of (Owner of (Triggering unit)))])) + Stasis'.))
                Wait 2.00 seconds
                Unit - Remove (Dying unit) from the game
                Unit - Remove (Decaying unit) from the game
            Else - Actions
                Do nothing
        
im not sure if this it the problem, but try changing the condition to
Code:
Conditions:
   (Unit-type of (dying unit)) equal to stasis
then you can just take out the if,than,else part. also, replace the triggering unit with dying unit
01-04-2005, 11:42 PM#3
TheXenocide
Quote:
Originally Posted by duckduck
im not sure if this it the problem, but try changing the condition to
Code:
Conditions:
   (Unit-type of (dying unit)) equal to stasis
then you can just take out the if,than,else part. also, replace the triggering unit with dying unit


that isn't my problem, and this stasis code is only one of about 10 other if-then statements within this trigger. Instead of doing a different "if a unit dies" trigger for each if-then statemen, i made one and depending on what unit dies i do different things. Thanks for the reply anyway.
01-04-2005, 11:44 PM#4
Taur
try making a another trigger, that say

construction is cancelled or whatever, then make a boolean variable
and set it to true, e.g.

set constructioncancel = true

then at the very top of your other trigger add a wait 2-3 seconds, if you can, or you might want to go lowe, o 1 second and see if it works, in theory, placing the trigger i told you above the other one, might work too, but this is safer, then to your multiple functions add

contructioncancel=true

and add to your then functions

set construction cancel=false

, and your done, i'm not sure if this works though

i'm not


btw duckduck, like uL's banner, i sorta made it, so flame away, lol, you know UL, the project you are supposed to be workign on *hint* *hint*
01-05-2005, 12:11 AM#5
Guest
duckduck is right, you have to replace those "Triggering Unit"s with "Dying Unit"s. Secondly, if the condition in the If/Then/Else says the dying unit has to be a Stasis, then you wouldn't need the regular condition (the one that isnt in the If/Then/Else). And lastly (not that this matters much) but your regular condition isnt at all related to the event. The event isnt a unit cancelling constuction, so the condition is referring to nothing, really.
01-05-2005, 02:36 AM#6
TheXenocide
darkhorde your idea worked great thanks. Thanks to everyone else who posted :god_help_us: