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)
 

Ayanami

칼리
Reaction score
288
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.
 

TomTTT

New Member
Reaction score
44
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.
 

kelogsloops

You can change this now in User CP.
Reaction score
45
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
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
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...
 

Ayanami

칼리
Reaction score
288
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
 

Cheddar

This is the way it was meant to be.
Reaction score
126
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?
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
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)
 

kelogsloops

You can change this now in User CP.
Reaction score
45
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 :/
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Trigger:
  • Hashtable - Save 0.00 as 1 of (Key (Last created unit)) in (Last created hashtable)
 

kelogsloops

You can change this now in User CP.
Reaction score
45
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...
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
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.
 

kelogsloops

You can change this now in User CP.
Reaction score
45
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 Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top