Movement System Help !

Ryuu

I am back with Chocolate (:
Reaction score
64
Code:
Movement System
    Events
        Time - Every 0.01 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 1 to 12, do (Actions)
            Loop - Actions
                For each (Integer B) from 1 to GLOBAL_NumberOfHeroes, do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                GLOBAL_HeroType[(Integer B)] Equal to (Unit-type of GLOBAL_Hero[(Integer A)])
                            Then - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        MSystem_UpCheck[(Integer A)] Equal to True
                                        MSystem_DownCheck[(Integer A)] Equal to False
                                        MSystem_LeftCheck[(Integer A)] Equal to False
                                        MSystem_RightCheck[(Integer A)] Equal to False
                                    Then - Actions
                                        Set MSystem_UnitLoc = (Position of GLOBAL_Hero[(Integer A)])
                                        Set MSystem_DestinationLoc = (MSystem_UnitLoc offset by MSystem_HeroSpeed[(Integer B)] towards 90.00 degrees)
                                        Animation - Play GLOBAL_Hero[(Integer A)]'s GLOBAL_HerosMoveAnim[(Integer B)] animation
                                        Unit - Order GLOBAL_Hero[(Integer A)] to Move To MSystem_DestinationLoc
                                        Custom script:   call RemoveLocation(udg_MSystem_UnitLoc)
                                        Custom script:   call RemoveLocation(udg_MSystem_DestinationLoc)
                                    Else - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        MSystem_UpCheck[(Integer A)] Equal to False
                                        MSystem_DownCheck[(Integer A)] Equal to True
                                        MSystem_LeftCheck[(Integer A)] Equal to False
                                        MSystem_RightCheck[(Integer A)] Equal to False
                                    Then - Actions
                                        Set MSystem_UnitLoc = (Position of GLOBAL_Hero[(Integer A)])
                                        Set MSystem_DestinationLoc = (MSystem_UnitLoc offset by MSystem_HeroSpeed[(Integer B)] towards 270.00 degrees)
                                        Animation - Play GLOBAL_Hero[(Integer A)]'s GLOBAL_HerosMoveAnim[(Integer B)] animation
                                        Unit - Order GLOBAL_Hero[(Integer A)] to Move To MSystem_DestinationLoc
                                        Custom script:   call RemoveLocation(udg_MSystem_UnitLoc)
                                        Custom script:   call RemoveLocation(udg_MSystem_DestinationLoc)
                                    Else - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        MSystem_UpCheck[(Integer A)] Equal to False
                                        MSystem_DownCheck[(Integer A)] Equal to False
                                        MSystem_LeftCheck[(Integer A)] Equal to True
                                        MSystem_RightCheck[(Integer A)] Equal to False
                                    Then - Actions
                                        Set MSystem_UnitLoc = (Position of GLOBAL_Hero[(Integer A)])
                                        Set MSystem_DestinationLoc = (MSystem_UnitLoc offset by MSystem_HeroSpeed[(Integer B)] towards 180.00 degrees)
                                        Animation - Play GLOBAL_Hero[(Integer A)]'s GLOBAL_HerosMoveAnim[(Integer B)] animation
                                        Unit - Order GLOBAL_Hero[(Integer A)] to Move To MSystem_DestinationLoc
                                        Custom script:   call RemoveLocation(udg_MSystem_UnitLoc)
                                        Custom script:   call RemoveLocation(udg_MSystem_DestinationLoc)
                                    Else - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        MSystem_UpCheck[(Integer A)] Equal to False
                                        MSystem_DownCheck[(Integer A)] Equal to False
                                        MSystem_LeftCheck[(Integer A)] Equal to False
                                        MSystem_RightCheck[(Integer A)] Equal to True
                                    Then - Actions
                                        Set MSystem_UnitLoc = (Position of GLOBAL_Hero[(Integer A)])
                                        Set MSystem_DestinationLoc = (MSystem_UnitLoc offset by MSystem_HeroSpeed[(Integer B)] towards 360.00 degrees)
                                        Animation - Play GLOBAL_Hero[(Integer A)]'s GLOBAL_HerosMoveAnim[(Integer B)] animation
                                        Unit - Order GLOBAL_Hero[(Integer A)] to Move To MSystem_DestinationLoc
                                        Custom script:   call RemoveLocation(udg_MSystem_UnitLoc)
                                        Custom script:   call RemoveLocation(udg_MSystem_DestinationLoc)
                                    Else - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        MSystem_UpCheck[(Integer A)] Equal to True
                                        MSystem_DownCheck[(Integer A)] Equal to False
                                        MSystem_LeftCheck[(Integer A)] Equal to True
                                        MSystem_RightCheck[(Integer A)] Equal to False
                                    Then - Actions
                                        Set MSystem_UnitLoc = (Position of GLOBAL_Hero[(Integer A)])
                                        Set MSystem_DestinationLoc = (MSystem_UnitLoc offset by MSystem_HeroSpeed[(Integer B)] towards 135.00 degrees)
                                        Unit - Make GLOBAL_Hero[(Player number of (Triggering player))] face 135.00 over 0.00 seconds
                                        Animation - Play GLOBAL_Hero[(Integer A)]'s GLOBAL_HerosMoveAnim[(Integer B)] animation
                                        Unit - Order GLOBAL_Hero[(Integer A)] to Move To MSystem_DestinationLoc
                                        Custom script:   call RemoveLocation(udg_MSystem_UnitLoc)
                                        Custom script:   call RemoveLocation(udg_MSystem_DestinationLoc)
                                    Else - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        MSystem_UpCheck[(Integer A)] Equal to True
                                        MSystem_DownCheck[(Integer A)] Equal to True
                                        MSystem_LeftCheck[(Integer A)] Equal to False
                                        MSystem_RightCheck[(Integer A)] Equal to True
                                    Then - Actions
                                        Set MSystem_UnitLoc = (Position of GLOBAL_Hero[(Integer A)])
                                        Set MSystem_DestinationLoc = (MSystem_UnitLoc offset by MSystem_HeroSpeed[(Integer B)] towards 45.00 degrees)
                                        Unit - Make GLOBAL_Hero[(Player number of (Triggering player))] face 45.00 over 0.00 seconds
                                        Animation - Play GLOBAL_Hero[(Integer A)]'s GLOBAL_HerosMoveAnim[(Integer B)] animation
                                        Unit - Order GLOBAL_Hero[(Integer A)] to Move To MSystem_DestinationLoc
                                        Custom script:   call RemoveLocation(udg_MSystem_UnitLoc)
                                        Custom script:   call RemoveLocation(udg_MSystem_DestinationLoc)
                                    Else - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        MSystem_UpCheck[(Integer A)] Equal to False
                                        MSystem_DownCheck[(Integer A)] Equal to True
                                        MSystem_LeftCheck[(Integer A)] Equal to True
                                        MSystem_RightCheck[(Integer A)] Equal to False
                                    Then - Actions
                                        Set MSystem_UnitLoc = (Position of GLOBAL_Hero[(Integer A)])
                                        Set MSystem_DestinationLoc = (MSystem_UnitLoc offset by MSystem_HeroSpeed[(Integer B)] towards 225.00 degrees)
                                        Unit - Make GLOBAL_Hero[(Player number of (Triggering player))] face 225.00 over 0.00 seconds
                                        Animation - Play GLOBAL_Hero[(Integer A)]'s GLOBAL_HerosMoveAnim[(Integer B)] animation
                                        Unit - Order GLOBAL_Hero[(Integer A)] to Move To MSystem_DestinationLoc
                                        Custom script:   call RemoveLocation(udg_MSystem_UnitLoc)
                                        Custom script:   call RemoveLocation(udg_MSystem_DestinationLoc)
                                    Else - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        MSystem_UpCheck[(Integer A)] Equal to False
                                        MSystem_DownCheck[(Integer A)] Equal to True
                                        MSystem_LeftCheck[(Integer A)] Equal to False
                                        MSystem_RightCheck[(Integer A)] Equal to True
                                    Then - Actions
                                        Set MSystem_UnitLoc = (Position of GLOBAL_Hero[(Integer A)])
                                        Set MSystem_DestinationLoc = (MSystem_UnitLoc offset by MSystem_HeroSpeed[(Integer B)] towards 315.00 degrees)
                                        Unit - Make GLOBAL_Hero[(Player number of (Triggering player))] face 315.00 over 0.00 seconds
                                        Animation - Play GLOBAL_Hero[(Integer A)]'s GLOBAL_HerosMoveAnim[(Integer B)] animation
                                        Unit - Order GLOBAL_Hero[(Integer A)] to Move To MSystem_DestinationLoc
                                        Custom script:   call RemoveLocation(udg_MSystem_UnitLoc)
                                        Custom script:   call RemoveLocation(udg_MSystem_DestinationLoc)
                                    Else - Actions
                            Else - Actions

The thing is, if you tested this, the hero moves correctly, but he moves riggedly (is there such a word?). I don't really know how to explain this type of movement.

The second thing: is there a way to cast a spell while moving using this system?

Thanks alot !
+rep.
 

Psiblade94122

In need of sleep
Reaction score
138
Trigger:
  • Movement System
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • For each (Integer B) from 1 to GLOBAL_NumberOfHeroes, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GLOBAL_HeroType[(Integer B)] Equal to (Unit-type of GLOBAL_Hero[(Integer A)])
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • MSystem_UpCheck[(Integer A)] Equal to True
                      • MSystem_DownCheck[(Integer A)] Equal to False
                      • MSystem_LeftCheck[(Integer A)] Equal to False
                      • MSystem_RightCheck[(Integer A)] Equal to False
                    • Then - Actions
                      • Set MSystem_UnitLoc = (Position of GLOBAL_Hero[(Integer A)])
                      • Set MSystem_DestinationLoc = (MSystem_UnitLoc offset by MSystem_HeroSpeed[(Integer B)] towards 90.00 degrees)
                      • Animation - Play GLOBAL_Hero[(Integer A)]'s GLOBAL_HerosMoveAnim[(Integer B)] animation
                      • Unit - Order GLOBAL_Hero[(Integer A)] to Move To MSystem_DestinationLoc
                      • Custom script: call RemoveLocation(udg_MSystem_UnitLoc)
                      • Custom script: call RemoveLocation(udg_MSystem_DestinationLoc)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • MSystem_UpCheck[(Integer A)] Equal to False
                      • MSystem_DownCheck[(Integer A)] Equal to True
                      • MSystem_LeftCheck[(Integer A)] Equal to False
                      • MSystem_RightCheck[(Integer A)] Equal to False
                    • Then - Actions
                      • Set MSystem_UnitLoc = (Position of GLOBAL_Hero[(Integer A)])
                      • Set MSystem_DestinationLoc = (MSystem_UnitLoc offset by MSystem_HeroSpeed[(Integer B)] towards 270.00 degrees)
                      • Animation - Play GLOBAL_Hero[(Integer A)]'s GLOBAL_HerosMoveAnim[(Integer B)] animation
                      • Unit - Order GLOBAL_Hero[(Integer A)] to Move To MSystem_DestinationLoc
                      • Custom script: call RemoveLocation(udg_MSystem_UnitLoc)
                      • Custom script: call RemoveLocation(udg_MSystem_DestinationLoc)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • MSystem_UpCheck[(Integer A)] Equal to False
                      • MSystem_DownCheck[(Integer A)] Equal to False
                      • MSystem_LeftCheck[(Integer A)] Equal to True
                      • MSystem_RightCheck[(Integer A)] Equal to False
                    • Then - Actions
                      • Set MSystem_UnitLoc = (Position of GLOBAL_Hero[(Integer A)])
                      • Set MSystem_DestinationLoc = (MSystem_UnitLoc offset by MSystem_HeroSpeed[(Integer B)] towards 180.00 degrees)
                      • Animation - Play GLOBAL_Hero[(Integer A)]'s GLOBAL_HerosMoveAnim[(Integer B)] animation
                      • Unit - Order GLOBAL_Hero[(Integer A)] to Move To MSystem_DestinationLoc
                      • Custom script: call RemoveLocation(udg_MSystem_UnitLoc)
                      • Custom script: call RemoveLocation(udg_MSystem_DestinationLoc)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • MSystem_UpCheck[(Integer A)] Equal to False
                      • MSystem_DownCheck[(Integer A)] Equal to False
                      • MSystem_LeftCheck[(Integer A)] Equal to False
                      • MSystem_RightCheck[(Integer A)] Equal to True
                    • Then - Actions
                      • Set MSystem_UnitLoc = (Position of GLOBAL_Hero[(Integer A)])
                      • Set MSystem_DestinationLoc = (MSystem_UnitLoc offset by MSystem_HeroSpeed[(Integer B)] towards 360.00 degrees)
                      • Animation - Play GLOBAL_Hero[(Integer A)]'s GLOBAL_HerosMoveAnim[(Integer B)] animation
                      • Unit - Order GLOBAL_Hero[(Integer A)] to Move To MSystem_DestinationLoc
                      • Custom script: call RemoveLocation(udg_MSystem_UnitLoc)
                      • Custom script: call RemoveLocation(udg_MSystem_DestinationLoc)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • MSystem_UpCheck[(Integer A)] Equal to True
                      • MSystem_DownCheck[(Integer A)] Equal to False
                      • MSystem_LeftCheck[(Integer A)] Equal to True
                      • MSystem_RightCheck[(Integer A)] Equal to False
                    • Then - Actions
                      • Set MSystem_UnitLoc = (Position of GLOBAL_Hero[(Integer A)])
                      • Set MSystem_DestinationLoc = (MSystem_UnitLoc offset by MSystem_HeroSpeed[(Integer B)] towards 135.00 degrees)
                      • Unit - Make GLOBAL_Hero[(Player number of (Triggering player))] face 135.00 over 0.00 seconds
                      • Animation - Play GLOBAL_Hero[(Integer A)]'s GLOBAL_HerosMoveAnim[(Integer B)] animation
                      • Unit - Order GLOBAL_Hero[(Integer A)] to Move To MSystem_DestinationLoc
                      • Custom script: call RemoveLocation(udg_MSystem_UnitLoc)
                      • Custom script: call RemoveLocation(udg_MSystem_DestinationLoc)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • MSystem_UpCheck[(Integer A)] Equal to True
                      • MSystem_DownCheck[(Integer A)] Equal to True
                      • MSystem_LeftCheck[(Integer A)] Equal to False
                      • MSystem_RightCheck[(Integer A)] Equal to True
                    • Then - Actions
                      • Set MSystem_UnitLoc = (Position of GLOBAL_Hero[(Integer A)])
                      • Set MSystem_DestinationLoc = (MSystem_UnitLoc offset by MSystem_HeroSpeed[(Integer B)] towards 45.00 degrees)
                      • Unit - Make GLOBAL_Hero[(Player number of (Triggering player))] face 45.00 over 0.00 seconds
                      • Animation - Play GLOBAL_Hero[(Integer A)]'s GLOBAL_HerosMoveAnim[(Integer B)] animation
                      • Unit - Order GLOBAL_Hero[(Integer A)] to Move To MSystem_DestinationLoc
                      • Custom script: call RemoveLocation(udg_MSystem_UnitLoc)
                      • Custom script: call RemoveLocation(udg_MSystem_DestinationLoc)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • MSystem_UpCheck[(Integer A)] Equal to False
                      • MSystem_DownCheck[(Integer A)] Equal to True
                      • MSystem_LeftCheck[(Integer A)] Equal to True
                      • MSystem_RightCheck[(Integer A)] Equal to False
                    • Then - Actions
                      • Set MSystem_UnitLoc = (Position of GLOBAL_Hero[(Integer A)])
                      • Set MSystem_DestinationLoc = (MSystem_UnitLoc offset by MSystem_HeroSpeed[(Integer B)] towards 225.00 degrees)
                      • Unit - Make GLOBAL_Hero[(Player number of (Triggering player))] face 225.00 over 0.00 seconds
                      • Animation - Play GLOBAL_Hero[(Integer A)]'s GLOBAL_HerosMoveAnim[(Integer B)] animation
                      • Unit - Order GLOBAL_Hero[(Integer A)] to Move To MSystem_DestinationLoc
                      • Custom script: call RemoveLocation(udg_MSystem_UnitLoc)
                      • Custom script: call RemoveLocation(udg_MSystem_DestinationLoc)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • MSystem_UpCheck[(Integer A)] Equal to False
                      • MSystem_DownCheck[(Integer A)] Equal to True
                      • MSystem_LeftCheck[(Integer A)] Equal to False
                      • MSystem_RightCheck[(Integer A)] Equal to True
                    • Then - Actions
                      • Set MSystem_UnitLoc = (Position of GLOBAL_Hero[(Integer A)])
                      • Set MSystem_DestinationLoc = (MSystem_UnitLoc offset by MSystem_HeroSpeed[(Integer B)] towards 315.00 degrees)
                      • Unit - Make GLOBAL_Hero[(Player number of (Triggering player))] face 315.00 over 0.00 seconds
                      • Animation - Play GLOBAL_Hero[(Integer A)]'s GLOBAL_HerosMoveAnim[(Integer B)] animation
                      • Unit - Order GLOBAL_Hero[(Integer A)] to Move To MSystem_DestinationLoc
                      • Custom script: call RemoveLocation(udg_MSystem_UnitLoc)
                      • Custom script: call RemoveLocation(udg_MSystem_DestinationLoc)
                    • Else - Actions
                • Else - Actions


you can replace the system with slides instead of issueing a movement order (although that would take out pathing AI, but itll be alot smoother (although more cpu intensive))

btw use [WC3.][/WC3.] (remove the .) when your posting copied text from wc3
 

millz-

New Member
Reaction score
25
>The second thing: is there a way to cast a spell while moving using this system?
You probably will need to use dummy to "cast" the spell if you want move-n-cast system, I think.
 

werasd

New Member
Reaction score
14
Hey man. Can you attach the wc3 file for this?
But, i think the problem is that the game orders the unit to move to very near places (it's like if you get a unit in any map and keep clicking the mouse's right button in near places. The unit will walk "riggedly" as you said).
I'm not sure... so you could attach the map for me to check better.
 

Ryuu

I am back with Chocolate (:
Reaction score
64
> you can replace the system with slides instead of issueing a movement order

Yeah, the slide was originally what I intended. But after seeing that I couldn't cast anything while "sliding", I changed it to issue movement order, and it still didn't work.​

> You probably will need to use dummy to "cast" the spell if you want move-n-cast system, I think.

You mean, while my unit is moving, the player selects a dummy unit at a far corner of the map? And through that dummy unit, abilities are casted?​

> Hey man. Can you attach the wc3 file for this?

Sure. ;)
When you've downloaded it, please let me know, I would like to remove it to prevent any further downloads.
Here it is: Map
 

Psiblade94122

In need of sleep
Reaction score
138
actually... you can use
JASS:
call SetUnitX(Your unit, a Real)

JASS:
call SetUnitY(Your unit, a Real)

and you can assign orders to the unit (this will not inturrupt spells)
One more thing, you might want to set the movement speed of the unit to 1, because if the unit moves while slideing with set unit X and Y itll move faster then intended (because your moving the unit directly and because the unit itself is moving)

Another method would be to order to unit to stop if issued a move order, but if your spells have range then the unit will still move to use the spell, but oh well you can add those two as custom scripts instead of using move unit instantly and youll be able to cast spells though that
 

Ryuu

I am back with Chocolate (:
Reaction score
64
Alright, but how do I manipulate around those two custom scripts so that I can move my unit according to my own custom speed?
 

avalya

New Member
Reaction score
37
I'd like to ask how the SetUnitX/Y works, actually, are the reals offsets or coordinates?
 

avalya

New Member
Reaction score
37
Hmm, so how do you know where you are supposed to move a unit? Can you check it's current X/Y position and move it according to an offset of those coordinates?
 

Executor

I see you
Reaction score
57
Trigger:
  • SomeTrigger
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set TempLoc = (Position of SomeUnitVar)
      • Set TempLoc2 = (TempLoc offset by SomeRealVar towards (Facing of SomeUnitVar) degrees)
      • Unit - Move SomeUnitVar instantly to TempLoc2
      • Custom script: call RemoveLocation( udg_TempLoc )
      • Custom script: call RemoveLocation( udg_TempLoc2 )


Becomes this in JASS:

JASS:
function Trig_SomeTrigger_Actions takes nothing returns nothing
    set udg_TempLoc = GetUnitLoc(udg_SomeUnitVar)
    set udg_TempLoc2 = PolarProjectionBJ(udg_TempLoc, udg_SomeRealVar, GetUnitFacing(udg_SomeUnitVar))
    call SetUnitPositionLoc( udg_SomeUnitVar, udg_TempLoc2 )
    call RemoveLocation( udg_TempLoc )
    call RemoveLocation( udg_TempLoc2 )
endfunction

//===========================================================================
function InitTrig_SomeTrigger takes nothing returns nothing
    set gg_trg_SomeTrigger = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_SomeTrigger, 0.03 )
    call TriggerAddAction( gg_trg_SomeTrigger, function Trig_SomeTrigger_Actions )
endfunction


I would do sth. like this (vJass example):

JASS:
scope SomeMovement initializer Init
    globals
        unit someUnit = null
        real someReal = 0.
    endglobals
        
    private function DoSomethingPeriodic takes nothing returns nothing
        local real a = GetUnitFacing(someUnit)* bj_DEGTORAD
        local real x = GetUnitX(someUnit) + someReal * Cos(a)
        local real y = GetUnitY(someUnit) + someReal * Sin(a)
        call SetUnitX(someUnit,x)
        call SetUnitY(someUnit,y)    
    endfunction

    private function Init takes nothing returns nothing
        local timer Timer = CreateTimer()
        call TimerStart(Timer,0.03,true, function DoSomethingPeriodic)
    endfunction
endscope
 

Psiblade94122

In need of sleep
Reaction score
138
uhhh personally i would take two real variables (X(real) and Y(real)) and set the X to the X value of the point that you want the unit to move to, likewise for the Y

That way you dont need to do all the math required because its done for you

In other words
Set a point to where you want the unit to go
Set X = X of point of where you want the unit to go
Set Y = Y of point of where you want the unit to go
call SetUnitX(Your unit, X)
call SetUnitY(Your unit, Y)
 

LearningCode

New Member
Reaction score
24
But you need to know where you are now in order to now where you want to go, correct?
Where you are now will be reference so that you can make the unit move at a constant speed.

In Executor's example, someReal will have to be the distance that you want the unit to move.
And I think it'll make your hero move forward ._.

Isn't it easier to detect a key-press and then make the unit move? O_O
 

Psiblade94122

In need of sleep
Reaction score
138
set point1 to position of your unit
set point2 to point1 offsetting by (any distance) twards (any angle)
Set X to X of point2
set Y to Y of point2
call SetUnitX(Your unit, X)
call SetUnitY(Your unit, Y)

Point1 is where your unit is now
The offset distance for point2 is your speed, so with a bit of math you can make this feel like normal movement (minus the pathing AI)
 

Ryuu

I am back with Chocolate (:
Reaction score
64
Executor,

Trigger:
  • Custom script: local real a = GetUnitFacing(udg_GLOBAL_Hero[GetForLoopIndexA()])* bj_DEGTORAD


gave me an error -> Expected 'endif'
 

Executor

I see you
Reaction score
57
You can declare local variables only at the beginning of the function.

JASS:

function something takes nothing returns nothing
local real a = 5. // works
set a = 3. // works
local real b = 2. // doesn't work because you left the "declare local vars block".
endfunction


Yes, my example will move the unit all 0.03 seconds udg_realVar units in the direction it looks.

If its possible what Psiblade94122 said, do it, I'm no GUI coder anylonger^^
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top