• 🏆 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!

Blink strike style spell problem

Status
Not open for further replies.
Level 3
Joined
Oct 6, 2007
Messages
43
So, I did a spell kind of blink strike that the hero jumps to target unit, then damages it by 150 spell type attack damage type normal and blinks to position where he casted it, but only problem is that the hero doesn't damage the target unit when it should. Heres a screenshot of the trigger:
 

Attachments

  • Triggerpicture.JPG
    Triggerpicture.JPG
    39 KB · Views: 168

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
the hero doesn't damage the target unit when it should
Then, when does he damage the target?

Additionally, that trigger leaks a lot. You leaked 2 effects, and 2 locations, I believe.
You have to create an array variable with value 2 and type Special Effect. Also create another point variable.

[TRIGGER=Do this]
Actions
Set Timestrikecastpos = (Position of (Casting Unit))
Set YourPointTypeVariable = (Position of (Target unit of ability being cast))
Special Effect - Create a special effect at (Position of (Target Unit of ability being cast)) using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
Set YourSpecialEffectVariable[1] = (Last Created Special Effect)
Unit - Move (Casting Unit) instantly to (Position of YourLocationVariable)
Unit - Cause (Casting Unit) to damage (Target unit of ability being cast), dealing 150.00 damage of attack type Spells and damage type Normal
Wait 1.00 seconds
Move (Casting Unit) instantly to Timestrikecastpos
Special Effect - Create a special effect at Timestrikecastpos using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
Set YourSpecialEffectVariable[2] = (Last Created Special Effect)
Custom script: call RemoveLocation(udg_Timestrikecastpos)
Custom script: call RemoveLocation(udg_YourPointTypeVariable)
Special Effect - Destroy YourSpecialEffectVariable[1]
Special Effect - Destroy Your SpecialEffectVariable[2]
[/TRIGGER]
 
Last edited:

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
Actually it worked well, expect it didn't cause any damage (Expect the normal hit the unit did in the second of "wait" time)
I didn't say it wasn't working well, but it was leaking. If you create those special effects and you don't delete them, they will still be there, taking memory.
Same for the locations. When you refer to "Position of Target unit of Ability being Cast", the system will create a handle to refer to that specific point, and then proceed with the action. By doing so, the system does NOT eliminate the created handle. This means that the handle is still in game and taking up memory, which causes your game to be slower and laggy.
I must apologize, by the way, the variable type is Point and not Location.

Eh, whats the difference if i put it in a variable ^^
None. I don't really see where the problem is. You are using attack type Spells, perhaps you are using the ability on a Magic Immune unit. If that's so, it's pretty normal that it doesn't deal any damage.
 
Level 3
Joined
Oct 6, 2007
Messages
43
Okay, thanks for your help. I try if it fixes the damage problem.

Well, it worked, but still the damage didn't! Also the dummy spell doesn't go to cooldown, if i change event to unit FINISHES casting an ability it doesnt even blink to the target, just does the effects :S


Edit: oups double post
 
Last edited by a moderator:
Level 3
Joined
Oct 6, 2007
Messages
43
@Pitakebab
Nope, didn't work

EDIT: Wohoo! I got it to work by putting the damage before the move on the enemy unit.
 
Last edited:
Level 19
Joined
Aug 24, 2007
Messages
2,888
JASS:
function bstrike takes unit attacker, unit target returns nothing
local effect blink1
local effect blink2
local location enemypos = GetUnitLoc(target)
local location attackerpos = GetUnitLoc(attacker)
set blink1 = AddSpecialEffectLoc("Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl",attackerpos)
call TriggerSleepAction(1)
call SetUnitPosition(attacker,GetLocationX(target),GetLocationY(target))
set blink2 = AddSpecialEffectLoc("Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl",attackerpos)
call UnitDamageTargetBJ( attacker, target, 150.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC )
call IssueTargetOrder(attacker,"attack",target)
call DestroyEffect(blink1)
call DestroyEffect(blink2)
call RemoveLocation(attackerpos)
call RemoveLocation(enemypos)
endfunction

Just copy this to your map header in trigger editor (<mapname>.mdx)

Remove every action in your trigger and add
  • Custom Script: call bstrike(GetTriggerUnit(),GetSpellTargetUnit())
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
ops anyway learn jass :D its much easier
BTW you dont need anyglobals or etc with this way
Leaks are removed blabla
 
Last edited:
Status
Not open for further replies.
Top