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

drifting?

Status
Not open for further replies.
Level 6
Joined
Aug 29, 2004
Messages
159
maybe with a
'periodic event - every .1 seconds'
'instantly move picked unit to position of unit offset by 50 towards facing of unit offset by 270'

kind of trigger..
could get a little laggy tho, and u wouldnt see their animations, they would just be drifting...
=][= Bort
 
Level 7
Joined
Dec 18, 2004
Messages
148
are you sure that will work? what i am tring to do is make it so a unit is moveing this way ---> but is faceing this way <---.

Edit: wait i hate a friend make me a map that i never used and it has a part in it that lets you controll the units speed and it could go into negitives so it would move back wards and wouls still show animations but i can't find out how to make it move( its not in the triggers)

Edit ok i think i found it, its got to be in this script:
JASS:
// ===========================
function H2I takes handle h returns integer
    return h
    return 0
endfunction

// ===========================
function LocalVars takes nothing returns gamecache
    // Replace InitGameCache with a global variable!!
    return InitGameCache("jasslocalvars.w3v")
endfunction

function SetHandleHandle takes handle subject, string name, handle value returns nothing
    if value==null then
        call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
    else
        call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
    endif
endfunction

function SetHandleInt takes handle subject, string name, integer value returns nothing
    if value==0 then
        call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
    else
        call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction

function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
    if value==false then
        call FlushStoredBoolean(LocalVars(),I2S(H2I(subject)),name)
    else
        call StoreBoolean(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction

function SetHandleReal takes handle subject, string name, real value returns nothing
    if value==0 then
        call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
    else
        call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction

function SetHandleString takes handle subject, string name, string value returns nothing
    if value==null then
        call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
    else
        call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction

function GetHandleHandle takes handle subject, string name returns handle
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
    return GetStoredBoolean(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
    return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
    return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction

function GetHandleUnit takes handle subject, string name returns unit
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction

function GetHandleTimer takes handle subject, string name returns timer
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction

function GetHandleTrigger takes handle subject, string name returns trigger
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction

function GetHandleEffect takes handle subject, string name returns effect
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction

function GetHandleGroup takes handle subject, string name returns group
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction

function GetHandleLightning takes handle subject, string name returns lightning
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction

function GetHandleWidget takes handle subject, string name returns widget
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction

function FlushHandleLocals takes handle subject returns nothing
    call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction

function UnitTurnBone takes unit whichUnit, string whichBone, real angle, real pitch, boolean fromFacing returns nothing
    if ( fromFacing ) then
        set angle = angle + GetUnitFacing(whichUnit)
    endif
    if ( pitch == 90.0 ) then
        set pitch = 89
    endif
    call SetUnitLookAt(whichUnit, whichBone, whichUnit, 10000.0*Cos(angle*bj_DEGTORAD)*Cos(pitch*bj_DEGTORAD), 10000.0*Sin(angle*bj_DEGTORAD)*Cos(pitch*bj_DEGTORAD), 10000.0*Tan(pitch*bj_DEGTORAD)+90.0)
endfunction

function Move_Missile_Update takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local real damage = GetHandleReal(t, "dmg")
    local integer steps = GetHandleInt(t, "steps")
    local unit missile = GetHandleUnit(t, "missile")
    local real xvel = GetHandleReal(t, "xvel")
    local real yvel = GetHandleReal(t, "yvel")
    local real zvel = GetHandleReal(t, "zvel")

    call SetUnitPosition(missile, GetUnitX(missile) + xvel, GetUnitY(missile) + yvel)
    
    if ( steps <= 1 ) then
        call FlushHandleLocals(t)
        call DestroyTimer(t)
	call RemoveUnit(missile)
        return
    endif
    call SetHandleInt(t, "steps", steps-1)
endfunction

function Move_Missile takes unit source, unit missile, real damage, real vel, real zvel, real duration returns nothing
    local timer t = CreateTimer()
    local real update = 0.02
    local real xvel = (update * vel * Cos(Deg2Rad(GetUnitFacing(source))))
    local real yvel = (update * vel * Sin(Deg2Rad(GetUnitFacing(source))))
    
    call SetHandleReal(t, "dmg", damage)
    call SetHandleInt(t, "steps", R2I(duration/update))
    call SetHandleReal(t, "xvel", xvel)
    call SetHandleReal(t, "yvel", yvel)
    call SetHandleReal(t, "zvel", zvel)
    call SetHandleHandle(t, "missile", missile)
    call TimerStart(t, update, true, function Move_Missile_Update)
endfunction
 
Level 7
Joined
Aug 5, 2005
Messages
218
Hum, you don't need to use jass, and it certainly doesn't need to be that complicated. Just try:

Code:
Drift
    Events
        Time - Every 0.01 seconds of game time
    Conditions
        Drift[1] Equal to True
    Actions
        Unit - Move Unit[1] instantly to ((Position of Unit[1]) offset by 4.00 towards ((Facing of Unit[1]) + 180.00) degrees)
Edit: the +180 means it will go backwards.
 
Level 7
Joined
Feb 15, 2005
Messages
183
JASS is the only way to get the periodic event to be below 0.10 seconds. With Timers, you can go all the way to .01 seconds. So JASS will make the movement seem more smooth. I am not sure if handle vars are completely needed. But they rae if you want to keep the spell multi-instanceable. If you can move this to the spell forum, you will probable get much more help.
 
Status
Not open for further replies.
Top