Ga naar inhoud


Foto

Help With Scripts

Emergency 3

  • Please log in to reply
10 replies to this topic

#1 Emergency Defender

Emergency Defender

    Lieutenant

  • Members
  • 54 Posts:
  • Gender:Male
  • Location:Near Washington, D.C.

Gepost 02 februari 2008 - 10:49

: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! :)
Posted Image
Posted Image
Posted Image

#2 Emergency Defender

Emergency Defender

    Lieutenant

  • Members
  • 54 Posts:
  • Gender:Male
  • Location:Near Washington, D.C.

Gepost 20 februari 2008 - 02:53

Please help. It's getting frustrating. :machkaputt:
Posted Image
Posted Image
Posted Image

#3 Hoppah

Hoppah

    Boss cat

  • Administrators
  • 3879 Posts:
  • Gender:Male
  • Location:Special Needs Department

Gepost 20 februari 2008 - 08:08

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.

#4 Emergency Defender

Emergency Defender

    Lieutenant

  • Members
  • 54 Posts:
  • Gender:Male
  • Location:Near Washington, D.C.

Gepost 20 februari 2008 - 10:55

Thanks, but I've run into trouble. I can't get the script to be part of the mission. :machkaputt: :wall: :1046275142_sniper:
Is that done from the editor or elsewhere?
Posted Image
Posted Image
Posted Image

#5 Hoppah

Hoppah

    Boss cat

  • Administrators
  • 3879 Posts:
  • Gender:Male
  • Location:Special Needs Department

Gepost 21 februari 2008 - 08:07

Use this file: .../Specs/campaign.xml

#6 Ami89E1234

Ami89E1234

    STLMod Creator

  • Members
  • 18 Posts:
  • Gender:Male
  • Location:St. Louis, Missouri USA
  • Interests:Emergency, Modding, Girls, Video Game Creation/Playing, Baseball, Badminton, Skyrim, Girls, Band, Minecraft. Did I mention girls?

Gepost 22 februari 2008 - 06:11

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

Facepalm - Apply directly to the forehead. If it isn't a Boeing, you shouldn't be going.
"If at first you don't succeed, try, try again. If you don't try again you will be hit in the face with a shovel."

32361.png

12066.jpg

26430.png


#7 Emergency Defender

Emergency Defender

    Lieutenant

  • Members
  • 54 Posts:
  • Gender:Male
  • Location:Near Washington, D.C.

Gepost 25 maart 2008 - 09:38

What is needed to create new vehicles/units? Examples: new paint, lightbars, sirens, etc.
Posted Image
Posted Image
Posted Image

#8 Ami89E1234

Ami89E1234

    STLMod Creator

  • Members
  • 18 Posts:
  • Gender:Male
  • Location:St. Louis, Missouri USA
  • Interests:Emergency, Modding, Girls, Video Game Creation/Playing, Baseball, Badminton, Skyrim, Girls, Band, Minecraft. Did I mention girls?

Gepost 25 maart 2008 - 11:55

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.

Facepalm - Apply directly to the forehead. If it isn't a Boeing, you shouldn't be going.
"If at first you don't succeed, try, try again. If you don't try again you will be hit in the face with a shovel."

32361.png

12066.jpg

26430.png


#9 Hoppah

Hoppah

    Boss cat

  • Administrators
  • 3879 Posts:
  • Gender:Male
  • Location:Special Needs Department

Gepost 26 maart 2008 - 08:09

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.

#10 Ami89E1234

Ami89E1234

    STLMod Creator

  • Members
  • 18 Posts:
  • Gender:Male
  • Location:St. Louis, Missouri USA
  • Interests:Emergency, Modding, Girls, Video Game Creation/Playing, Baseball, Badminton, Skyrim, Girls, Band, Minecraft. Did I mention girls?

Gepost 26 maart 2008 - 07:59

thx, Hoppah :)

Facepalm - Apply directly to the forehead. If it isn't a Boeing, you shouldn't be going.
"If at first you don't succeed, try, try again. If you don't try again you will be hit in the face with a shovel."

32361.png

12066.jpg

26430.png


#11 Emergency Defender

Emergency Defender

    Lieutenant

  • Members
  • 54 Posts:
  • Gender:Male
  • Location:Near Washington, D.C.

Gepost 03 juli 2008 - 01:51

Use this file: .../Specs/campaign.xml

Thanks, man, but after a two-week course in basic C++, I now realize that I don't HAVE C++. Thanks anyway, though.
Posted Image
Posted Image
Posted Image





Also tagged with one or more of these keywords: Emergency 3