Jump to content
USman

Volunteer script help

Recommended Posts

I'm using emergency_freak and can't get it to work all the way. I don't get any prompts when loading the game and I'm able to select the command but nothing happens. Anybody see what I'm missing?

 

// Name of Virtual Objects where Vehicles are made// These definitions are used further down in the scriptconst char *STR_VObjVehicle1Start = "emsvehicle1_vo";const char *STR_VObjVehicle2Start = "emsvehicle2_vo";const char *STR_VObjVehicle3Start = "emsvehicle3_vo";const char *STR_VObjVehicle4Start = "emsvehicle4_vo";//Name of the Virtual Object where Vehicles are parked.const char *STR_VObjVehicleTarget = "emsvehicle_target";// Prototypes of persons and vehicles// The people meet original EM4 paths and must not be changed// Vehicle Pathes need to be changedconst char *STR_ProtoPerson1 = "mod:Prototypes/Persons/Civil/civilboy03_blue.e4p";const char *STR_ProtoPerson2 = "mod:Prototypes/Persons/Civil/civilwoman01_red.e4p";const char *STR_ProtoPerson3 = "mod:Prototypes/Persons/Civil/civilworker03.e4p";const char *STR_ProtoPerson4 = "mod:Prototypes/Persons/Civil/civilman02_silver.e4p";const char *STR_ProtoPerson5 = "mod:Prototypes/Persons/Civil/civilman03_green.e4p";const char *STR_ProtoPerson6 = "mod:Prototypes/Persons/Civil/civilminister01.e4p";const char *STR_ProtoPerson7 = "mod:Prototypes/Persons/Civil/civilworker01.e4p";const char *STR_ProtoVehicle1 = "mod:Prototypes/Vehicles/Civil - Cars/civilcar01_silver.e4p";const char *STR_ProtoVehicle2 = "mod:Prototypes/Vehicles/Civil - Cars/civilcar04_red.e4p";const char *STR_ProtoVehicle3 = "mod:Prototypes/Vehicles/Civil - Trucks/civilvan01.e4p";const char *STR_ProtoVehicle4 = "mod:Prototypes/Vehicles/Civil - Trucks/civiltruck04_red.e4p";object Alarm_EMS1 : CommandScript  // Name of the script.{                                // PCmd is person bound ComandscriptAlarm_EMS1()                // Name can be changed arbitrarily{SetCursor("install");SetIcon("install");SetValidTargets(ACTOR_FLOOR);  }bool CheckTarget(GameObject *Caller, Actor *Target, int childID){       return true;}void PushActions(GameObject *Caller, Actor *Target, int childID){// In the following lines, VOs are checked to see if available// If above fundamental changes were made to the definitions, must also be changed here!     ActorList Vec1StartList(STR_VObjVehicle1Start);     if (Vec1StartList.GetNumActors() != 1)     {         System::Log("PCmdAlarmFW: Vec1StartList mismatch!");         return;     }ActorList Vec2StartList(STR_VObjVehicle2Start);     if (Vec2StartList.GetNumActors() != 1)     {         System::Log("PCmdAlarmFW: Vec2StartList mismatch!");         return;     }ActorList Vec3StartList(STR_VObjVehicle3Start);     if (Vec3StartList.GetNumActors() != 1)     {         System::Log("PCmdAlarmFW: Vec3StartList mismatch!");         return;     }ActorList Vec4StartList(STR_VObjVehicle4Start);     if (Vec4StartList.GetNumActors() != 1)     {         System::Log("PCmdAlarmFW: Vec4StartList mismatch!");         return;     }     ActorList VecTargetList(STR_VObjVehicleTarget);     if (VecTargetList.GetNumActors() != 1)     {         System::Log("PCmdAlarmFW: VecTargetList mismatch!");         return;     }     // In the following lines, Vehicles and Vehicle Guide are created// The number after 'Anzahl' represents the number of vehicles.int Anzahl = 2;for (int i=1; i<Anzahl; i++)     { Person passenger = Game::CreatePerson(STR_ProtoPerson1, "Unnamed");passenger.SetRole(ROLE_SQUAD);passenger.AssignCommand("MoveTo"); // Commands that are assigned to the person can be changed as requiredpassenger.AssignCommand("EnterCar");passenger.AssignCommand("PCmdChangeToFF");int CreateVehicle = rand()%4;switch(CreateVehicle) {case 0: Vehicle v = Game::CreateVehicle(STR_ProtoVehicle1, "privatpkw_ff1");break; case 1: Vehicle v = Game::CreateVehicle(STR_ProtoVehicle2, "privatpkw_ff1");break; case 2: Vehicle v = Game::CreateVehicle(STR_ProtoVehicle3, "privatpkw_ff1");break; case 3: Vehicle v = Game::CreateVehicle(STR_ProtoVehicle4, "privatpkw_ff1");break; }ActorList VehicleStartList;          if (i == 1){VehicleStartList = Vec2StartList;}else if (i == 2){VehicleStartList = Vec3StartList;}else if (i == 3){VehicleStartList = Vec4StartList;}else{VehicleStartList = Vec1StartList;}Vector vStartPos(VehicleStartList.GetActor(0)->GetPosition());Vector vTargetPos(VecTargetList.GetActor(0)->GetPosition());Game::FindFreePosition(&v, vStartPos, 100.f);Game::FindFreePosition(&v, vTargetPos, 100.f);v.SetPosition(vStartPos);v.SetSpeed(12.f);v.SetMaxPassengers(2);v.AddPassenger(passenger);v.AssignCommand("MoveTo");v.AssignCommand("EmptyCar");int WaitingTimeVec = rand()%3;switch(WaitingTimeVec) { case 0:int WaitingV1 = 4.f;break;case 1:int WaitingV1 = 8.f;break;case 2:int WaitingV1 = 11.f;break;}v.PushActionWait(ACTION_NEWLIST, WaitingV1);v.PushActionMove(ACTION_APPEND, vTargetPos);}     // Here the alarm message apears// In addition a sound is played     Mission::PlayHint("Ambulance 231 was paged");Audio::PlaySample("mod:Audio/FX/misc/ems1_alert");     System::Log("PCmdAlarmFW: ended");}};[/spoiler];>Again any help would be great. I'm trying to lean how to script and have some ability, but still don't have a huge grasp of code.Stay Warm, USman
Link to comment
Share on other sites

Thank you! I'll give it a shot when I get off shift!

 

__________________________________________________

EDIT:

 

No go, turns out that line was just a miss copy into the post and I reposted the script so take a look. It was there. Still thanks for taking a look!

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