Casting 1 spell makes my other spell go off too... HELP!

KvickaN

TH.net Regular
Reaction score
24
Code:
Reinforcement Part1
    Events
        Unit - A unit Begins casting an ability
    Conditions
    Actions
        For each (Integer A) from 1 to 4, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Ability being cast) Equal to Reinforcement ) and ((Owner of (Casting unit)) Equal to (Player((Integer A))))
                    Then - Actions
                        Special Effect - Create a special effect at (Position of (Casting unit)) using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
                        Unit - Hide (Casting unit)
                        Set FarmUnit[(Player number of (Owner of (Casting unit)))] = (Casting unit)
                        Unit - Create 1 Reinforcement Farm for (Owner of (Casting unit)) at ((Owner of (Casting unit)) start location) facing Default building facing degrees
                        Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
                        Countdown Timer - Start Timer[(Player number of (Owner of (Casting unit)))] as a One-shot timer that will expire in 30.00 seconds
                    Else - Actions

Code:
Spawn Control Red
    Events
        Unit - A unit Begins casting an ability
    Conditions
    Actions
        For each (Integer A) from 1 to 4, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Ability being cast) Equal to Spawn Control ) and ((Owner of (Casting unit)) Equal to Player 1 (Red))
                    Then - Actions
                        Game - Display to (All players) the text: RED USED SPAWN CONT...
                        Special Effect - Create a special effect at (Position of (Casting unit)) using Objects\Spawnmodels\Naga\NagaDeath\NagaDeath.mdl
                        Trigger - Turn off Give Sheeps To Killer <gen>
                        Trigger - Turn off Spawn Sheeps <gen>
                        Trigger - Turn on RED Give Sheeps To Killer SPAWN CONTROL <gen>
                        Wait 20.00 seconds
                        Trigger - Turn off RED Give Sheeps To Killer SPAWN CONTROL <gen>
                        Trigger - Turn on Give Sheeps To Killer <gen>
                        Trigger - Turn on Spawn Sheeps <gen>
                        Game - Display to (All players) the text: 20 Seconds have pas...
                    Else - Actions

When I use "Spawn Control" the "Reinforcement" also go off. How do I solve this?
 

xombie

New Member
Reaction score
2
Easy, actually, just add a condition that checks what spell is being casted. Currently your triggers are both executing when "any" spell is cast, just narrow each down to specific spells.

** edit **

How do I delete a post? I didn't see Jesus4Lyf's post above mine so I went ahead and posted.
 

KvickaN

TH.net Regular
Reaction score
24
Condition
Ability comparison

Ability Being Cast == X.

Edit: Oops, just saw it in the loop. Odd.

Base the abilities off different base abilities, or they have the same order id, and will fire regardless which you click.

Thank you :)

Easy, actually, just add a condition that checks what spell is being casted. Currently your triggers are both executing when "any" spell is cast, just narrow each down to specific spells.

Condition in loop.
 

xombie

New Member
Reaction score
2
Wow, sorry for the double post but I've never seen this kind of forum-thread attendancy evar.
 

xombie

New Member
Reaction score
2
This thread just went from 0 replies to like, 7, in about 30 seconds.

Agreed. hehe.

Indeed.
 

KvickaN

TH.net Regular
Reaction score
24
Hehe ok guys, chill.

Base the abilities off different base abilities, or they have the same order id, and will fire regardless which you click.

Worked perfectly, thanks. +rep

Edit: gave rep to you recently, can't do it now. :p
 

vypur85

Hibernate
Reaction score
803
Just a sidenote. Since you are using waits in the loop, it is advisable to use custom integer variable. Because if there are more than one Integer A loop run together, it will cancel the previous one (not sure how to explain :p).

Code:
        For each [B](Integer A)[/B] from 1 to 4, do (Actions) <-- Use custom variable
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Ability being cast) Equal to Spawn Control ) and ((Owner of (Casting unit)) Equal to Player 1 (Red))
                    Then - Actions
                        Game - Display to (All players) the text: RED USED SPAWN CONT...
                        Special Effect - Create a special effect at (Position of (Casting unit)) using Objects\Spawnmodels\Naga\NagaDeath\NagaDeath.mdl
                        Trigger - Turn off Give Sheeps To Killer <gen>
                        Trigger - Turn off Spawn Sheeps <gen>
                        Trigger - Turn on RED Give Sheeps To Killer SPAWN CONTROL <gen>
                        Wait 20.00 seconds
                        Trigger - Turn off RED Give Sheeps To Killer SPAWN CONTROL <gen>
                        Trigger - Turn on Give Sheeps To Killer <gen>
                        Trigger - Turn on Spawn Sheeps <gen>
                        Game - Display to (All players) the text: 20 Seconds have pas...
                    Else - Actions
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top