Monday, April 16, 2012

Question about detecting collisions

Hi. I'm new to this site, and average at mapping. I am currently working on my first custom skill using triggers - a version of Rasengan from Naruto. The skill makes Naruto dash forward in a straight line - if it misses, the skill is worthless. But if the enemy stays still, and it hits, then it does massive damage. I have most of the code, but for some reason I can't seem to find a way to make it detect Naruto colliding with the target, and it always misses.


Code:
Events
Unit - A unit Starts the effect of an ability

Conditions
(Ability being cast) Equal to Rasengan

Actions
-------- First we set all the variables for actually running the dash... --------
Set rsCaster = (Casting unit)
Set rsTarget = (Target unit of ability being cast)
Set rsTempPt = (Position of rsCaster)
Set rsTargetTempPt = (Position of rsTarget)
Set rsDistance = (Distance between rsTargetTempPt and rsTempPt)
Set rsDistance = (rsDistance + 100.00)
Set rsAngle = (Angle from (Position of rsCaster) to (Position of rsTarget))
Set rsIncrement = 30.00
-------- Then, after removing the point, we start the special flashy effects --------
Unit - Pause rsCaster
Unit - Create 1 Naruto Shadow Clone (dummy) for (Owner of rsCaster) at (rsTempPt offset by 50.00 towards (rsAngle + 90.00) degrees) facing (rsAngle - 90.00) degrees
Special Effect - Create a special effect at (Position of (Last created unit)) using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
Special Effect - Destroy (Last created special effect)
Unit - Pause (Last created unit)
Wait 1.00 seconds
Special Effect - Create a special effect at rsTempPt using Abilities\Spells\Items\AIvi\AIviTarget.mdl
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect attached to the hand of rsCaster using Abilities\Spells\Undead\FreezingBreath\FreezingBreathMissile.mdl
Set rsSpecialEffect = (Last created special effect)
Wait 0.50 seconds
Special Effect - Create a special effect at (Position of (Last created unit)) using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
Unit - Remove (Last created unit) from the game
Special Effect - Destroy (Last created special effect)
Trigger - Turn on Rasengan Dash <gen>

That's my first trigger...

And rasengan dash is....


Code:
Events
Time - Every 0.06 seconds of game time
Actions
Set rsDistance = (rsDistance - rsIncrement)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
r**** Equal to True
Then - Actions
Game - Display to (All players) the text: Rasengan hit!
Special Effect - Destroy rsSpecialEffect
Unit - Unpause rsCaster
Special Effect - Create a special effect at rsTempPt using Abilities\Spells\Human\FlameStrike\FlameStrike1.mdl
Special Effect - Destroy (Last created special effect)
Unit - Cause rsCaster to damage rsTarget, dealing 3000.00 damage of attack type Chaos and damage type Enhanced
Custom script: call RemoveLocation ( udg_rsTargetTempPt )
Trigger - Turn off (This trigger)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
rsDistance Greater than or equal to 0.00
Then - Actions
Set rsTempPt = ((Position of rsCaster) offset by rsIncrement towards rsAngle degrees)
Unit - Move rsCaster instantly to rsTempPt
Custom script: call RemoveLocation ( udg_rsTempPt )
Else - Actions
Game - Display to (All players) the text: Rasengan missed!
Special Effect - Destroy rsSpecialEffect
Unit - Unpause rsCaster
Custom script: call RemoveLocation ( udg_rsTargetTempPt )
Trigger - Turn off (This trigger)

It has no conditions, of course.

Any help would be appreciated! Thanks in advance!|||Wait, nevermind! I just figured it out.

No comments:

Post a Comment