| 05-30-2004, 09:21 PM | #1 |
I'm making a spell called Tele-Evasion, which causes the hero who has it to have a % chance to "blink" away from their attacker. I've created a simulation of Blink within the trigger to do this. The group array is for 3 different levels of it which will merely have different chances of working and different distances. Code:
televasion01
Events
Unit - A unit Is attacked
Conditions
Or - Any (Conditions) are true
Conditions
((Attacked unit) is in TelevasionGroup[1]) Equal to True
((Attacked unit) is in TelevasionGroup[2]) Equal to True
((Attacked unit) is in TelevasionGroup[3]) Equal to True
Actions
Custom script: local integer udg_telechance
Custom script: local integer udg_teledist
Custom script: local effect udg_telefx1
Custom script: local effect udg_telefx2
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Attacked unit) is in TelevasionGroup[1]) Equal to True
Then - Actions
Set telechance = (Random integer number between 1 and 20)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
telechance Less than 4
Then - Actions
Set teledist = (Random integer number between 100 and 250)
Special Effect - Create a special effect at (Position of (Attacked unit)) using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
Set telefx1 = (Last created special effect)
Unit - Move (Attacked unit) instantly to ((Position of (Attacked unit)) offset by (Real(teledist)) towards ((Facing of (Attacking unit)) + (Random real number between -30.00 and 30.00)) degrees)
Special Effect - Create a special effect at (Position of (Attacked unit)) using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
Set telefx2 = (Last created special effect)
Else - Actions
Do nothing
Else - Actions...The two bugs: 1) This happens every time the hero bearing the ability is attacked. 2) The hero teleports a huge distance across the map; far, far more than 250. What's wrong? Any help is appreciated. |
| 05-30-2004, 11:01 PM | #2 |
Is this a custom script? "Set teledist = (Random integer number between 100 and 250)" It's usually easier to use local variables in an all Jass trigger. |
| 05-31-2004, 07:25 PM | #3 |
The only custom script involved is the declaration of the variables as local, so the spell can be multi-instanced. EDIT: Hmm, that's odd. It seems to function normally when teledist and telechance are not local. Now, my problem is this: How can I make this spell multi-instance-able without use of local variables? |
| 06-01-2004, 07:39 PM | #4 |
Save it in arrays, it's going to be one bigger bother, so I suggest you learn JASS instead. :) |
