• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Trigger Spell Problem

Status
Not open for further replies.
Level 4
Joined
Nov 11, 2004
Messages
50
Hello I'm currently making a spell that takes 50% of the target enemy heros intelligence for and gives it to the caster for 60 seconds. Now the problem is that the intelligence wont go back to normal after 60 seconds, the caster has the bonus intelligence while the target enemy hero still has the lost intelligence.

Heres my trigger I cant see why it doesnt work

Part 1:

PHP:
Static Intelligence
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Static Intelligence (Thunder Watcher Starter Ability)
    Actions
        Set TW_StaticIntelPoint = (Position of (Casting unit))
        Set TW_StaticIntelCaster = (Casting unit)
        Set TW_StaticIntellEnemy = (Target unit of ability being cast)
        Hero - Modify Intelligence of TW_StaticIntelCaster: Add (Integer(((Real((Intelligence of TW_StaticIntellEnemy (Exclude bonuses)))) x 0.50)))
        Hero - Modify Intelligence of TW_StaticIntellEnemy: Subtract (Integer(((Real((Intelligence of TW_StaticIntellEnemy (Exclude bonuses)))) x 0.50)))
        Countdown Timer - Start TW_StaticChallengeTimer as a One-shot timer that will expire in 60.00 seconds
        Floating Text - Create floating text that reads (String(((Real((Intelligence of TW_StaticIntellEnemy (Exclude bonuses)))) x 0.50))) at TW_StaticIntelPoint with Z offset 10.00, using font size 10.00, color (50.00%, 50.00%, 100.00%), and 0.00% transparency
        Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
        Floating Text - Change the fading age of (Last created floating text) to 4.00 seconds
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds

Part 2:

PHP:
Static Intelligence Over
    Events
        Time - TW_StaticChallengeTimer expires
    Conditions
    Actions
        Set TW_StaticIntelCaster = (Casting unit)
        Set TW_StaticIntellEnemy = (Target unit of ability being cast)
        Hero - Modify Intelligence of TW_StaticIntellEnemy: Add (Integer(((Real((Intelligence of TW_StaticIntellEnemy (Exclude bonuses)))) x 0.50)))
        Hero - Modify Intelligence of TW_StaticIntelCaster: Subtract (Integer(((Real((Intelligence of TW_StaticIntellEnemy (Exclude bonuses)))) x 0.50)))
 
Level 9
Joined
Feb 19, 2006
Messages
115
First off, I assume the 'TW_' variables are global...

1)

Static Intelligence Over
...
Set TW_StaticIntelCaster = (Casting unit)
Set TW_StaticIntelCaster = (Target unit of ability being cast)
...

Get rid of those two set lines...
Setting something to 'event responses', like casting unit, will set it to the last caster of ANY spell at the time the trigger goes off (which is when the timer runs out, not when it starts). That's bad...

example:
Code:
Player 1 casts "Intelligence" on Player 2
59 seconds later Player 3 casts "Lightning Bolt",
Player 3 is now 'casting unit' and will lose mana
Player 3: WTFOMGHAX!?!?!??!!!
Player 3 has left the game

Plus, since the variables are already set, there's no need to re-set them anyway (globals don't reset after a function call, even when using them cross function)

2)

Make sure no other triggers use 'TW_StaticIntel...' variables. I'm guessing you already did that though as they have 'StaticIntel' in their names :D

Also, make sure this spell can only be active ONCE for ALL PLAYERS AT ANY TIME. In other words, give it to only one unit, give it a 61 second cooldown, and make it so only one of that type of unit can exist for only one player at any given time.

3)

You need another variable (TW_StaticIntelAmount, integer) to store the amount you're changing intelligence by. The way it works now, it will calculate a different value when it fixes the mana situation.

more example:
Code:
P1 and P2 both have 50 mana
P1 steals 50% mana from P2
P1 now has 75 mana, and P2 now has 25 mana (yay!)
give back (and recalculate...)
50% of P2's mana (25) is about 12
P1 loses 12 mana, P2 gains 12 mana
P1 has 63 mana, P2 has 37 mana (whoops!)

So to fix this, just set the 'Amount' variable according to the targets mana, and use it again in the "over" function (without resetting it!)

4)

Not sure if this is relevant right now, but make sure you aren't basing this ability on an ability that any other abilities are based on. If you really really really want to, use the 'Channel' ability (hit [ctrl] + f and search for "Channel" twice (skip posession)) and set its "Order ID" to something really obscure and stupid looking (and not something any other ability is using).



Post back if this works, and props on an awesome ability idea :D
 
Status
Not open for further replies.
Top