• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Instant Trassmision Spell

Status
Not open for further replies.
Level 4
Joined
Aug 5, 2011
Messages
94
i want to be like instant trasmission like goku uses !
instant trasmission is : an ability that hero uses to teleport directly to pointed target ! I want it only work on ally and enemy heroes (only heroes not units or buildings )!
I want the user to target an ally or opponent and then teleports the user to the pointed target !

20 mana consumption
35 second cooldown

can be used by many heroes at once so i want it to be at MUI !
 
Level 37
Joined
Mar 6, 2006
Messages
9,243

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set TeleHT = (Last created hashtable)
  • Teleport
    • Events
      • Unit - A unit Starts the effect of an ability
      • Unit - A unit Finishes casting an ability
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Teleport
    • Actions
      • Custom script: set udg_i1 = GetHandleId(GetTriggerUnit())
      • Custom script: if GetTriggerEventId() == EVENT_PLAYER_UNIT_SPELL_EFFECT then
      • Set p1 = (Position of (Target unit of ability being cast))
      • Hashtable - Save Handle Ofp1 as 0 of i1 in TeleHT
      • Custom script: elseif GetTriggerEventId() == EVENT_PLAYER_UNIT_SPELL_FINISH then
      • Unit - Move (Triggering unit) instantly to (Load 0 of i1 in TeleHT)
      • Set p1 = (Position of (Triggering unit))
      • Special Effect - Create a special effect at p1 using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_p1)
      • Custom script: else
      • Set p1 = (Load 0 of i1 in TeleHT)
      • Custom script: call RemoveLocation(udg_p1)
      • Hashtable - Clear all child hashtables of child i1 in TeleHT
      • Custom script: endif
 

Attachments

  • Teleport.w3x
    13.9 KB · Views: 45
Level 33
Joined
Mar 27, 2008
Messages
8,035
The script that Maker made for you does too much work for such a simple mechanics which reduces its efficiency.

Since he doesn't mentioned anything about channeling, why not just go with this ?
  • Melee Initialization
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Teleport
    • Actions
      • Set TempLoc = (Position of (Target unit of ability being cast))
      • Unit - Move (Triggering unit) instantly to TempLoc
      • Custom script: call RemoveLocation(udg_TempLoc)
This does much less work and more efficient, doesn't require any data to be handled.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You can always use SetUnitX/Y to counter the cooldown issues.
  • Actions
    • Custom script: local unit caster = GetTriggerUnit()
    • Custom script: local unit target = GetSpellTargetUnit()
    • Custom script: call SetUnitX(caster, GetUnitX(target) + 100)
    • Custom script: call SetUnitY(caster, GetUnitY(target) + 100)
    • Custom script: set caster = null
    • Custom script: set target = null
I made it like I did because it is cooler
Your argument on "efficiency" is invalid.

Just like the sorting elements from array, my method was cooler (doesn't disturb current order of elements in array) than simple replacing elements in array, but it's less efficient we have to deal with it and take it as positive.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
You can always use SetUnitX/Y to counter the cooldown issues.

And ignore pathing? I'm thinking no :)


Your argument on "efficiency" is invalid.

Not really, my trigger is pretty efficient and factors in small channeling time. If one doesn't want to channel then perform it in a different method. This was not about efficiency, but different mechanics of the spell. Your way skips the channeling time, so it is totally different.

Just like the sorting elements from array, my method was cooler (doesn't disturb current order of elements in array) than simple replacing elements in array, but it's less efficient we have to deal with it and take it as positive.

There was no need to keep the order, only to randomize the starting locations. And that is where the question on efficiency pops up.
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,243
Can you read the full trigger of the SetUnitX/Y ?
Oh by that, I mean at the behind of the function, there is something.. a real value.. yes a real value.

Yes I can read it. I can also understand it, can you? Using 100 can make the unit go through pathing blockers. Use smaller value you say? And get on top of another unit? Looks really professional :)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Hmmm okay about the pathing, I agree SetUnitX/Y can cause the unit to go upcliffs and make the unit stuck.

But why such matter to create a hashtable and such just for that simple matter ?
Save/Load Hashtable function is heavy compared to this;

This is much better;
  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Teleport
    • Actions
      • Countdown Timer - Start Timer as a One-shot timer that will expire in 0.00 seconds
      • Set Timer = (Last started timer)
      • Set Caster = (Triggering unit)
      • Set Target = (Target unit of ability being cast)
  • Timer
    • Events
      • Time - Timer expires
    • Conditions
    • Actions
      • Set TempLoc = (Position of Target)
      • Unit - Move Caster instantly to TempLoc
      • Custom script: call RemoveLocation(udg_TempLoc)
Requiring 2 trigger does not mean it is less efficient than just using 1 trigger - with full of save/load function from a hashtable - definitely slow compared to this.
 
Level 18
Joined
Oct 17, 2012
Messages
849
show me what i have to remove because i dont understant

Look at the trigger Teleport and remove the third Custom script in the actions:

  • Teleport
    • Events
      • Unit - A unit Starts the effect of an ability
      • Unit - A unit Finishes casting an ability
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Teleport
    • Actions
      • Custom script: set udg_i1 = GetHandleId(GetTriggerUnit())
      • Custom script: if GetTriggerEventId() == EVENT_PLAYER_UNIT_SPELL_EFFECT then
      • Set p1 = (Position of (Target unit of ability being cast))
      • Hashtable - Save Handle Ofp1 as 0 of i1 in TeleHT
      • Custom script: elseif GetTriggerEventId() == EVENT_PLAYER_UNIT_SPELL_FINISH then (REMOVE THIS LINE)
      • Unit - Move (Triggering unit) instantly to (Load 0 of i1 in TeleHT)
      • Set p1 = (Position of (Triggering unit))
      • Special Effect - Create a special effect at p1 using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_p1)
      • Custom script: else
      • Set p1 = (Load 0 of i1 in TeleHT)
      • Custom script: call RemoveLocation(udg_p1)
      • Hashtable - Clear all child hashtables of child i1 in TeleHT
      • Custom script: endif
Also, once you remove that line, you can remove the events A unit stops Finishes casting an ability and A unit Stops casting an ability.
 
Status
Not open for further replies.
Top