PDA

View Full Version : new mods for wesquests: Move a NPC to a new location and ani


Malevolent
04-25-2002, 03:25 PM
This is my script (has some of the other tweaks, remove as needed)

NPC_SCRIPT 4721{
TRIGGER_TEXT:Hail:{
NAME: Human who thinks himself a snow leopard
EMOTE: hisses at you
DO_ANIMATION: 3
}
}


NPC_SCRIPT 4723{
TRIGGER_TEXT:Hail:{
NAME: ORC SNOW TROOPER
EMOTE: grunts, and then takes a big whiff of the air.
SAY: By an elven mother, you stink! I'm outta here!
MOVE_TO_NEW_HOME 3.00 4.00 3.00 1.00
}
}


else if (strstr(strupr(command),"DO_ANIMATION") != NULL) {
if (tt2 || ti2 || td) {
if (target!=0){
target->DoAnim(atoi(sep.arg[1]));
}
}
}
/************************************************** ************
requires org_x,y,z to be exposed in npc.h in public OR
there to be a method to SetX() -- it simply fools the npc into
moving to the new location
Usage: MOVE_TO_NEW_HOME x y z heading
************************************************** ************/
else if (strstr(strupr(command), "MOVE_TO_NEW_HOME") != NULL) {
if (tt2 || ti2 || td) {
if (target!=0 && target->IsNPC()){

if (!sep.IsNumber(1))
sprintf(sep.arg[1],"1");
if (!sep.IsNumber(2))
sprintf(sep.arg[2],"1");
if (!sep.IsNumber(3))
sprintf(sep.arg[3],"1");
if (!sep.IsNumber(4))
sprintf(sep.arg[4],"0");

target->CastToNPC()->org_x=atof(sep.arg[1]);
target->CastToNPC()->org_y=atof(sep.arg[2]);
target->CastToNPC()->org_z=atof(sep.arg[3]);
target->CastToNPC()->org_heading=atof(sep.arg[4]);
target->CastToNPC()->SetIsMovingHome(true);
}
}
}



Quest changes are active on "Malevolent's Lab" on public server network. You can try these out in Rivervale. That location happens to be the mouth of the entrance to misty.

--MV

strychn
04-29-2002, 11:45 AM
why not just move [new set of x, y, z] :p

Malevolent
04-29-2002, 12:29 PM
If I understand what you are saying right, it would only move the npc to x,yz as the SendTo() doesn't always work (esp. if you don't have maps). I've found playing off of the ismovinghome works out pretty well, as it sets up a new vector to move to and the mob actually slowly moves that way.

This code also serves well as a basis for setting up waypoints via the scripting engine. Just have to add a step counter to it. Works pretty well for me. :)

strychn
04-29-2002, 04:38 PM
ahh...makes sense now. i didn't quite understand from what you posted before. was just wondering why it was so dang long...:)
hehe