• 🏆 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!

Hero is doubling...

Status
Not open for further replies.
Level 12
Joined
Mar 30, 2013
Messages
664
Hey,

When i have created an spawn trigger for an hero.
{I have created 4 other spawns just like this}
And when it spawns, (like its the last boss)
It is doubling him, making him spawn 2 instead of 1.
I dont know why, i have seen trough the triggers and i cant find any problems with it.

Hope some one can help me and +Rep for him who helpes!

(i really need to fix it because its an ultimate hero and it most be 1 and not 2.)
Or the game will be to hard :ogre_frown:

Thanks :goblin_yeah:

EDIT:
If you want to see the triggers:
  • Garomul
    • Events
      • Time - Elapsed game time is 2700.00 seconds
    • Conditions
    • Actions
      • Set TempGroup = (Units in (Playable map area) matching ((Owner of (Matching unit)) Equal to (==) Player 1 (Red)))
      • Set TempGroup2 = (Units in (Playable map area) matching ((((Matching unit) belongs to an enemy of Player 1 (Red)) Equal to (==) True) and ((Unit-type of (Matching unit)) Not equal to (!=) )))
      • Set Unitposition = (Position of (Random unit from TempGroup2))
        • Do Multiple ActionsFor each (Integer A) from 1 to 1, do (Actions)
          • Loop - Actions
            • Set Spawn_Point2[1] = (Random point in SpawnRegions2[(Random integer number between 1 and 3)])
            • Unit - Create 1 |cff8b008bDaemonic God|r for Player 1 (Red) at Spawn_Point2[1] facing Default building facing (270.0) degrees
            • Unit - Order (Last created unit) to Attack-Move To Unitposition
            • Custom script: call RemoveLocation (udg_Spawn_Point2[1])
            • Custom script: call RemoveLocation (udg_Spawn_Point2[bj_forLoopAIndex])
            • Wait 0.00 seconds
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: call DestroyGroup(udg_TempGroup2)
      • Custom script: call RemoveLocation(udg_Unitposition)
      • Wait 5.00 seconds
      • Game - Display to (All players) the text: |cFF8000FFGaromul: ...
  • Garomul Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to (==) |cff8b008bDaemonic God|r
    • Actions
      • Game - Display to (All players) for 5.00 seconds the text: |cFF00FF00Garomul: ...
      • Wait 5.00 seconds
      • Game - Display to (All players) for 5.00 seconds the text: |cFF00FF00World Tre...
      • Wait 10.00 seconds
      • Game - Victory Player 3 (Teal) (Show dialogs, Show scores)
      • Game - Victory Player 7 (Green) (Show dialogs, Show scores)
      • Game - Victory Player 8 (Pink) (Show dialogs, Show scores)
Still, even if im quite sure of that every thing is alright.
Tho, now i put in another hero spawn, that aint the last boss.
  • Wyklin
    • Events
      • Time - Elapsed game time is 1780.00 seconds
    • Conditions
    • Actions
      • Set TempGroup = (Units in (Playable map area) matching ((Owner of (Matching unit)) Equal to (==) Player 1 (Red)))
      • Set TempGroup2 = (Units in (Playable map area) matching ((((Matching unit) belongs to an enemy of Player 1 (Red)) Equal to (==) True) and ((Unit-type of (Matching unit)) Not equal to (!=) )))
      • Set Unitposition = (Position of (Random unit from TempGroup2))
        • Do Multiple ActionsFor each (Integer A) from 1 to 1, do (Actions)
          • Loop - Actions
            • Set Spawn_Point2[1] = (Random point in SpawnRegions2[(Random integer number between 1 and 3)])
            • Unit - Create 1 |cff8b008bDaemonic God|r for Player 1 (Red) at Spawn_Point2[1] facing Default building facing (270.0) degrees
            • Unit - Order (Last created unit) to Attack-Move To Unitposition
            • Custom script: call RemoveLocation (udg_Spawn_Point2[1])
            • Custom script: call RemoveLocation (udg_Spawn_Point2[bj_forLoopAIndex])
            • Wait 0.00 seconds
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: call DestroyGroup(udg_TempGroup2)
      • Custom script: call RemoveLocation(udg_Unitposition)
      • Wait 5.00 seconds
      • Game - Display to (All players) the text: |cFF800080Wyklin: N...
  • Wyklins Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to (==) |cff8b008bDaemonic God|r
    • Actions
      • Game - Display to (All players) for 5.00 seconds the text: |cFF800080Wyklin: ....
As you might see they are totaly the same.
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
You don't get it.
The idea of loops is that you make a piece of script and make it repeat itself over and over, instead of writing those things manually X times.

Let's say you want to create special effect 50 times.
Why would you copy and paste the two commands (one for effect creation, another for effect removal) 50 times? The trigger gets messy immediately - hence you use loops. You set it up so the loop repeats 50 times and paste those two commands in only once.

However what you have in trigger - the loop runs only do it once, so why would there be a need to initialize integer variables for those loops if you loop it only once? Makes no sense any way I try to look at it.

Me saying it should loop at least twice is from the general view of loop usage - if you don't need something to loop, don't go through the excessive work by putting it in loop block that never repeats.


EDIT:
Ok, I took a look at your triggers. Many things don't even make sense there.

First of all, I don't know if you edited the copied trigger before posting it, but the TempGroup2 has problems when created checks two conditions: one is that matching unit belongs to player 1 and second is that unit-type of matching unit does not equal to ??? - You have nothing put in the ??? or the name of the unit is " "?

Whenever you use loops "For Each Integer...", don't use the "For Each Integer A/B..." options, use the "For Each Integer Variable..." and put your own variable in there. It's better and less problematic (just make a unique variable called e.g. LoopVar that you use specifically for loops).

This makes no sense:
  • Custom script: call RemoveLocation (udg_Spawn_Point2[1])
  • Custom script: call RemoveLocation (udg_Spawn_Point2[bj_forLoopAIndex])
Because the loop runs only once (from 1 to 1), so the bj_forLoopAIndex (which is jass equivalent to "Integer A") returns number 1, so you end up with two very same commands in succession. Bad move that one. Just remove one line or the other next time.

Now, in your trigger you have no need for the loop, hence put everything from the Loop block outside of it.

Remove the 0.00 second wait. It serves no real purpose and may actually only cause problems.

The very same thing applies to Wyklin trigger.
Garomul Death and Wyklin Death triggers seem to be OK.
 
Last edited:
Level 12
Joined
Mar 30, 2013
Messages
664
I do understand loop more and more.
''Ok, I took a look at your triggers. Many things don't even make sense there''

Ok, it aint i who have done it but i will fix it if it should be an problem. (try to!)

''one is that matching unit belongs to player 1''

Dont see any problems with that.

''unit-type of matching unit does not equal to ??? - You have nothing put in the ??? or the name of the unit is " "?''

It did just stop after not equal to .... Why that ''(!=) )))'' is showing i dont know.

''Remove the 0.00 second wait''

I removed it and it dont duplicate the hero anymore.

''Garomul Death and Wyklin Death triggers seem to be OK''

Ok.

And thank you for helping me i really appreciate it!
Wish i could +Rep you for it but i have already given you.
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Ugh sorry, I wrote it poorly. I meant that the problem was with the unit group's condition. The one with player 1 red is okay, but the other has equal to nothing (the != means not equal to, I don't think that is any bug or anything) the problem is that there is nothing after the not-equal to.

Anyway glad you solved your issue.
 
Status
Not open for further replies.
Top