[Trigger] Variable

Status
Not open for further replies.
Level 4
Joined
Sep 23, 2010
Messages
90
I have this trigger:
  • Trigger
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Attacked unit)) Equal to Player[(Integer A)]
              • (Owner of (Attacking unit)) Equal to Player 12 (Brown)
              • (Attacked unit) Not equal to Core[(Integer A)]
            • Then - Actions
              • Set LifeBfrDamage = (Life of (Attacked unit))
              • Wait until ((Life of (Triggering unit)) Less than LifeBfrDamage), checking every 0.10 seconds
              • Unit - Set life of Core[(Integer A)] to ((Life of Core[(Integer A)]) - (LifeBfrDamage - (Life of (Attacked unit))))
            • Else - Actions
I know this is bad because, var LifeBfrDamage will be set to different when player 12 owned unit starts attacking before the Core takes damage. I can't think of anything that would solve the problem. Any suggestions?
 
This is extremely buggy :/

Instead, you should use Bribe's DamageEngine in the Spells section: https://www.hiveworkshop.com/forums/spells-569/gui-damage-engine-201016/

When a unit takes damage (You should create a trigger and give it the event: DamageEvent becomes equal to 1.00), you would do this:

  • Custom script: local integer ids = GetPlayerId(GetOwningPlayer(udg_DamageEventSource))
  • Custom script: local integer idt = GetPlayerId(GetOwningPlayer(udg_DamageEventTarget))
  • Custom script: if ids == 11 and idt >= 0 and idt <= 7 and udg_DamageEventTarget != udg_Core[idt] then
  • Custom script: call DisableTrigger(gg_trg_Damage_Engine)
  • Custom script: call UnitDamageTarget(null, udg_Core[idt], udg_DamageEventAmount, false, false, null, null, null)
  • Custom script: call EnableTrigger(gg_trg_Damage_Engine)
  • Custom script: endif
 
You download it and copy-paste the triggers to your map then you should copy that "Cheat Death whatever" ability from the Object Editor.

Or do this:

Bribe said:
How to install
  • Copy & paste the Unit Indexer trigger into your map (I recommend replacing it if you have an older version of it as it has new features)
  • Copy & paste the Damage Engine trigger into your map
  • Copy the Cheat Death Ability from Object Editor, and set it to the variable DamageBlockingAbility.
  • It's installed
 
Is there a way to auto add variables that are missing from the triggers?

Go into File - Preferences - Automatically create unknown variables while pasting trigger date and select it. You will have to delete your triggers and re-import them again so it will create the variables
 
Ok I did all needed to import the engine and when I saved the map the "Damage Engine" trigger disabled with error in 325 line saying "Expected a name".
Did I miss something or is it the GUI Damage Engine's fault?
 
Ok I did all needed to import the engine and when I saved the map the "Damage Engine" trigger disabled with error in 325 line saying "Expected a name".
Did I miss something or is it the GUI Damage Engine's fault?

Did you also import UnitIndexer?
 
Now the error says with the same line "Undeclared variable udg_DmgEvTimer

Well than... create a variable called DmgEvTimer xD

e/ i think i had that same error, but yeah you just make a variable called DmgEvTimer thats a timer, no arrays, default = no value or new timer
 
It was checked before I copied the code. Doesn't show that any variables are missing.
 
If I'm reading it right it disables the trigger if the target is NOT = Core, which is the other way around I want. Is it?
 
Here it is.

u customized the core?
i got no error but also dont show the damage since no trigger with float text :D

so i added and work flawless, so only potentional reason ur automaticall variabel thing dont was checked in when u copied because i dont modified anything and work :P

so i post back the map
in panic tooltip the new row is |n not /n :P
 

Attachments

u customized the core?
i got no error but also dont show the damage :D

You mean made it custom unit?

The trigger
  • DamageToCore
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Custom script: local integer ids = GetPlayerId(GetOwningPlayer(udg_DamageEventSource))
      • Custom script: local integer idt = GetPlayerId(GetOwningPlayer(udg_DamageEventTarget))
      • Custom script: if ids == 11 and idt >= 0 and idt <= 7 and udg_DamageEventTarget != udg_Core[idt] then
      • Custom script: call DisableTrigger(gg_trg_Damage_Engine)
      • Custom script: call UnitDamageTarget(null, udg_Core[idt], udg_DamageEventAmount, false, false, null, null, null)
      • Custom script: call EnableTrigger(gg_trg_Damage_Engine)
      • Custom script: endif
Can you explain this part:
  • Custom script: if ids == 11 and idt >= 0 and idt <= 7 and udg_DamageEventTarget != udg_Core[idt] then
 
You mean made it custom unit?

The trigger
  • DamageToCore
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Custom script: local integer ids = GetPlayerId(GetOwningPlayer(udg_DamageEventSource))
      • Custom script: local integer idt = GetPlayerId(GetOwningPlayer(udg_DamageEventTarget))
      • Custom script: if ids == 11 and idt >= 0 and idt <= 7 and udg_DamageEventTarget != udg_Core[idt] then
      • Custom script: call DisableTrigger(gg_trg_Damage_Engine)
      • Custom script: call UnitDamageTarget(null, udg_Core[idt], udg_DamageEventAmount, false, false, null, null, null)
      • Custom script: call EnableTrigger(gg_trg_Damage_Engine)
      • Custom script: endif
Can you explain this part:
  • Custom script: if ids == 11 and idt >= 0 and idt <= 7 and udg_DamageEventTarget != udg_Core[idt] then

if the attacker = player 11 and the attacked is a player number greater than or equal to 0 and less than or equal to 7 and the target is not equal to the core of the attacked than (do next actions)

e/ sry, no, thats fine...
 
You mean made it custom unit?

The trigger
  • DamageToCore
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Custom script: local integer ids = GetPlayerId(GetOwningPlayer(udg_DamageEventSource))
      • Custom script: local integer idt = GetPlayerId(GetOwningPlayer(udg_DamageEventTarget))
      • Custom script: if ids == 11 and idt >= 0 and idt <= 7 and udg_DamageEventTarget != udg_Core[idt] then
      • Custom script: call DisableTrigger(gg_trg_Damage_Engine)
      • Custom script: call UnitDamageTarget(null, udg_Core[idt], udg_DamageEventAmount, false, false, null, null, null)
      • Custom script: call EnableTrigger(gg_trg_Damage_Engine)
      • Custom script: endif
Can you explain this part:
  • Custom script: if ids == 11 and idt >= 0 and idt <= 7 and udg_DamageEventTarget != udg_Core[idt] then

i think player 12 the attacker and target player is 1-8 and target unit not egual with udg_Core[idt](maybe hero of attacked player, so if attacked player is 8 then it is Core[8])
then do action what is till endif (so i think damage is modified what player 12 deal to hero)

check back the map what i uploaded
 
if the attacker = player 11 and the attacked is a player number greater than or equal to 0 and less than or equal to 7 and the target is not equal to the core of the attacked than (do next actions)

anyway i see your problem.

call UnitDamageTarget(null, udg_Core[idt], udg_DamageEventAmount, false, false, null, null, null) do you see the problem too? :)

Thank you for translating it, the next code is making the trigger disable which is not good, since I wanted damage done to any unit except Core go to Core too.

The problem is with those falses and nulls? :P
 
Thank you for translating it, the next code is making the trigger disable which is not good, since I wanted damage done to any unit except Core go to Core too.

The problem is with those falses and nulls? :P

No its not, and i believe mag didnt know what you wanted to do. What are you trying to do? describe it. Are you trying to make all units damage taken being transferred to the core? do you want to damage the core for the amount of damage the units took?
 
Thank you for translating it, the next code is making the trigger disable which is not good, since I wanted damage done to any unit except Core go to Core too.

The problem is with those falses and nulls? :P

oh dont forget if u talk about player(0) then its player 1 and 11 is 12 coz in custom script the player are between 0-11 not between 1-12 :P

acctually idk why that is since

call UnitDamageTarget(damage dealer unit, target unit, damage, attack (true allways), Ranged?(false), attack type(piercing,spell hero etc), damage type(ethernal chaos etc), allways null)

call UnitDamageTarget(null, udg_Core[idt], udg_DamageEventAmount, false, false, null, null, null)

here no damage dealer deal no damage

so basical enough if u replace it with 0 so
  • Set DamageEventAmount = 0.00
or in custom script
JASS:
Set udg_DamageEventAmount = 0.00

if u dont want reicive dmg to hero unit from player 12
 
No its not, and i believe mag didnt know what you wanted to do. What are you trying to do? describe it. Are you trying to make all units damage taken being transferred to the core? do you want to damage the core for the amount of damage the units took?

Ok, I want when Player 12 owned unit deals damage to any unit except Core owned by players 1-8, dealt damage deal to Core too.
 
Ok, I want when Player 12 owned unit deals damage to any unit except Core owned by players 1-8, dealt damage deal to Core too.

  • Untitled Trigger 002
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of DamageEventSource) Equal to Player 12 (Brown)
          • (Player number of (Owner of DamageEventTarget)) Greater than or equal to 0
          • (Player number of (Owner of DamageEventTarget)) Greater than or equal to 8
          • (Unit-type of DamageEventTarget) Not equal to Mother Rat
        • Then - Actions
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - DamageEventAmount)
        • Else - Actions
Change triggering unit to Core(Player number of (Owner of DamageEventTarget))) and change Not equal to mother rat to not equal to core(see left)
 
Doesn't work :/
  • DamageToCore
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of DamageEventSource) Equal to Player 12 (Brown)
          • (Player number of (Owner of DamageEventTarget)) Greater than 0
          • (Player number of (Owner of DamageEventTarget)) Less than or equal to 8
          • (Unit-type of DamageEventTarget) Not equal to Core
        • Then - Actions
          • Unit - Set life of Core[(Player number of (Owner of DamageEventTarget))] to ((Life of Core[(Player number of (Owner of DamageEventTarget))]) - DamageEventAmount)
          • Game - Display to (All players) the text: DEALING DAMAGE
        • Else - Actions
I think there's something wrong with conditions because I don't get the message "DEALING DAMAGE"
 
Doesn't work :/
  • DamageToCore
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of DamageEventSource) Equal to Player 12 (Brown)
          • (Player number of (Owner of DamageEventTarget)) Greater than 0
          • (Player number of (Owner of DamageEventTarget)) Less than or equal to 8
          • (Unit-type of DamageEventTarget) Not equal to Core
        • Then - Actions
          • Unit - Set life of Core[(Player number of (Owner of DamageEventTarget))] to ((Life of Core[(Player number of (Owner of DamageEventTarget))]) - DamageEventAmount)
          • Game - Display to (All players) the text: DEALING DAMAGE
        • Else - Actions
I think there's something wrong with conditions because I don't get the message "DEALING DAMAGE"

switch greater than 0 to greater than or equal to 0...?

e/ also put NOT DEALING DAMAGE in the else side so i can see if it is triggering
 
They're owned by player brown, this doesn't explain why I don't get the else message.
 
They're owned by player brown, this doesn't explain why I don't get the else message.

  • Untitled Trigger 003
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of DamageEventSource) Equal to Neutral Hostile
          • (Player number of (Owner of DamageEventTarget)) Greater than or equal to 0
          • (Player number of (Owner of DamageEventTarget)) Less than or equal to 8
          • (Unit-type of DamageEventTarget) Not equal to Kobold Sorcerer
        • Then - Actions
          • Game - Display to (All players) the text: Tr2
        • Else - Actions
          • Game - Display to (All players) the text: Tr1
Worked absolutely fine...

e/ do you have another trigger using DamageModiferEvent?
 
Just checked my triggers and found one with DamageModifierEvent, maybe the other guy who edited my map made the trigger, I didn't even noticed it :D

edit: Deleted it, but it still doesn't work
 
Just checked my triggers and found one with DamageModifierEvent, maybe the other guy who edited my map made the trigger, I didn't even noticed it :D

edit: Deleted it, but it still doesn't work

Any more?.... thats the only reason it shouldnt be working
 
Nope, no more, just tested with this code:
  • DamageToCore
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Game - Display to (All players) the text: TRIGGERING
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of DamageEventSource) Equal to Player 12 (Brown)
          • (Player number of (Owner of DamageEventTarget)) Greater than or equal to 0
          • (Player number of (Owner of DamageEventTarget)) Less than or equal to 8
          • (Unit-type of DamageEventTarget) Not equal to Core
        • Then - Actions
          • Unit - Set life of Core[(Player number of (Owner of DamageEventTarget))] to ((Life of Core[(Player number of (Owner of DamageEventTarget))]) - DamageEventAmount)
          • Game - Display to (All players) the text: DEALING DAMAGE
        • Else - Actions
          • Game - Display to (All players) the text: NOT DEALING DAMAGE
And didn't get the message "TRIGGERING"
 
Nope, no more, just tested with this code:
  • DamageToCore
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Game - Display to (All players) the text: TRIGGERING
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of DamageEventSource) Equal to Player 12 (Brown)
          • (Player number of (Owner of DamageEventTarget)) Greater than or equal to 0
          • (Player number of (Owner of DamageEventTarget)) Less than or equal to 8
          • (Unit-type of DamageEventTarget) Not equal to Core
        • Then - Actions
          • Unit - Set life of Core[(Player number of (Owner of DamageEventTarget))] to ((Life of Core[(Player number of (Owner of DamageEventTarget))]) - DamageEventAmount)
          • Game - Display to (All players) the text: DEALING DAMAGE
        • Else - Actions
          • Game - Display to (All players) the text: NOT DEALING DAMAGE
And didn't get the message "TRIGGERING"

you have another trigger using damagemodifierevent that you havent removed
 
Status
Not open for further replies.
Back
Top