• 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.

Leak problem and not MUI spell...

Status
Not open for further replies.
Level 14
Joined
Aug 8, 2010
Messages
1,022
Hello! I want to ask ya a question... I am creating a spell, called Spinning Blade. What it does? - Your hero hurls a blade that will never stop and will cut everything in its path, dealing 50 dmg on first level. But there are two problems:
1st - when i clear my leak (in the 'Move Trigger'), the blade is spawned at the center of the map and doesn't move, but when i don't clear it and i leave it alone, everything works well.
2nd - when i hurl a second blade, the first one stops and instead - the second one begins to move. (hashtables make the spells MUI, right?)

  • Cast Trigg
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Spinning Blade
    • Actions
      • Hashtable - Save Handle Of(Casting unit) as 1 of 1 in SBHash
      • Hashtable - Save Handle Of(Target point of ability being cast) as 2 of 1 in SBHash
      • Hashtable - Save Handle Of(Position of (Load 1 of 1 in SBHash)) as 2 of 2 in SBHash
      • Hashtable - Save (Angle from (Load 2 of 2 in SBHash) to (Load 2 of 1 in SBHash)) as 3 of 1 in SBHash
      • Unit - Create 1 Spinning Blade for (Triggering player) at ((Load 2 of 2 in SBHash) offset by 70.00 towards (Load 3 of 1 from SBHash) degrees) facing Default building facing degrees
      • Hashtable - Save Handle Of(Last created unit) as 1 of 2 in SBHash
      • Hashtable - Save Handle Of(Position of (Load 1 of 2 in SBHash)) as 2 of 3 in SBHash
      • Set SBPoint = (Load 2 of 3 in SBHash)
      • Trigger - Turn on Move Trigger <gen>
  • Move Trigger
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Set SBPoint = (SBPoint offset by 13.00 towards (Load 3 of 1 from SBHash) degrees)
      • Unit - Move (Load 1 of 2 in SBHash) instantly to SBPoint
      • Custom script: call RemoveLocation (udg_SBPoint)
And one more thing - is there a solution without dynamic indexing systems, but just with hashtables? (i can't use dynamic indexing systems... i don't understand them) But if there is a solution with them - give it to me! ;)

Thank you very much! :)
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Use the handle id of the projectile:
  • Custom script: set udg_ID = GetHandleId(bj_lastCreatedUnit)
ID is an integer variable.

Then save stuff for it:
  • Hashtable - Save Handle Of(Casting unit) as 1 of ID in SBHash
Add the projectile into a unit group:
  • Unit group - Add last created unit to Projectile Group
In the looping trigger, pick all units in Projectile Group and
  • Custom script: set udg_ID = GetHandleId(GetEnumUnit())
Then load stored stuff with the ID.

You don't need to store any locations. In the looping trigger, set point = position of picked unit, point2 = point offset by 13 towards x. Move unit to point2.
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
@Maker -> I really want to learn how to create MUI spells. I think it is easier to do that with dynamic indexing, rather with hashtables, so i am learning dynamic indexing now. But again, i have exactly the same problems, and i don't know why... that array has to make the spell MUI, right? :?

  • Cast Trigg
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Spinning Blade
    • Actions
      • Set SBCaster = (Triggering unit)
      • Set ID = (Custom value of SBCaster)
      • Set SBPoint[ID] = (Target point of ability being cast)
      • Set SBCasterPos[ID] = (Position of SBCaster)
      • Set SBAngle[ID] = (Angle from SBCasterPos[ID] to SBPoint[ID])
      • Unit - Create 1 Spinning Blade for (Owner of SBCaster) at (SBCasterPos[ID] offset by 70.00 towards SBAngle[ID] degrees) facing Default building facing degrees
      • Set SBBlade[ID] = (Last created unit)
      • Set SBBladePos[ID] = (Position of SBBlade[ID])
      • Unit Group - Add SBBlade[ID] to SBUnitGroup
      • Trigger - Turn on Move Trigger Copy <gen>
  • Move Trigger
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Set SBBladePos[ID] = (SBBladePos[ID] offset by 13.00 towards SBAngle[ID] degrees)
      • Unit Group - Pick every unit in SBUnitGroup and do (Actions)
        • Loop - Actions
          • Unit - Move SBBlade[ID] instantly to SBBladePos[ID]
I will REALLY appreciate your help! (and anyone else's help) :)

*i wanted this to be a private message, but you don't have space :D*
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
If you're using custom value, the you should use unit indexer by Bribe.

Set SBBladePos[ID] = (SBBladePos[ID] offset by 13.00 towards SBAngle[ID] degrees)
->
Set Pos = (SBBladePos[ID] offset by 13.00 towards SBAngle[ID] degrees)

pick all unit in group
->set id = custom value
->set pos = Bladepos[ID] offset by ...
->move unit to pos
->remove pos
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
I think i am getting how dynamic indexing works, but i still have problems. This time when i clear the leak, the blades don't spawn at the center of the map, but they don't move either... I will upload the map, so you can adjust the triggers how they need to be and i can see easily where is my mistake. :)

Thank you very much for the time spend!
 
Last edited:
Status
Not open for further replies.
Top