• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Help .... Killing at the same time bugs

Status
Not open for further replies.
Level 3
Joined
Apr 20, 2013
Messages
36
Hey guys

i have made my maps killing and dying system and it worked good till now .....

if 2 heros kill each other at the same time .... only one of them will revive :(

how to show my trigger here ???

Edit: oh sry ... here it is :D :

  • Battle
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set TempLoc = (Random point in (Playable map area))
      • Set Hero[1] = (Killing unit)
      • Set Hero[2] = (Triggering unit)
      • For each (Integer C) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of Hero[1]) Equal to (Player(C))
            • Then - Actions
              • Game - Display to (Player group((Triggering player))) the text: ((You have been Killed by |cffff0000 + (Name of (Player(C)))) + (|r + Dont forget to use |cff00ff00"-rev"|r command to revive your hero ;)))
              • Game - Display to (Player group((Player(C)))) the text: ((You have Killed |cffff0000 + (Name of (Triggering player))) + |r. |cffffcc0050 Bonus Gold added|r)
              • Set Kills[C] = (Kills[C] + 1)
              • Set Deaths[(Player number of (Triggering player))] = (Deaths[(Player number of (Triggering player))] + 1)
              • Player - Add 50 to (Player(C)) Current gold
            • Else - Actions
the one up is new , it revived heros automatically but edited it to do that with command :D
 
Last edited:
Level 3
Joined
Apr 20, 2013
Messages
36
ok so i decided to make a reviving system with -rev command ....

and i wanted the condition to check if the triggering players hero is dead .... but i cant find it :(

help pls

Edit : MasterTraine, ok i'll do that ... tnx
 
Level 7
Joined
Jan 22, 2013
Messages
293
  • Events
    • Unit - A unit dies
  • Conditions
  • Actions
    • Custom script: local unit x = GetKillingUnit()
    • Custom script: local unit y = GetDyingUnit()
    • Custom script: set udg_Hero[1] = x
    • Custom script: set udg_Hero[2] = y
    • For each (Integer C) from 1 to 10, do (Actions)
      • If - Conditions
        • (Owner of Hero[1]) Equal to (Player(C))
      • Then - Actions
        • Set CustomGroup = (Triggering Player)
        • Game - Display to (Player group((CustomGroup))) the text: ((You have been Killed by |cffff0000 + (Name of (Player(C)))) + (|r + Dont forget to use |cff00ff00"-rev"|r command to revive your hero ;)))
        • Game - Display to (Player group((Player(C)))) the text: ((You have Killed |cffff0000 + (Name of (Triggering player))) + |r. |cffffcc0050 Bonus Gold added|r)
        • Set Kills[C] = (Kills[C] + 1)
        • Set Deaths[(Player number of (Triggering player))] = (Deaths[(Player number of (Triggering player))] + 1)
        • Player - Add 50 to (Player(C)) Current gold
        • Custom script: DestroyGroup(udg_CustomGroup1)
        • Custom script: set udg_CustomGroup1 = null
        • -------- I don't know for sure if Player(c) would leak so others can tell you yes or not to do to that what I did with the other group)
      • Else - Actions
    • Custom script: set x = null
    • Custom script: set y = null
I hope this helps you. It turns your trigger into allowing Multiple instances (if I did it right I shouldn't code when im tired) allowing you to work around your one at a time death trigger, while changing what you have at a minor scale :)
 
Level 7
Joined
Jan 22, 2013
Messages
293
his trigger is already MUI.

Death, his problem is that only the (killing unit) is not stored into local where as the (Triggering Unit) is already a local, to go around that he has to do what I posted lol.
So no, his thing is MUI with a flaw that ruins the MUI.
 
I don't see the point of iterating... Why not just use Player number of Owner of Hero[1] or Player number of Triggering Player to get the index for your arrays? you even already used that for some of the arrays...

and If you ask me, the trigger is instant so it is MUI...

And no need for the custom group, I believe there is a Display Text to Player function (at least in JASS I'm sure there is)

btw, where is the revival function?
 
Level 7
Joined
Jan 22, 2013
Messages
293
btw, where is the revival function?

I was wondering that too lmao.


The point of me converting it all into Locals, is because of this:

(Triggering Unit) is a local trigger on its own, it can hold multiple instances and does not over wright itself when another is placed on it, allowing it to hold more then one unit at a time.

(Killing Unit) is not a local trigger on its own, meaning it over writes itself every time its used, not allowing to hold more then 1. Meaning his bug comes from this source when two people kill each other at the same time.

When you use a Local Trigger it will allow me to use (Killing unit) & (Dying Unit) as locals. Because the Event only allows the (Dying Unit) to be used as the (triggering unit) that leaves the (Killing unit) outside of the MUI as a standalone, it work on a single unit at a time but its not correct for MUI.

To Fix his problem I gave him Local's that will support that feature allowing him to use his trigger he already spent time on and he understands. The Reason I used his Variables is so he also understands it, it is also another proper way to use the Locals.

His Trigger is MUI, however his (Killing unit) is what is causing the problem, Please learn more about Locals before questioning what I helped him with.
 
Thing is, his trigger [the one posted] is instant so there should be no "overwriting" happening... Because there is actually no, "at the same time" happening in wc3... We only use locals and such for triggers that will be happening in some amount of time... in JASS, we mostly use locals in functions rather than globals or function calls because they are "faster"... You can keep the locals, because it works faster than using repeated KillingUnit() and such...

Please learn more about Locals before questioning what I helped him with

and maybe you should try to read more about it too...

to the OP: Please put the trigger on how ur handling the revival part...
 
Level 7
Joined
Jan 22, 2013
Messages
293
Thing is, his trigger is instant so there should be no "overwriting" happening... Because there is actually no, "at the same time" happening in wc3... We only use locals and such for triggers that will be happening in some amount of time... in JASS, we mostly use locals in functions rather than globals because they are "faster"...

btw, how many of that kind of trigger have you made and tested? because I already made tons of triggers like that in my life...



and maybe try to read more about it too...

Let me put it this way:

We don't see a revive, so its clear he has it in another trigger hence meaning he needs to store them since he is not using it as an instant, he is most likely using a Wait somewhere else.

(I don't like to assume but that is what it points to)
(Yes you are right about the instant, if people where weird enuf to use an instant revive, 90% of people want a wait feature infront of a revive, I don't see one so hes most likely got it somewhere else)
He could easily use the wait with the locals I added though.
 
Maybe you should have just added wait + revive on that trigger to have the locals make sense... though waits are mostly discouraged because of its inaccuracy...

he said that he's using a command for the revive I think, which means he probably uses the Hero array for that... which will cause problems because he only use 1 index to save each dying hero (index 2)...

If that is the case, then the solution would be, first, use another index for the killing unit (anything above 15 or 16 will do)... then for the dying/triggering unit (the one that can be revived), use Player number of Triggering Player as index... then use that same index too on your revival command trigger...
 
Level 7
Joined
Jan 22, 2013
Messages
293
Maybe you should have just added wait + revive on that trigger to have the locals make sense... though waits are mostly discouraged because of its inaccuracy...

he said that he's using a command for the revive I think, which means he probably uses the Hero array for that... which will cause problems because he only use 1 index to save each dying hero (index 2)...

If that is the case, then the solution would be, first, use another index for the killing unit (anything above 15 or 16 will do)... then for the dying/triggering unit (the one that can be revived), use Player number of Triggering Player as index... then use that same index too on your revival command trigger...


Indubitably. We can not progess any farther until he tells us which he is doing, otherwise we are just guessing, do you agree?
 
Level 3
Joined
Apr 20, 2013
Messages
36
ok sry i got some net problems ....

my COMPLETE trigger is this :

  • Battle
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set TempLoc = (Random point in (Playable map area))
      • Set Hero[1] = (Killing unit)
      • Set Hero[2] = (Triggering unit)
      • For each (Integer C) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of Hero[1]) Equal to (Player(C))
            • Then - Actions
              • Game - Display to (Player group((Triggering player))) the text: ((You have been Killed by |cffff0000 + (Name of (Player(C)))) + |r)
              • Game - Display to (Player group((Player(C)))) the text: ((You have Killed |cffff0000 + (Name of (Triggering player))) + |r. |cffffcc0050 Bonus Gold added|r)
              • Set Kills[C] = (Kills[C] + 1)
              • Set Deaths[(Player number of (Triggering player))] = (Deaths[(Player number of (Triggering player))] + 1)
              • For each (Integer G) from 1 to 10, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Owner of Hero[1]) Not equal to (Player(G))) and ((Owner of Hero[2]) Not equal to (Player(G)))
                    • Then - Actions
                      • Game - Display to (Player group((Player(G)))) the text: ((|cff00ff00 + (Name of (Owner of Hero[1]))) + (|r Have PWNED |cffff0000 + ((Name of (Owner of Hero[2])) + |r.)))
                    • Else - Actions
              • Player - Add 50 to (Player(C)) Current gold
              • Wait 3.00 seconds
              • Hero - Instantly revive Hero[2] at (Random point in (Playable map area)), Show revival graphics
              • Camera - Pan camera for (Triggering player) to (Position of (Triggering unit)) over 1.00 seconds
            • Else - Actions
my problem is that WAIT thing ....

because some times NO REVIVE happens ..... and im sure that its because of that WAIT .....

what should i use instead of that wait to make the same thing ???

i mean i want to revive the dead hero after (for example) 5 second without using wait .....

tnx guys .... you're really helping me :) .....
 
Level 4
Joined
Jan 27, 2010
Messages
133
For Loops do generally not like waits. Why are you using so many for loops?

Here, this will work.

  • Battle
  • Events
    • Unit - A unit Dies
  • Conditions
  • Actions
    • Set KillingPlayer = (Owner Of (Killing unit))
    • Game - Display to (Player group((Triggering player))) the text: ((You have been Killed by |cffff0000 + (Name of (KillingPlayer))) + |r)
    • Game - Display to (Player group((KillingPlayer))) the text: ((You have Killed |cffff0000 + (Name of (Triggering player))) + |r. |cffffcc0050 Bonus Gold added|r)
    • Set Kills[(Player number of (KillingPlayer))] = (Kills[(Player number of (KillingPlayer))] + 1)
    • Set Deaths[(Player number of (Triggering player))] = (Deaths[(Player number of (Triggering player))] + 1)
    • For each (Integer G) from 1 to 10, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Triggering Player) Not equal to (Player(G))) and (KillingPlayer) Not equal to (Player(G)))
          • Then - Actions
            • Game - Display to (Player group((Player(G)))) the text: ((|cff00ff00 + (Name of (KillingPlayer)) + (|r Have PWNED |cffff0000 + (Name of (Triggering Player)) + |r.)))
          • Else - Actions
    • Player - Add 50 to (Killing Player) Current gold
    • Wait 3.00 seconds
    • Hero - Instantly revive (Triggering Unit) at (Random point in (Playable map area)), Show revival graphics
    • Camera - Pan camera for (Triggering player) to (Position of (Triggering unit)) over 1.00 seconds
Notice that after the wait you can not guarantee that your variables have not been changed. (Triggering Unit) is specific for each time the trigger runs, though, so it is fine to use even after a wait.
 
Status
Not open for further replies.
Top