I've set up an encounter in which the PC enters a pit to fight a drow. as soon as they enter the pit the drow goes hostile and archer come out of two room on either side of the pit and take position around the pit. The number archers could be anywhere from 0 to 6, depending on PC level.
I used a for loop to spawn the archers:
int iInt;
for(iInt=1; iInt<=iArchers; iInt++)
{
oTarget = GetWaypointByTag("archer_spawn_"+IntToString(iInt));
lTarget = GetLocation(oTarget);
CreateObject(OBJECT_TYPE_CREATURE, sArchers, lTarget,FALSE,("drow_archer"+IntToString(iInt))); //spawn Archers
}When the PC enters the pit I use another loop to issue the commands:
//Open the doors for the archers
oTarget = GetObjectByTag("drow_door1");
AssignCommand(oTarget, ActionOpenDoor(oTarget));
oTarget = GetObjectByTag("drow_door2");
AssignCommand(oTarget, ActionOpenDoor(oTarget));
//Assign comands to archers
int iN;
for(iN=1;iN<=6;iN++)
{
oTarget = GetObjectByTag("drow_archer1"+IntToString(iN));
DelayCommand(0.5,AssignCommand(oTarget, ActionMoveToObject(GetObjectByTag("archer_position_"+IntToString(iN)),TRUE)));
DelayCommand(1.5,ChangeFaction(oTarget,GetObjectByTag("Hostile")));
}When I test the script the doors open but the archers don't come up. They do spawn, they just don't come out. Does anyone see a problem in my code or is this just a pathing issue?





Retour en haut






