- Joined
- Sep 29, 2006
- Messages
- 447
Okay so I'm trying to use an arrow key movement system in my map and it has to slide units, not order them to move. I also need them to be able to cast abilities while sliding, so SetUnitPosition() is out, I tried it. Naturally I decided to use SetUnitX,Y, but that ignores pathing, so I have a function that checks pathing at a location in there. Basically, my trigger doesn't slide the unit and I don't know why, can anyone help?
Please keep in mind that I am new to JASS, and can understand scripts (well, most of them) by reading them, but need help generating them on my own.
This is game breaking and it needs to be fixed. Thanks in advance and +rep for the help.
Also, I have a Mac, So I don't have JassCraft or any other third party program, because as far as I know, there are none for the Mac.
Please keep in mind that I am new to JASS, and can understand scripts (well, most of them) by reading them, but need help generating them on my own.
JASS:
function IsCar takes nothing returns boolean
return ( GetFilterUnit() == udg_Car[GetConvertedPlayerId(GetEnumPlayer())] )
endfunction
function Conditions takes nothing returns boolean
if ( not ( udg_Forward[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))] == true ) ) then
return false
endif
if ( not ( IsUnitType(GetEnumUnit(), UNIT_TYPE_STUNNED) == false ) ) then
return false
endif
return true
endfunction
function IsPositionPathable takes real x, real y returns boolean
local boolean flag
local unit PathChecker
set PathChecker = CreateUnit(Player(15), 'hfoo', x, y, 0)
set flag = (GetUnitX(PathChecker) == x) and (GetUnitY(PathChecker) ==y)
call RemoveUnit(PathChecker)
set PathChecker = null
return flag
endfunction
function Function2 takes nothing returns nothing
local location TempPoint = GetUnitLoc(GetEnumUnit())
local real TempReal = GetUnitFacing(GetEnumUnit())
local location TempPoint2 = PolarProjectionBJ(TempPoint, 13.00, TempReal)
local boolean pathable = IsPositionPathable(GetLocationX(TempPoint2), GetLocationY(TempPoint2))
if ( Conditions() ) then
if (pathable == true) then
call SetUnitX(GetEnumUnit(), GetLocationX(TempPoint2))
call SetUnitY(GetEnumUnit(), GetLocationY(TempPoint2))
else
endif
call RemoveLocation(TempPoint2)
call RemoveLocation(TempPoint)
else
endif
endfunction
function Function1 takes nothing returns nothing
local group TempUnitGroup = GetUnitsOfPlayerMatching(GetEnumPlayer(), Condition(function IsCar))
call ForGroupBJ( TempUnitGroup, function Function2 )
call DestroyGroup(TempUnitGroup)
endfunction
function Trig_move_forward_Copy_Actions takes nothing returns nothing
call ForForce( GetPlayersAll(), function Function1 )
endfunction
//===========================================================================
function InitTrig_move_forward_Copy takes nothing returns nothing
set gg_trg_move_forward_Copy = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_move_forward_Copy, 0.03 )
call TriggerAddAction( gg_trg_move_forward_Copy, function Trig_move_forward_Copy_Actions )
endfunction
This is game breaking and it needs to be fixed. Thanks in advance and +rep for the help.
Also, I have a Mac, So I don't have JassCraft or any other third party program, because as far as I know, there are none for the Mac.
Last edited: