Jump to content
Guest Dakati

Persons wont enter car?

Recommended Posts

Hello.

I've made a spawn script for my mod, but i have a problem.

If i push the button, the vehicle appear, and the persons 2.

The walk to the vehicle, turn to it, but they dont enter it.

Also, if i select them, the command EnterCar is disabled.

The script:

const char SPAWN_01[]	= "fs1_spawn1";
const char SPAWN_02[] = "fs1_spawn2";
const char PSPAWN_01[] = "fs1_spawnp1";

// Prototypes
const char PT_AMBU[] = "mod:Prototypes/Vehicles/Ambulance/rtw.e4p";


// Personen
const char PT_P_ARTS[] = "mod:Prototypes/Persons/Ambulance/doctor_m.e4p";
const char PT_P_BRD[] = "mod:Prototypes/Persons/Ambulance/paramedic.e4p";


const char UNNAMED[] = "Unnamed";

object ScmdAmbu : CommandScript
{
ScmdAmbu()
{
SetCursor("none");
SetIcon("none");
}

bool CheckPossible(GameObject *Caller)
{
return true;
}

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

void PushActions(GameObject *Caller, Actor *Target, int ChildID)
{
ActorList spawnvo = Game::GetActors(SPAWN_01);
ActorList spawnp = Game::GetActors(PSPAWN_01);

if(spawnvo.GetNumActors() > 0)
Vector Spawn = spawnvo.GetActor(0)->GetPosition();

if(spawnp.GetNumActors() > 0)
Vector SpawnPer = spawnp.GetActor(0)->GetPosition();

Vehicle v = Game::CreateVehicle(PT_AMBU, UNNAMED);
if (Game::FindFreePosition(&v, Spawn))
{
Game::FindFreePosition(&v, Spawn);
v.SetPosition(Spawn);
}

Person arts = Game::CreatePerson(PT_P_ARTS, UNNAMED);
Person para = Game::CreatePerson(PT_P_BRD, UNNAMED);
if (Game::FindFreePosition(&arts, SpawnPer))
{
arts.SetUpgradeLevel(3);
Game::FindFreePosition(&arts, SpawnPer);
arts.SetPosition(SpawnPer);
arts.PushActionMove(ACTION_NEWLIST, &v, TARGET_PASSENGERDOOR);
arts.PushActionTurnTo(ACTION_APPEND, &v);
arts.PushActionEnterCar(ACTION_APPEND, &v);
}

if (Game::FindFreePosition(¶, SpawnPer))
{
para.SetUpgradeLevel(3);
Game::FindFreePosition(¶, SpawnPer);
para.SetPosition(SpawnPer);
para.PushActionMove(ACTION_NEWLIST, &v, TARGET_PASSENGERDOOR);
para.PushActionTurnTo(ACTION_APPEND, &v);
para.PushActionEnterCar(ACTION_APPEND, &v);

}
}
};

Any suggestions?

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...