From 87fa4b967fd8670313d991eb0e65bca51f4aba41 Mon Sep 17 00:00:00 2001 From: Joseph Botosh Date: Thu, 17 Sep 2015 00:59:13 +0300 Subject: add initial pos to firstmove function as 2nd arg --- npc/functions/npcmovegraph.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/npc/functions/npcmovegraph.txt b/npc/functions/npcmovegraph.txt index f7bd8e6d..d3db8765 100644 --- a/npc/functions/npcmovegraph.txt +++ b/npc/functions/npcmovegraph.txt @@ -201,11 +201,21 @@ function script movetonextpoint { return; } +// initial actions for npc when using move graphs. +// function can accept 2 arguments: +// 1: action sequence, for example "speed 200; dir 4". Default is "moveon" +// 2: start point label. Default is #0 from move graph labels function script firstmove { .@nextcmd$ = "moveon"; + .@initpos = 0; if (getargcount() > 0) .@nextcmd$ = getarg(0); - set getvariableofnpc(.movepos, strnpcinfo(3)), 0; + if (getargcount() > 1) + .@initpos = findmovegraphlabel(getarg(1)); + + set getvariableofnpc(.movepos, strnpcinfo(3)), .@initpos; + movenpc strnpcinfo(3), getvariableofnpc(.moveposx[.@initpos], strnpcinfo(3)), + getvariableofnpc(.moveposy[.@initpos], strnpcinfo(3)); set getvariableofnpc(.nextcmd$, strnpcinfo(3)), .@nextcmd$; set getvariableofnpc(.waitticks, strnpcinfo(3)), -1; movetonextpoint; -- cgit v1.2.3-70-g09d2