Jump to content
cops

script help...

Recommended Posts

Hi all,

I tried a script but it don't work :(

untitled8oqdj.png

script :

int DummyGroup = 20;


const char STR_VObjPersonStart[] = "Paramedic63crew";
const char STR_ProtoPerson[] = "mod:Prototypes/Persons/Fire Department/firefighternorm.e4p";
const char STR_VehicleName[] = "Paramedic63";
const char CommandIcon[] = "";
const char AlarmMessage[] = "";
const char AlarmSound[] = "";
const int PersonCounter = 3;
const int VehicleSirenID = 0;
const int GameSoundID = 0;
const int VehicleWaitingTime = 10.0;


object DummyVehicleNotAvalible : CommandScript
{
DummyVehicleNotAvalible()
{
SetGroupID(DummyGroup);
}

bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
{
return false;
}
};

// Alarmscript

object PcmdAlarmParamedic63 : CommandScript
{
PcmdAlarmParamedic63()
{
SetCursor(CommandIcon);
SetIcon(CommandIcon);
SetValidTargets(ACTOR_FLOOR);
}

bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
{
if(!Target->GetType() == ACTOR_FLOOR)
return false;

return true;
}

void PushActions(GameObject *Caller, Actor *Target, int childID)
{
GameObjectList l0 = Game::GetGameObjects(TYPE_VEHICLE);
for(int i=0; i<l0.GetNumObjects(); i++)
{
ActorList PerStartList(STR_VObjPersonStart);
if (PerStartList.GetNumActors() == 0)
{
System::Log("Alarmscript Can't find Virtual Object!");
return;
}

GameObject *Obj = l0.GetObject(i);
Vehicle v(Obj);

if(v.HasName(STR_VehicleName) && !v.HasCommand("DummyVehicleNotAvalible"))
{
for(int j=0; j<PersonCounter; j++)
{
Vector Pos = v.GetPosition();

Person p = Game::CreatePerson(STR_ProtoPerson, "Firefighternorm");

Vector pStartPos(PerStartList.GetActor(0)->GetPosition());
Game::FindFreePosition(&p, pStartPos, 100.f);

p.SetPosition(pStartPos);
p.PushActionMove(ACTION_NEWLIST, Pos);
p.PushActionTurnTo(ACTION_APPEND, &v);
p.PushActionEnterCar(ACTION_APPEND, &v);
}

Mission::PlayHint(Paramedic 63, please respond to your car);
if(GameSoundID == 1)
{
Audio::PlaySample(AlarmSound);
}
Vector TargetPos=Game::GetCommandPos();
Game::FindFreePosition(&v, TargetPos, 90);

v.PushActionWait(ACTION_NEWLIST, VehicleWaitingTime);
if(VehicleSirenID == 1)
{
v.PushActionExecuteCommand(ACTION_APPEND, "VCmdSiren", &v, 0, false);
}
v.PushActionMove(ACTION_APPEND, TargetPos);
v.AssignCommand("DummyVehicleNotAvalible");
}
}
}
};

does anyone see the fault?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...