Jump to content
Emergency Defender

Help With Scripts

Recommended Posts

:help: I want to start off simple with the first mission of my mod, but I need to know the following:

-How do I set these as my mission requirements?

>Arrest two gangsters

>Collect an item (a video camera) as evidence

>Tow a stolen vehicle wreck to base

>Take away the injured

-How do I change the dialouge of a person?

-How do I change the description of a mission?

I've already figured out how to set them to gangsters, injured, etc.

I know it's alot, but any help is appreciated. The manual was not at all helpful in showing me what to do. Thank you! :)

Link to comment
Share on other sites

Try this one.

const char NAME_OBJECT[]			= "camera";				//Name of evidence (make sure it can be picked up)
const char NAME_CAR[] = "stolencar"; //Name of stolen car
const char OBJ_OBJECT[] = "Equipment/tvcamera.V3O"; //Path to model of evidence

const char OBJECTIVE_TERROR[] = "Arrest two gangsters!";
const char OBJECTIVE_CAR[] = "Tow the stolen vehicle wreck to base!";
const char OBJECTIVE_OBJECT[] = "Collect evidence!";
const char OBJECTIVE_TRANSPORT[] = "Take away the injured!";

object Mission01 : MissionScript
{
GameObject mObject;

Mission01()
{
System::SetEnv("e3_doocclusion", 0);
}

~Mission01()
{
System::SetEnv("e3_doocclusion", 1);
}

void Start()
{
GameObjectList list = Game::GetGameObjects();
for(int i = 0; i < list.GetNumObjects(); ++i)
{
GameObject *obj = list.GetObject(i);
if(obj->HasName(NAME_OBJECT))
{
mObject = *obj;
//if (!mObject.IsFlagSet(OF_PORTABLE))
// mObject.SetFlag(OF_PORTABLE);
}
}
Mission::AddObjective(OBJECTIVE_TERROR);
Mission::AddObjective(OBJECTIVE_TOW);
Mission::AddObjective(OBJECTIVE_OBJECT);
Mission::AddObjective(OBJECTIVE_TRANSPORT);
}

bool OnCheckCommand(const char* Command, GameObject *Caller, Actor *Target)
{
switch(Command)
{
case "PickUp":
{
if(Caller->GetType() == ACTOR_PERSON)
{
if((!Caller->HasCommand("Arrest") || Caller->HasCommand("GetFlashgrenade")) && Target->GetID() == mObject.GetID())
return false;
}
break;
}
}
return true;
}

ActionCallbackResult OnAbortAction(const char *Action, ActionCallback* Data)
{
switch(Action)
{
case "EActionPickUp":
{
if(Data->Parameters[0].iValue == mObject.GetID() && Data->Parameters[1].iValue >= 2)
{
Person owner(Data->Owner);
owner.PlaceObjectInRightHand(OBJ_OBJECT);
owner.EnableCommand("Arrest", false);
owner.EnableCommand("Redirect", false);
owner.EnableCommand("Drop", false);
owner.EnableCommand("GetRoadBlock", false);
owner.EnableCommand("Halt", false);
owner.EnableCommand("HaltVehicle", false);
}
break;
}
}
return ACTION_CONTINUE;
}

void OnMissionLeft(GameObject *obj)
{
if(obj->GetID() == mObject.GetID())
Mission::SetObjectiveAccomplished(OBJECTIVE_OBJECT, true);
else if (obj->HasName(NAME_CAR))
Mission::SetObjectiveAccomplished(OBJECTIVE_CAR, true);
}

MissionState GetMissionState()
{
if(Mission::GetCounter("Gangsters") == 0)
{
if(!Mission::IsObjectiveAccomplished(OBJECTIVE_TERROR))
Mission::SetObjectiveAccomplished(OBJECTIVE_TERROR, true);
}
else
{
if(Mission::IsObjectiveAccomplished(OBJECTIVE_TERROR))
Mission::SetObjectiveAccomplished(OBJECTIVE_TERROR, false);
}

if(Mission::GetCounter("Injured Persons") + Mission::GetCounter("Dead Persons") == 0)
{
if(!Mission::IsObjectiveAccomplished(OBJECTIVE_TRANSPORT))
Mission::SetObjectiveAccomplished(OBJECTIVE_TRANSPORT, true);
}
else
{
if(Mission::IsObjectiveAccomplished(OBJECTIVE_TRANSPORT))
Mission::SetObjectiveAccomplished(OBJECTIVE_TRANSPORT, false);
}

if(Mission::IsDefaultLogicNegative())
return MISSION_FAILED;

if(Mission::IsDefaultLogicPositive() && Mission::AllObjectivesAccomplished())
return MISSION_SUCCEEDED;

return MISSION_RUNNING;
}

bool SerializeTo(ScriptSerializer *Stream)
{
int version = 0x100;
Stream->Write(version);
Stream->Write(mObject);

return true;
}

bool SerializeFrom(ScriptSerializer *Stream)
{
int version;
Stream->Read(version);
Stream->Read(mObject);

return true;
}
};

Copy/paste this text into an empty Notepad file and save as mission01.script.

You can change the text between the brackets in the first 7 lines.

About the evidence. Use a police officer to collect it. Make sure he has the command PickUp.

When he picks the evidence up, the videocamera will be put in his hand. Send him in a car to HQ to finish that objective.

Link to comment
Share on other sites

a program like zmodeler2 where you create models. then, you make a skin and give the model a UV Map. you model on lightbars, wheels, doors, etc. you add it to the game, and you can use the lights editor on that vehicle to put lights on a vehicle. for sirens, you need to find some american sirens and in the audio files in your mod folder in the em file, you add it and add it to the files in the editor that go with your vehicle.

Link to comment
Share on other sites

quick question:

what programming language does EM3 - EM4 use?

it looks like C++ but ive noticed it has some differences

i dont want to read this entire C++ book if its for nothing lol :P

thx

C++ programming and ofcourse its different, because Emergency 4 has C++ codes for that game only.

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