• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Caster Variable With Arrays.

Status
Not open for further replies.
Level 2
Joined
May 2, 2005
Messages
20
Okay, I'm making tons of triggered spells for my map. Many of these triggers use the "Unit - Damage Target/Area, and other special effects and such. Here's one of the triggers:

Ability Shield Bash
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Shield Bash
Actions
Set TempPlayerNumber = (Player number of (Owner of (Casting unit)))
Set TempCaster[TempPlayerNumber] = (Casting unit)
Set TempSpellPoint2 = (Position of (Target unit of ability being cast))
Set TempSpellPoint = (TempSpellPoint2 offset by 150.00 towards (Facing of (Casting unit)) degrees)
Set Spell_Damage = ((Random integer number between 10 and 20) x (((Strength of (Casting unit) (Include bonuses)) / 100) + 1))
Animation - Change TempCaster[TempPlayerNumber]'s animation speed to 200.00% of its original speed
Unit - Cause TempCaster[TempPlayerNumber] to damage (Target unit of ability being cast), dealing (Real(Spell_Damage)) damage of attack type Normal and damage type Normal
Unit - Move (Target unit of ability being cast) instantly to TempSpellPoint
Floating Text - Create floating text that reads (String(Spell_Damage)) above (Target unit of ability being cast) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.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 64.00 towards 90.00 degrees
Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
Animation - Change TempCaster[TempPlayerNumber]'s animation speed to 100.00% of its original speed
Custom script: call RemoveLocation( udg_TempSpellPoint )
Custom script: call RemoveLocation( udg_TempSpellPoint2 )

Basically, I want to know if I should make all the variables in these triggers have arrays that correspond to the player number of the casting unit. I'm not sure, but I think that if two heroes use these abilities some confusion might happen and spells not work the right way.

Thanks in advance. :D
 
Level 11
Joined
Jul 20, 2004
Messages
2,760
I don't think you need that TempPlayerNumber variable. "A unit Starts the effect of an ability" event makes the caster (Triggering Unit), and so, it isn't affected by waits (value removed after a single wait). If you use it, THEN it will cause confusions. Instead, just refer to the player as (Owner of (Triggering Unit)). And yes, basically you have to make all of them arrays.

Oh, and again, TempCaster is not necessary, because you can refer to it as (Triggering Unit) at any moment in the trigger.

~Daelin
 
Status
Not open for further replies.
Top