• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[General] (Newbie of vJass) : How i move unit in vJass ?

Status
Not open for further replies.
Level 2
Joined
Jul 18, 2010
Messages
12
It's normal GUI code form my map



  • Casting
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) Ability
    • Actions
      • Set Cast_Unit = (Triggering unit)
      • Set Distanes = 1000.00
      • Trigger - Turn on Looping <gen>
  • Looping
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Set Distanes = (Distanes - 33.00)
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Distanes Less than or equal to (<=) 100.00
          • Then - Actions
            • Trigger - Turn off (This trigger)
          • Else - Actions
            • Set Cast_Location = (Position of Cast_Unit)
            • Set Move = (Cast_Location offset by 33.00 towards (Facing of Cast_Unit) degrees)
            • Set X = (X of Move)
            • Set Y = (Y of Move)
            • Custom script: call SetUnitX(udg_Cast_Unit, udg_X)
            • Custom script: call SetUnitY(udg_Cast_Unit, udg_Y)
            • Custom script: call RemoveLocation (udg_Cast_Location)
            • Custom script: call RemoveLocation (udg_Move)
When coded of that in the form of vJass, what is the result ?

[Sorry for my english]

ps.I means how to move unit projec in form of vJass.
 
He wants someone to write his GUI code in vJASS. Maybe he just wants to compare if it would be much more efficient or what ever.

If so, you don't need vJASS to make it more efficient. Here for example, you could reduce your 'Else - Actions' to only two custom scripts: SetUnitX and SetUnitY, without any locations.
_________________

You can code a full map in GUI / jass / vJass / zinc / cjass / any others.
Wurstscript is also worth to be menationed :csmile:
 

Cokemonkey11

Spell Reviewer
Level 30
Joined
May 9, 2006
Messages
3,543
There are many reasons why this is a bad trigger in both GUI and vJass, but this is essentially a vJass version of your trigger:

JASS:
scope BadMovementExample initializer i
    globals
        private constant integer DASH_ABILITY_ID = 'A000'
        private unit castUnit = null
        private real distance = 1000.
        private timer clock = CreateTimer()
    endglobals
    
    private function periodic takes nothing returns nothing
        local real facing = GetUnitFacing(castUnit)
        set distance = distance - 33.
        if distance<=100. then
            call PauseTimer(clock)
        endif
        call SetUnitX(GetUnitX(castUnit)+33.*Cos(facing*bj_DEGTORAD)
        call SetUnitY(GetUnitY(castUnit)+33.*Sin(facing*bj_DEGTORAD)
    endfunction
    
    private function c takes nothing returns boolean
        if GetSpellAbilityId() == DASH_ABILIY_ID then
            set castUnit = GetTriggerUnit()
            set distance = 1000.
            call TimerStart(clock,0.04,true,function periodic)
        endif
        return false
    endfunction
    
    private function i takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(t,Condition(function c))
        set t = null
    endfunction
endscope
 
Status
Not open for further replies.
Top