HoS_PRC8/_mod/_module/nss/start_pirates.nss
Jaysyn904 04165202c0 Initial upload
Initial upload
2024-11-25 19:36:07 -05:00

75 lines
2.2 KiB
Plaintext

// Start Pirates
void fnPirateAI();
void main()
{
object oPC=GetEnteringObject();
object oPirate1=GetNearestObjectByTag("PIRATE",oPC,1);
object oPirate2=GetNearestObjectByTag("PIRATE",oPC,2);
object oPirate3=GetNearestObjectByTag("PIRATE",oPC,3);
object oCaptain=GetNearestObjectByTag("TheCaptain",oPC,1);
object oWP;
int nC=1;
if (GetIsPC(oPC)==TRUE)
{ // is PC
if (oPirate1==OBJECT_INVALID&&oPirate2==OBJECT_INVALID&&oPirate3==OBJECT_INVALID)
{ // setup pirates
while(nC<4)
{ // make pirate
oWP=GetWaypointByTag("PIRATE_"+IntToString(nC));
oPirate1=CreateObject(OBJECT_TYPE_CREATURE,"pirate"+IntToString(nC),GetLocation(oWP));
DelayCommand(4.0,AssignCommand(oPirate1,fnPirateAI()));
nC++;
} // make pirate
AssignCommand(oCaptain,SpeakString("PIRATES!!! To arms!"));
} // setup pirates
} // is PC
ExecuteScript("area_visit",OBJECT_SELF);
}
void fnPirateAI()
{ // do the pirate routine
object oMe=OBJECT_SELF;
int nState=GetLocalInt(oMe,"nState");
effect eHook=EffectBeam(VFX_BEAM_ODD,oMe,BODY_NODE_HAND,FALSE);
object oWP=GetWaypointByTag("HOOK_OVER");
int nR;
switch (nState)
{ // switch
case 0:
case 1:
case 2:
case 3: { // don't do special move right away
nState++;
SetLocalInt(oMe,"nState",nState);
break;
} // don't do special move right away
case 4: { // pause before hook over
nR=Random(10);
SetLocalInt(oMe,"nState",5);
DelayCommand(IntToFloat(nR),SetLocalInt(oMe,"nState",6));
break;
} // pause before hook over
case 5: { // idle state
break;
} // idle state
case 6: { // hook over
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eHook,oWP,6.8);
SetLocalInt(oMe,"nState",7);
break;
} // hook over
case 7: { // teleport
AssignCommand(oMe,ClearAllActions(TRUE));
AssignCommand(oMe,JumpToObject(oWP));
SetLocalInt(oMe,"nState",8);
break;
} // teleport
case 8: { // equip melee weapons
AssignCommand(oMe,ActionEquipMostDamagingMelee());
SetLocalInt(oMe,"nState",5); // done
break;
} // equip melee weapons
} // switch
} // fnPirateAI()