• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

bug in my trigger!

Status
Not open for further replies.
Level 2
Joined
Oct 22, 2009
Messages
18
hey, so i have adjusted this trigger i have (that worked), because of a bug i found in my map. i changed it by adding the "if/then/else" part, where it now checks if its within a region before doing its response.

  • Prevent block P12 Blue
    • Events
      • Unit - A unit owned by Player 2 (Blue) Is attacked
    • Conditions
      • (Owner of (Attacking unit)) Equal to Player 12 (Brown)
    • Actions
      • Wait 0.00 seconds
      • Unit - Turn collision for (Attacking unit) Off
      • Animation - Change (Attacking unit)'s vertex coloring to (100.00%, 0.00%, 0.00%) with 20.00% transparency
      • If ((team1 antiblock <gen> contains (Triggering unit)) Equal to False) then do (Unit - Order (Triggering unit) to Move To (Center of Team1 All1 <gen>)) else do (Unit - Order (Triggering unit) to Move To (Center of Team1 AllDie <gen>))
      • Wait 2.00 seconds
      • Unit - Turn collision for (Attacking unit) On
      • Animation - Change (Attacking unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
problem is, now with that part in it, the monster actually attacks the buildings when blocked, which causes him to go red etc, but he doesnt try move to the location like hes told.

please help me fix this problem, my map is so close to being finished, and i cant release it knowing of this bug.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
hey, so i have adjusted this trigger i have (that worked), because of a bug i found in my map. i changed it by adding the "if/then/else" part, where it now checks if its within a region before doing its response.

  • Prevent block P12 Blue
    • Events
      • Unit - A unit owned by Player 2 (Blue) Is attacked
    • Conditions
      • (Owner of (Attacking unit)) Equal to Player 12 (Brown)
    • Actions
      • Wait 0.00 seconds
      • Unit - Turn collision for (Attacking unit) Off
      • Animation - Change (Attacking unit)'s vertex coloring to (100.00%, 0.00%, 0.00%) with 20.00% transparency
      • If ((team1 antiblock <gen> contains (Triggering unit)) Equal to False) then do (Unit - Order (Triggering unit) to Move To (Center of Team1 All1 <gen>)) else do (Unit - Order (Triggering unit) to Move To (Center of Team1 AllDie <gen>))
      • Wait 2.00 seconds
      • Unit - Turn collision for (Attacking unit) On
      • Animation - Change (Attacking unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
problem is, now with that part in it, the monster actually attacks the buildings when blocked, which causes him to go red etc, but he doesnt try move to the location like hes told.

please help me fix this problem, my map is so close to being finished, and i cant release it knowing of this bug.

first of all:

why do you have a wait 0.00 seconds action in your trigger 0.o? It just doesn't wait at all XD
That's the same as using the do nothing action... It does NOTHING, why bother to put it in there then? :D
also: waits are inacurate ;) It's not exactly 2 seconds...

second of all:

try using attacked unit instead of triggering unit that could solve the problem... ;)
 
Level 2
Joined
Oct 22, 2009
Messages
18
attacking unit... its a tower defense, so i dont want the towers moving :p

also with the wait, i dunno.. someone made me that trigger, and thats how they did it for me... (not incuding the if/then/else)

EDIT: yea after testing, the trigger doesnt work unless that wait is there. if i remove it, they go red etc, but just stand there until they die. with the wait, they will walk through the buildings towards the proper location.

BUT. this only works for purple and red, since they only have 1 place to go, always (so no if/then/else). but when the other colours have if/then/else, they just destroy the guys buildings, instead of doing what they are told. please help me
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
OHHHH i see sorry. yes i put triggering instead of attacking, in my if/then/else. that'l be it -.-

thats what I said in the first post...

try using attacked unit instead of triggering unit that could solve the problem... ;)

but I said attacked unit because I thought that, that was what you where trying to do ;) since triggering = attacked
 
Level 14
Joined
Aug 31, 2009
Messages
775
I'm surprised nobody noticed the glaring error here.

The "wait 2.00 seconds" is causing a bug immediatly. If you have a wait for any length of time, and the trigger is then activated again before that time is over, the trigger will nearly always work incorrectly when using unit references.

You should use Local Variables instead of global variables (or remove the waits and use a different method). There are some basic JASS tutorials for this on the website.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
I'm surprised nobody noticed the glaring error here.

The "wait 2.00 seconds" is causing a bug immediatly. If you have a wait for any length of time, and the trigger is then activated again before that time is over, the trigger will nearly always work incorrectly when using unit references.

You should use Local Variables instead of global variables (or remove the waits and use a different method). There are some basic JASS tutorials for this on the website.

your right 0.o! How stupid that I forgot ;(
 
Status
Not open for further replies.
Top