Buff won't apply twice?

tommerbob

Minecraft. :D
Reaction score
110
Got a "camouflage" skill that makes a unit invisible as long as it remains still. I'm using Permanent Invisibility and Ghost abilities for the invis (so that he can still cast spells while invisible), and using a dummy buff based on inner fire.

Now here's my problem: The skill works fine the first time it is cast, but every time after the first cast, the dummy buff is not applied and the unit does not get permanent invis or ghost. I have no idea why this is happening, I'm guessing its something really simple that I have overlooked. I added a debug message to make sure the trigger was actually running, and it is, but no buff is applied and no abilities are given.

Thanks in advance for any help.

Codes:

Trigger:
  • Camouflage cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Camouflage
    • Actions
      • -------- GLOBALS --------
      • Set Camouflage_Caster = (Triggering unit)
      • Set Camouflage_Point = (Position of Camouflage_Caster)
      • -------- hit points healed per second --------
      • Set Camouflage_HealAmount = (Hero_SpellPower x 0.50)
      • -------- spell duration --------
      • Set Camouflage_Duration = (15.00 + (5.00 x (Real((Level of Camouflage for Camouflage_Caster)))))
      • -------- detection chance --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Aspect_Learned Equal to True
        • Then - Actions
          • Set Camouflage_DetectChance = ((45.00 - (5.00 x (Real((Level of Camouflage for Camouflage_Caster))))) - (2.00 x (Real((Level of Aspect of the Hunter for Camouflage_Caster)))))
        • Else - Actions
          • Set Camouflage_DetectChance = (45.00 - (5.00 x (Real((Level of Camouflage for Camouflage_Caster)))))
      • -------- detection range --------
      • Set Camouflage_DetectAOE = 400.00
      • -------- end globals --------
      • Game - Display to (All players) the text: Camouflage is cast
      • Unit - Add Camouflage (dummy buff) to Spell_Caster
      • Unit - Order Spell_Caster to Human Priest - Inner Fire Camouflage_Caster
      • Unit - Remove Camouflage (dummy buff) from Spell_Caster
      • Unit - Add Permanent Invisibility to Camouflage_Caster
      • Unit - Add Ghost to Camouflage_Caster
      • Unit - Pause Camouflage_Caster
      • Unit - Order Camouflage_Caster to Hold Position
      • Unit - Unpause Camouflage_Caster
      • Trigger - Turn on Camouflage timer <gen>
      • Trigger - Turn on Camouflage damage detect <gen>


Trigger:
  • Camouflage timer
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set Camouflage_Duration = (Camouflage_Duration - 1.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Camouflage_Caster has buff Camouflage ) Equal to True
        • Then - Actions
        • Else - Actions
          • Trigger - Turn off (This trigger)
          • Unit - Remove Ghost from Camouflage_Caster
          • Unit - Remove Permanent Invisibility from Camouflage_Caster
          • Custom script: call RemoveLocation(udg_Camouflage_Point)
          • Skip remaining actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (X of (Position of Camouflage_Caster)) Equal to (X of Camouflage_Point)
          • (Y of (Position of Camouflage_Caster)) Equal to (Y of Camouflage_Point)
        • Then - Actions
          • Unit - Set life of Camouflage_Caster to ((Life of Camouflage_Caster) + Camouflage_HealAmount)
          • Floating Text - Create floating text that reads (+ + (String((Integer(Camouflage_HealAmount))))) above Camouflage_Caster with Z offset 10.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Set the velocity of (Last created floating text) to 96.00 towards (Random real number between 45.00 and 160.00) degrees
          • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
        • Else - Actions
          • Trigger - Turn off (This trigger)
          • Unit - Remove Camouflage buff from Camouflage_Caster
          • Unit - Remove Ghost from Camouflage_Caster
          • Unit - Remove Permanent Invisibility from Camouflage_Caster
          • Custom script: call RemoveLocation(udg_Camouflage_Point)
          • Skip remaining actions
      • -------- ENEMIES MUST BE WITHIN RANGE TO DETECT --------
      • Set Camouflage_DetectGroup = (Units within Camouflage_DetectAOE of Camouflage_Point matching (((((Matching unit) is A structure) Not equal to True) and (((Matching unit) is alive) Equal to True)) and (((Matching unit) belongs to an enemy of (Owner of Camouflage_Caster)) Equal to True)))
      • -------- ENEMY MUST BE ABLE TO SEE PROWLER --------
      • Unit Group - Pick every unit in Camouflage_DetectGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Camouflage_Point is visible to (Owner of (Picked unit))) Not equal to True
            • Then - Actions
              • Unit Group - Remove (Picked unit) from Camouflage_DetectGroup
            • Else - Actions
      • Set Camouflage_DetectGroupCount = (Number of units in Camouflage_DetectGroup)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Camouflage_DetectGroupCount Less than or equal to 0
        • Then - Actions
        • Else - Actions
          • Unit Group - Pick every unit in Camouflage_DetectGroup and do (Actions)
            • Loop - Actions
              • Set Camouflage_DetectPoint[0] = (Position of (Picked unit))
              • Set Camouflage_DetectPoint[1] = (Camouflage_DetectPoint[0] offset by 500.00 towards (Facing of (Picked unit)) degrees)
          • -------- CAN DETECT IF ENEMY IS FACING --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between Camouflage_Point and Camouflage_DetectPoint[1]) Less than (Distance between Camouflage_DetectPoint[0] and Camouflage_DetectPoint[1])
            • Then - Actions
              • Set Camouflage_DetectRoll = (Random real number between 1.00 and 100.00)
              • -------- CASTER DETECTED --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Camouflage_DetectRoll Less than or equal to Camouflage_DetectChance
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                  • Unit - Remove Camouflage buff from Camouflage_Caster
                  • Unit - Remove Ghost from Camouflage_Caster
                  • Unit - Remove Permanent Invisibility from Camouflage_Caster
                  • Custom script: call DestroyGroup(udg_Camouflage_DetectGroup)
                  • Custom script: call RemoveLocation(udg_Camouflage_Point)
                • Else - Actions
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Camouflage_Duration Less than or equal to 0.00
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Unit - Remove Camouflage buff from Camouflage_Caster
          • Unit - Remove Ghost from Camouflage_Caster
          • Unit - Remove Permanent Invisibility from Camouflage_Caster
          • Custom script: call DestroyGroup(udg_Camouflage_DetectGroup)
          • Custom script: call RemoveLocation(udg_Camouflage_Point)
        • Else - Actions
      • Custom script: call RemoveLocation(udg_Camouflage_DetectPoint[0])
      • Custom script: call RemoveLocation(udg_Camouflage_DetectPoint[1])
 

tommerbob

Minecraft. :D
Reaction score
110
I don't think so. The damage detection is only to remove the buff and invisibility if he deals damage. I'll post it just in case:

Trigger:
  • Camouflage damage detect
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • GDD_DamageSource Equal to Camouflage_Caster
      • (Camouflage_Caster has buff Camouflage ) Equal to True
    • Actions
      • Trigger - Turn off (This trigger)
      • Unit - Remove Camouflage buff from Camouflage_Caster
      • Unit - Remove Ghost from Camouflage_Caster
      • Unit - Remove Permanent Invisibility from Camouflage_Caster
 

tommerbob

Minecraft. :D
Reaction score
110
Okay now this is really starting to annoy me. I switched over the spell and buff to a test map and it works perfectly fine, every time. But in my original map, it only works the first time.

Yes, I double-checked ALL triggers in my map to make sure it does not affect the casting trigger. I know that is not the problem because I have a debug message that runs every time I cast the spell to make sure the trigger is actually working, which it is. But the buff and permanent invisibility and ghost abilities are not being given to the caster on any casts except the first time.

I hope that all made sense.

Not that it will help, but here is a test map with the working spell. You can look at it and compare it to the one I have above. The ONLY thing I changed was to create a new dummy caster each time the spell is cast, instead of using the permanent dummy caster I have in the original map. (This is not the problem either, because I tried doing that in the original map...but didn't work.)

:banghead: :banghead: :banghead:
 

Attachments

  • Camouflage.w3x
    16 KB · Views: 128

Weep

Godspeed to the sound of the pounding
Reaction score
400
It beats me. You didn't include the damage detection trigger in the test map; I suggest you put a text message in that one (or everywhere the buff can be removed, actually) to see if it's enabling and instantly being mistakenly removed.
 

tommerbob

Minecraft. :D
Reaction score
110
Well well well. It was the damage detection trigger after all that was causing it to bug. I disabled it, and vwala! It works fine. hgkjfhfdsj's instinct proved true! :p

Thanks a lot for the help Weep and hgkjfhfdsj. Weep it won't let me rep you. You help me way too damn much. rofl.

Okay now here's the problem. Without the damage detection, the hero can attack anyone for the duration of the spell and still be invis. I suppose I could try just detecting an attack instead of dealing damage, but I never really liked that method. Any ideas on a round-about way to do this?
 
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