Jump to content
DAMSurvivor

Start a Controlled event (hostage situation) manually PLZ Help

Recommended Posts

I pulled this straight out of Bieberfelde so 100% of the credit on this one goes to them, however if you put this script in your game and assign the command GenRD to a person, when you click the button a random EMS call happens. Essentially your game finds a random Ped and basically kills them... 

 

Again, I didn't come up with this, I just dug through what they had because I remember there being a menu where you could spawn all sorts of calls. And I'm pretty sure they wouldn't want anyone to publish this into their mod without permission/crediting at the very least. Pretty cool script though!

 

object GenRD : CommandScript//Zufälliger RD einsatz
{
	GenRD()
	{
		SetIcon("heal");
		SetRestrictions(RESTRICT_SELFEXECUTE);
	}

	bool CheckTarget(GameObject *Caller, Actor *Target, int linie)
	{
		return Caller->GetID()==Target->GetID();
	}

	void PushActions(GameObject *Caller, Actor *Target, int ChildID)
	{
		System::Log("GenRD");
		if(Mission::GetCounter("Injured Persons")<11){
			PersonList pl(ROLE_CIVILIAN);
			Person opfer;
			int oid=Math::rand()%(pl.GetNumPersons()*2/3);
			for(int i=0;i<pl.GetNumPersons()&&oid>-1;i++){
				if(!pl.GetPerson(i)->IsDead()&&!pl.GetPerson(i)->IsInjured()&&pl.GetPerson(i)->IsInsideMap()){
					if(oid==0){opfer=Person(pl.GetPerson(i));oid--;
					}else oid--;
				}
			}
			int id=-1;
			int zu=Math::rand()%6;
			switch(zu){
				case 0:
					Mission::PlayComment("ID_SUPERV_EVENT21"); 
					id=Game::ShowEvent("ID_FREEPLAY_EVENT_HEARTATTACK", opfer.GetPosition());
					break;
				case 1:
					Mission::PlayComment("ID_SUPERV_EVENT17");
					id=Game::ShowEvent("ID_FREEPLAY_EVENT_FALL", opfer.GetPosition());
					break;
				case 2:
					Mission::PlayComment("ID_SUPERV_EVENT19");
					id=Game::ShowEvent("ID_FREEPLAY_EVENT_CIRCULATORY_COLLAPSE", opfer.GetPosition());
					break;
				case 3:
					Mission::PlayComment("ID_SUPERV_EVENT20");
					id=Game::ShowEvent("ID_FREEPLAY_EVENT_FOOD_POISONING", opfer.GetPosition());
					break;
				case 4:
					Mission::PlayComment("ID_SUPERV_EVENT18");
					id=Game::ShowEvent("ID_FREEPLAY_EVENT_SHOCK", opfer.GetPosition());
					break;
				case 5:
					Mission::PlayComment("ID_SUPERV_EVENT22");
					id=Game::ShowEvent("ID_FREEPLAY_EVENT_STROKE", opfer.GetPosition());
					break;
			}
			char nam[10];snprintf(nam,10,"%i",id);
			Person on=Game::CreatePerson(opfer.GetPrototypeFileName(),nam);
			on.SetEnteredHouseID(opfer.GetEnteredHouseID());
			on.SetPosition(opfer.GetPosition());
			opfer.PushActionDeleteOwner(ACTION_NEWLIST);
			on.AssignCommand("GenRD");
			on.Injure(INJUREREASON_UNKNOWN, false);
			on.SetLife(Math::rand()%900+100);
			on.SetInjuredLifeDrain(Math::rand()%4);
		}
	}
};

 

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