• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Dummy to cast a newly trained unit not working

Status
Not open for further replies.
Level 4
Joined
Jul 14, 2012
Messages
100
[Solved] Dummy to cast a newly trained unit not working

So I've done this.. Basically i want to make the Musketeer unit have a 25% chance to miss on its attacks, but since I cant Add Buffs to units, I just made a dummy unit that casts it on the newly made Musketeer to add the buff right then and there. But it only works sometimes..? And sometimes the dummies dont remove. Any help? I'm sure theres a much easier way >.<

  • musket inaccuracies
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Mounted Musketeer
          • (Unit-type of (Triggering unit)) Equal to Musketeer
    • Actions
      • Unit - Create 1 fakeunit2 for Player 1 (Red) at (Position of (Triggering unit)) facing Default building facing degrees
      • Wait 0.01 seconds
      • Unit - Order (Last created unit) to Undead Banshee - Curse (Triggering unit)
      • Wait 0.60 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has buff Curse) Equal to True
        • Then - Actions
          • Unit - Remove (Last created unit) from the game
        • Else - Actions
          • Wait 0.01 seconds
          • Unit - Order (Last created unit) to Undead Banshee - Curse (Triggering unit)
          • Wait 0.60 seconds
          • Unit - Remove (Last created unit) from the game
 
Last edited:
Level 9
Joined
Jul 10, 2011
Messages
562
soooo....

1. use variables to store positions and use a custom script 'call RemoveLocation(udg_YOURVARIABLENAME)' otherwise it will leak...if you dont know about leaks search for a tutorial....here are some on the hive^^

2. avoid waits...they cause bugs and make problems.

3. to remove the 'fakeunit2' use a expiration timer

4. whats the if/then/else for? you order the dummy to cast curse on the unit....then you check whether the unit still has the buff Oo you can set the duration so you dont have to check.

5. you should learn about triggers...
 
Level 4
Joined
Jul 14, 2012
Messages
100
soooo....

1. use variables to store positions and use a custom script 'call RemoveLocation(udg_YOURVARIABLENAME)' otherwise it will leak...if you dont know about leaks search for a tutorial....here are some on the hive^^

2. avoid waits...they cause bugs and make problems.

3. to remove the 'fakeunit2' use a expiration timer

4. whats the if/then/else for? you order the dummy to cast curse on the unit....then you check whether the unit still has the buff Oo you can set the duration so you dont have to check.

5. you should learn about triggers...

Okay yea I've never used custom scripts before, maybe thats what this needed. I did figure that waits cause problems because it only worked sometimes, and the 2nd If/then/else was a "retry" to curse the unit again, and this made it work more often but it was still messed up so yea. The expiration timer was a way better idea haha.

Yea I'm not a master with triggers or anything lol. But that's why i came here :p

Anyway, thanks defskull! :D you seem to have provided me the solution, and I see how that is much better than my trigger haha. I really appreciate it

EDIT: How do I change the prefix so that this trigger says Solved?
 
Level 9
Joined
Jul 10, 2011
Messages
562
without looking on the trigger i would say there's a line thats 'Game - display to all players the text : XY' ....just remove that line^^
 
Level 4
Joined
Jul 14, 2012
Messages
100
Oh no no, i dont mean something in-game. I mean in this thread, the prefix is trigger. How do i change that to say Solved?
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Usually, people just leave it as it is, I believe it is Moderator's job to make a check in their respective sections and will mark it as solve on their own.

But, some users want to help lighten the burden of a Moderator (which what you're going to do now), by editing their first post (Edit > Go Advanced > Edit the Title add your own prefix [Solve] or whatever)
 
Status
Not open for further replies.
Top