Ability won't trigger more than once?

nabbig2

New Member
Reaction score
43
When an ability, Grenade for Dummy is cast, there is another trigger that works and creates a projectile. The problem is that it is only working once, and I want it to work 3 or 4 times so that many missiles are sent.

This is the trigger:

Code:
Grenade Copy
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Grenade 
    Actions
        Set F_Pt_Grenade_TriggerPos = (Position of (Triggering unit))
        Set F_Pt_Grenade_TargetPos = (Target point of ability being cast)
        Unit - Create 1 Dummy grenade 2 for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
        Unit - Add Grenade for dummy to (Last created unit)
        Unit - Set level of Grenade for dummy for (Last created unit) to (Level of Grenade  for (Triggering unit))
        Unit - Order (Last created unit) to Neutral Pit Lord - Rain Of Fire (Target point of ability being cast)

So when the Ability is cast in this trigger, the other trigger works successfully. The problem is that when I try to have the Ability be cast more than once, it doesn't work, for some damn reason. I tried putting a wait and ordering the dummy to cast again (I did use variables), I tried ordering the dummy to cast it more than once, but I have no clue why it works only once, I also tried using Integer A. Thanks a lot, +rep.
 

ManyTimes

I'm so lonesome I could cry...
Reaction score
293
Your trigger there should work fine.

Code:
        Set F_Pt_Grenade_TriggerPos = (Position of (Triggering unit))
        Set F_Pt_Grenade_TargetPos = (Target point of ability being cast)
        Unit - Create 1 Dummy grenade 2 for (Owner of (Triggering unit)) at [COLOR="Red"]F_Pt_Grenade_TriggerPos [/COLOR]facing Default building facing degrees
        Unit - Add Grenade for dummy to (Last created unit)
        Unit - Set level of Grenade for dummy for (Last created unit) to (Level of Grenade  for (Triggering unit))
        Unit - Order (Last created unit) to Neutral Pit Lord - Rain Of Fire [COLOR="Red"]F_Pt_Grenade_TargetPos[/COLOR])
       [COLOR="DeepSkyBlue"]Custom Script: call RemoveLocation(udg_F_Pt_Grenade_TargetPos)
       Custom Script: call RemoveLocation(udg_F_Pt_Grenade_TriggerPos)[/COLOR]
Add the blue lines, change the red lines, together they fix the leaks.
Now, show us the other trigger, cause this trigger works over and over again as long as the trigger is not turned off anywhere...

PS: What is it supposed to do? What works only once? The effect of the Rain of Fire, it damages only once and you want it to repeat? If so, how about changing the number of waves in object editor > abilities > rain of fire...
 

nabbig2

New Member
Reaction score
43
Well here are the other triggers (the spell is taken from Vypur's template)

Code:
Map Init for Grenade
    Events
        Map initialization
    Conditions
    Actions
        Set F_Abi_Grenade = Grenade 
        Set F_Abi_Grenade_Copy = Grenade for dummy
        Set F_UnitType_Bullet_Grenade = Dummy grenade
        -------- Settings --------
        Set F_Real_Set_AOE = 350.00
        Set F_Real_Set_Damage = 200.00
        Set F_Real_Set_DamagePerLevel = 75.00
        Set F_Real_Set_Height = 100.00

Code:
Grenade
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        Or - Any (Conditions) are true
            Conditions
                (Ability being cast) Equal to F_Abi_Grenade
                (Ability being cast) Equal to Grenade for dummy
    Actions
        Set F_Pt_Grenade_TriggerPos = (Position of (Triggering unit))
        Set F_Pt_Grenade_TargetPos = (Target point of ability being cast)
        Unit - Create 1 F_UnitType_Bullet_Grenade for (Owner of (Triggering unit)) at F_Pt_Grenade_TriggerPos facing (Angle from F_Pt_Grenade_TriggerPos to F_Pt_Grenade_TargetPos) degrees
        Unit - Add F_Abi_Grenade to (Last created unit)
        Unit - Set level of F_Abi_Grenade for (Last created unit) to (Level of F_Abi_Grenade for (Triggering unit))
        Unit - Set life of (Last created unit) to ((Distance between F_Pt_Grenade_TriggerPos and F_Pt_Grenade_TargetPos) / 120.00)
        Unit - Turn collision for (Last created unit) Off
        Unit Group - Add (Last created unit) to F_Unitgp_Grenade_Move
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Grenade Movement <gen> is on) Equal to False
            Then - Actions
                Trigger - Turn on Grenade Movement <gen>
            Else - Actions
        Custom script:   call RemoveLocation (udg_F_Pt_Grenade_TriggerPos)
        Custom script:   call RemoveLocation (udg_F_Pt_Grenade_TargetPos)

Code:
Grenade Movement
    Events
        Time - Every 0.01 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in F_Unitgp_Grenade_Move and do (Actions)
            Loop - Actions
                Set F_Unit_Grenade_PickedUnit = (Picked unit)
                Set F_Pt_Grenade_PickedPos = (Position of (Picked unit))
                Set F_Pt_Grenade_TargetPos = (F_Pt_Grenade_PickedPos offset by (Life of (Picked unit)) towards (Facing of (Picked unit)) degrees)
                Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) + 1)
                Unit - Move (Picked unit) instantly to F_Pt_Grenade_TargetPos
                Set F_Real_Grenade_FlyHeight = ((Power(60.00, 2.00)) - (Power(((Real((Custom value of (Picked unit)))) - 60.00), 2.00)))
                Animation - Change (Picked unit) flying height to (F_Real_Grenade_FlyHeight / (3600.00 / F_Real_Set_Height)) at 0.00
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Custom value of (Picked unit)) Greater than or equal to 120
                    Then - Actions
                        Set F_Unitgp_Grenade_AOE = (Units within 350.00 of F_Pt_Grenade_PickedPos matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))
                        Unit Group - Pick every unit in F_Unitgp_Grenade_AOE and do (Actions)
                            Loop - Actions
                                Unit - Cause F_Unit_Grenade_PickedUnit to damage (Picked unit), dealing ((Real((Point-value of (Unit-type of F_Unit_Grenade_PickedUnit)))) x 1.00) damage of attack type Spells and damage type Magic
                        Special Effect - Create a special effect at F_Pt_Grenade_PickedPos using Units\NightElf\Wisp\WispExplode.mdl
                        Special Effect - Destroy (Last created special effect)
                        Special Effect - Create a special effect at F_Pt_Grenade_PickedPos using Abilities\Spells\Orc\FeralSpirit\feralspiritdone.mdl
                        Special Effect - Destroy (Last created special effect)
                        Unit - Remove (Picked unit) from the game
                        Custom script:   call DestroyGroup (udg_F_Unitgp_Grenade_AOE)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Terrain pathing at F_Pt_Grenade_PickedPos of type Walkability is off) Equal to True
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Facing of (Picked unit)) Greater than or equal to 0.00
                                (Facing of (Picked unit)) Less than 180.00
                            Then - Actions
                                Unit - Make (Picked unit) face ((Facing of (Picked unit)) + 10.00) over 0.00 seconds
                            Else - Actions
                                Unit - Make (Picked unit) face ((Facing of (Picked unit)) - 10.00) over 0.00 seconds
                    Else - Actions
                Custom script:   call RemoveLocation (udg_F_Pt_Grenade_TargetPos)
                Custom script:   call RemoveLocation (udg_F_Pt_Grenade_PickedPos)

Well rain of fire is simply the Order ID for the Ability, which is based off of channel. Each time this ability is cast, a dummy unit shaped like an arrow is shot, and I want to have 3 or 4 of these "arrows".

I am also using this trigger to test if the ability is cast:

Code:
Untitled Trigger 001
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Grenade for dummy
    Actions
        Unit - Create 1 Footman for Player 1 (Red) at (Center of duncesplayer1 <gen>) facing Default building facing degrees

See the problem isthat Grenade for Dummy needs to be somehow cast more times, so that those other triggers will run and I can get more arrows. But for some reason, it won't cast, and footmen aren't created more than once each time I use the ability.
 

ManyTimes

I'm so lonesome I could cry...
Reaction score
293
Hmm... care to upload the map instead, or a new map with the spell/units inside it? Your trigger was longer than I hoped for! :p
 

vypur85

Hibernate
Reaction score
803
Oh crab. =.= No wonder I felt familiar with the variable names you used.

So what do you want? Throw multiple grenades? Grenades are thrown simultaneously or intervally? I can try fix it for your own needs.
 

nabbig2

New Member
Reaction score
43
I want multiple grenades to be thrown, in the same line of fire as the first one, is all. Just like shooting a volley of arrows one right after the other, thanks. Also I can list your name under Credits in my map if you want.
 

vypur85

Hibernate
Reaction score
803
Code:
Grenade
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to F_Abi_Grenade
    Actions
        Custom script:   local location udg_F_Pt_Grenade_TargetPos
        Custom script:   local integer i = 0
        Set F_Pt_Grenade_TargetPos = (Target point of ability being cast)
        Custom script:   loop
        Custom script:   exitwhen i == 5
        Custom script:   set i = i + 1
        Set F_Pt_Grenade_TriggerPos = (Position of (Triggering unit))
        Unit - Create 1 F_UnitType_Bullet_Grenade for (Owner of (Triggering unit)) at F_Pt_Grenade_TriggerPos facing (Angle from F_Pt_Grenade_TriggerPos to F_Pt_Grenade_TargetPos) degrees
        Unit - Add F_Abi_Grenade to (Last created unit)
        Unit - Set level of F_Abi_Grenade for (Last created unit) to (Level of F_Abi_Grenade for (Triggering unit))
        Unit - Set life of (Last created unit) to ((Distance between F_Pt_Grenade_TriggerPos and F_Pt_Grenade_TargetPos) / 120.00)
        Unit - Turn collision for (Last created unit) Off
        Unit Group - Add (Last created unit) to F_Unitgp_Grenade_Move
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Grenade Movement <gen> is on) Equal to False
            Then - Actions
                Trigger - Turn on Grenade Movement <gen>
            Else - Actions
        Custom script:   call RemoveLocation (udg_F_Pt_Grenade_TriggerPos)
        Wait 0.10 game-time seconds
        Custom script:   endloop
        Custom script:   call RemoveLocation (udg_F_Pt_Grenade_TargetPos)
        Custom script:   set udg_F_Pt_Grenade_TargetPos = null

Not sure if this would work. But it should create 5 grenades at 0.1 seconds intervals (the interval may be inaccurate, but it doesn't matter). The above is not tested. Hope it doesn't compile error. Other triggers remain the same.
 

Attachments

  • Grenade Multiple.w3x
    20.8 KB · Views: 78
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top