alright so i'm trying to make an easier/faster way to do waypoint movement for creatures
ie. creature enters rect 1, ordered to move to rect 2 and then on entering rect 2 ordered to move to rect 3 etc
but in JASS it looks like:
- Code:
-
function Move1 takes nothing returns nothing
call NextMove(gg_rct_Rect_019)
endfunction
function InitMove takes nothing returns nothing
local trigger t = CreateTrigger()
local region r = CreateRegion()
call RegionAddRect(r, gg_rct_Rect_XXX)
call TriggerRegisterEnterRegion(t, r, OwnedByGreen
call TriggerAddAction(t, function Move1)
set t = null
set r = null
endfunction
which is awful considering it needs to be done for each one
so i tried doing this
- Code:
-
library WaypointMove
struct WaypointMove
private region Waypoint = CreateRegion()
private rect Nextpoint
private trigger EntryEvent = CreateTrigger()
static method WaypointNextMove takes nothing returns nothing
call IssuePointOrder(GetTriggerUnit(), "move", GetRectCenterX(Nextpoint), GetRectCenterY(Nextpoint))
endmethod
method onDestroy takes nothing returns nothing
set Waypoint = null
set Nextpoint = null
set EntryEvent = null
endmethod
static method create takes rect r1, rect r2 returns WaypointMove
local WaypointMove new = WaypointMove.allocate()
call RegionAddRect(new.Waypoint, r1)
set new.Nextpoint = r2
call TriggerRegisterEnterRegion(new.EntryEvent, new.Waypoint, OwnedByGreen)
call TriggerAddAction(new.EntryEvent, function WaypointNextMove)
return new
endmethod
endstruct
endlibrary
OwnedByGreen is a filter func which does what it should
the problem with this is that it doesn't recognize WaypointNextMove as a valid function when I try to add it to the trigger
I'm pretty sure I've run into this exact problem before xD
but if you have an idea of how to fix it'd make my life a lot easier
.create(rect1, rect2) and doneeeeeeeeeeeeeeee
i tried it without the struct first, but you run into the problem of having to pass rects into WaypointNextMove
ive already tried the obvious stuff
like
function WaypointMove.WaypointNextMove
i have one more question, but it took way too long to type this one up, so i'll ask it later