Moving a Unit as a Missile

kelogsloops

You can change this now in User CP.
Reaction score
45
Okay so i made a spell that makes a missile(dummy) and moves the misisle blablabllba. the missile works and all, but after a while i realised that the missile no longer moves, it just sits beneath my hero. Heres my triggering.

Trigger:
  • Windy Arrow
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Windy Arrow
    • Actions
      • Set Caster = (Casting unit)
      • Set Temp_Point = (Position of Caster)
      • Set Target_Loc = (Target point of ability being cast)
      • Set Angle = (Angle from (Position of Caster) to Target_Loc)
      • Unit - Create 1 Windy Arrow for (Owner of Caster) at Temp_Point facing Angle degrees
      • Set MovingGroup[1] = (Last created unit)
      • Unit - Add a (1400.00 / 1550.00) second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation(udg_Temp_Point)
      • Custom script: call RemoveLocation(udg_Target_Loc)


Trigger:
  • Windy Arrow Move
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Unit - Move MovingGroup[1] instantly to ((Position of MovingGroup[1]) offset by 36.00 towards (Facing of MovingGroup[1]) degrees), facing (Facing of MovingGroup[1]) degrees
      • Unit Group - Pick every unit in (Units within 150.00 of (Position of MovingGroup[1]) matching (((Matching unit) belongs to an enemy of (Owner of MovingGroup[1])) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 DUMMEE for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
          • Unit - Add Windy Arrow Slow to (Last created unit)
          • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Destructible - Pick every destructible within 150.00 of (Position of MovingGroup[1]) and do (Actions)
        • Loop - Actions
          • Destructible - Kill (Picked destructible)
 
It's because it isn't MUI. Every time you use this ability while another missile is already flying in air, the old values will be replaced by the new one. Thus, your mid-air missiles will stop.

As for the periodic trigger, 0.03 seconds is quite enough to form a smooth sliding effect. 0.04 seconds will be fine too.

Your trigger leaks, a lot. You might want to find a tutorial for MUI and Leaks in this forum.
 
Your trigger leaks... ALOT.
And as Ryushi said, it's not MUI and not multiplayer-safe, and so everytime someone cast the ability, the variables change and only the last set one will acctually move. And as i said, It leaks just a lot. Everytime 0.02 seconds it leaks in 2 at least points.
To make this ability MUI, your gonna need Hashtables, as skyblader said. I'd suggest you to learn hastables, it's very helpful. Search in this forum, you'll find a few tutorials.
 
okay, so, once i learn hashtables, am i going to have to go ALL over my spell codes.... LOL or does it only apply to spells that require 'second' triggers that rely on the first trigger? like this one
 
When you learn hashtables, you'll probably recerate the spell. And clearing leak tutorials can also be found in this forum.

Off-topic:
Coming to think of it... Ryushi and Gelnphir both have male anime characters...
 
okay, so, once i learn hashtables, am i going to have to go ALL over my spell codes.... LOL or does it only apply to spells that require 'second' triggers that rely on the first trigger? like this one

If it's an instant spell, basically you don't need to use hashtable of any sort. However, periodic triggers such as sliding movement requires hashtable.

Off-topic:
Coming to think of it... Ryushi and Gelnphir both have male anime characters...

My avatar is a female o.o
 
To me it looks like you add an expiration timer to your dummy which is less than a second (1400 / 1550 is close to 1 second, unless it's supposed to move really quickly). Other than that it should function normally.

EDIT: Just realized this is probably mimicing "Powershot". Well, try using just "Move unit instantly" instead of "Move unit instantly and face angle", because it'll retain its facing angle when you move it instantly. Also, it "MovingGroup" a Unit-type variable or Unit Group-type variable?
 
Okay, I'll tell you how. In the first trigger, save the angle in the hashtable to key last created unit, and save the time left of the arrow unit to key last created unit, add the last created unit into another unit group. (A unit group that is not set/cleared, just add and remove units.)

In the second trigger, first action should be pick all units in the unit group you added the arrow in. Then you set angle = load bla bla bla of key picked unit. Set the time left too. Then move the picked unit in the angle offset by 36. Set time left of unit = time left of unit - 0.02. Then save that value to key picked unit.

Make a condition apart from your other condition,

If time left = 0.00

Then remove picked unit from the unit group
clear child hashtable of picked unit

And also add these 2 actions into your condition, the one below

Trigger:
  • Unit Group - Pick every unit in (Units within 150.00 of (Position of MovingGroup[1]) matching (((Matching unit) belongs to an enemy of (Owner of MovingGroup[1])) Equal to True)) and do (Actions)
    • Loop - Actions
      • Unit - Create 1 DUMMEE for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Unit - Add Windy Arrow Slow to (Last created unit)
      • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
 
save the angle in the hashtable to key last created unit

um, how do you save a unit type(last created unit) as real variable (angle). although sounds a bit dumb :/
 
Trigger:
  • Hashtable - Save 0.00 as 1 of (Key (Last created unit)) in (Last created hashtable)
 
okay i think i'm going to look even MORE stupid but, when i go to Hashtable - Save Real, for the third 'argument', what function is it meant to be under? because the Hashtable - Get Handle ID or Get String ID doesn't give Event Response (last created unit) options...
 
Okay when you select "Hashtable - Save Real", you get this right?
Trigger:
  • Hashtable - Save value as value of value in (Last created hashtable)


So you got your first 2 values...

Trigger:
  • Hashtable - Save 0.00 as 0 of value in (Last created hashtable)


Now the third one is actually "Hashtable - Get Handle ID"
And the statement would be "Key Handle"

Click on the "Handle" and select the last created unit.
 
okay i did as you said.

THANK YOU VERY MUCH! i'm going to try make another spell based on hashtables :D!!
NVM I FIXED IT :D
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    It is weird seeing a way more realistic users online number
  • The Helper The Helper:
    Happy Tuesday Night!
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top