Jump to content
Dyson

Script Help Needed - Basic script writing

Recommended Posts

I've changed this topic rather than create a new one.

 

Here I have a script I have written, it sends a vehicle to a specific spot, waits then sends the vehicle back to its parking spot (using the LAToFirestation script)

 

However,

a) It wont execute the command return to station, but doesn't give a script error, I believe I labelled it correctly in the constant characters. So anyone who can assist with that. RESOLVED

 

b) I want to assign pushactions to the members of the rig. The first 3 people to get out: push action leave car or whatever it is. Then the first guy to execute a command script I had written to block the road, the second to execute a command for blocking peds at the left and the third at the right.

 

I originally tried using the rapid deploy push actions adjusted for these commands, but I got syntax error. So I tried writing it myself a few times, but everytime syntax. So any help would be massively appreciated!

 

I hope this was all clear, it was rather hard to explain.

 

Anyway here's my current script that I wish to add the above to.

 

//******************************************************************************************//		-Script by Dyson//		-Use of this script is welcomed in any mod with credit//		-PartofBlockScript////////****************************************************************************************** const char IMG[] = "tofirestation"; const char PROTO_SCBA[] = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt_scba.e4p"; const char PROTO_FF[] = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt.e4p";  const char PROTO_SCBA2[] = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt_2_scba.e4p"; const char PROTO_FF2[] = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt2.e4p";  const char PROTO_SCBA3[] = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt_3_scba.e4p"; const char PROTO_FF3[] = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt3.e4p";  const char PROTO_SCBA4[] = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt_4_scba.e4p"; const char PROTO_FF4[] = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt4.e4p";  const char PROTO_SCBA5[] = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt_5_scba.e4p"; const char PROTO_FF5[] = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt5.e4p";  const char PROTO_SCBA6[] = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt_6_scba.e4p"; const char PROTO_FF6[] = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt6.e4p";  const char PROTO_NB1[] = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt_nohelmet.e4p"; const char PROTO_NB2[] = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt_2_nohelmet.e4p"; const char PROTO_NB3[] = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt_3_nohelmet.e4p"; const char PROTO_NB4[] = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt_4_nohelmet.e4p"; const char PROTO_NB5[] = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt_5_nohelmet.e4p"; const char PROTO_NB6[] = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt_6_nohelmet.e4p";const char DUMMY_BLOCK1[]			= "DummyBlock1";const char DUMMY_BLOCK2[]			= "DummyBlock2";const char DUMMY_BLOCK3[]			= "DummyBlock3";const char PARK_UP[]				= "VcmdToFireStation";const char MOVE_TO[]				= "DummyMoveToMidtown";const char VO_MP1[] 				= "MidtownPark1";const char VO_MP2[] 				= "MidtownPark2"; int AGT = 3;  object MidtownParkAndBlock : CommandScript { 	MidtownParkAndBlock() 	{ 		SetIcon(IMG); 		SetCursor(IMG); 		SetRestrictions(RESTRICT_SELFEXECUTE); 	} 	bool CheckPossible(GameObject *Caller) 	{ 		if (!Caller->IsValid()) 			return false;  		if (Caller->GetType() == ACTOR_VEHICLE) 		{ 			return true; 		}  		return false; 	} 	bool CheckTarget(GameObject *Caller, Actor *Target, int childID) 	{ 		if (!Caller->IsValid() || !Target->IsValid() || Target->GetID() != Caller->GetID()) 			return false;  		if (Caller->GetType() == ACTOR_VEHICLE) 		{ 			return true; 		}  		return true; 	}	void PushActions(GameObject *Caller, Actor *Target, int childID) 	{		Caller->PushActionExecuteCommand(ACTION_APPEND, MOVE_TO, Target, 1, false); 	}	 };object DummyMoveToMidtown : CommandScript{	DummyMoveToMidtown()	{	}	bool CheckTarget(GameObject *Caller, Actor *Target, int childID)	{	}	void PushActions(GameObject *Caller, Actor *Target, int childID)	{		Vehicle v(Caller);		{			ActorList l1 = Game::GetActors(VO_MP1);			ActorList l2 = Game::GetActors(VO_MP2);		}				if(l1.GetNumActors() > 0)			Vector MoveTo = l1.GetActor(0)->GetPosition();		if(l2.GetNumActors() > 0)			Vector TurnTo = l2.GetActor(0)->GetPosition();		{		v.PushActionMove(ACTION_NEWLIST, MoveTo);		v.PushActionTurnTo(ACTION_APPEND, TurnTo);            	v.SetSpeed(2.0);		v.PushActionWait(ACTION_APPEND, 12.5f);		v.PushActionExecuteCommand(ACTION_APPEND, PARK_UP, Target, 1, false);		}	}};

 

Link to comment
Share on other sites

Hey Dyson,

 

Though I'm hardly a modding expert (especially compared to you!), this is something I've looked in to before. Equipment is the only Command Group category, as far as I can tell. It may be possible to create a new custom command group (perhaps just write it into a couple of scripts and create the UI for it?) but I haven't tried that yet.

 

Failing that, I would suggest the next best alternative is to create a script that, when the command is activated ingame, removes all scripts from the caller and then assigns a bunch of new ones, including a back/cancel icon button which 'resets' to the normal scripts again. For example, a script of 'useradio' which removes all commands and then assigns all radio related commands, with a 'back' button to revert back to normal commands. I hope I've explained it well enough to make sense. Take a look at an existing script, for example CallOutMainMenu from Copenhagen Mod 1.1, which I believe does what I'm trying to describe. :)

Link to comment
Share on other sites

Hey Dyson,

 

Though I'm hardly a modding expert (especially compared to you!), this is something I've looked in to before. Equipment is the only Command Group category, as far as I can tell. It may be possible to create a new custom command group (perhaps just write it into a couple of scripts and create the UI for it?) but I haven't tried that yet.

 

Failing that, I would suggest the next best alternative is to create a script that, when the command is activated ingame, removes all scripts from the caller and then assigns a bunch of new ones, including a back/cancel icon button which 'resets' to the normal scripts again. For example, a script of 'useradio' which removes all commands and then assigns all radio related commands, with a 'back' button to revert back to normal commands. I hope I've explained it well enough to make sense. Take a look at an existing script, for example CallOutMainMenu from Copenhagen Mod 1.1, which I believe does what I'm trying to describe. :)

Yes your comment about the main menu script made perfect sense, I was thinking something similar. However the main function of the script I wish to write is to speedly deploy people to fixed positions (see my last post in my Manhattan topic). So to first have to go through a separate menu would render this process moot, as it would take just as long! haha

 

But I shall dabble, I was hoping to hear of people's efforts such as yourself before plunging into it, hopefully I'll hear some more insight :)

 

But thanks for the comments!

 

x

Link to comment
Share on other sites

Ah yes, I saw the video of what you're trying to do. Good luck with this - if you crack it, it'll be a pretty amazing addition :)

 

Could you perhaps assign the script to the firehouse control panel which checks for any free FFs within the station, or spawns them in, and then sends one FF to point A, one to point B, then activate their commands, etc? This would save the need to click each firefighter and then each command. I'm thinking similar function to Hoppah's firestation person spawning script.

Link to comment
Share on other sites

Yes your comment about the main menu script made perfect sense, I was thinking something similar. However the main function of the script I wish to write is to speedly deploy people to fixed positions (see my last post in my Manhattan topic). So to first have to go through a separate menu would render this process moot, as it would take just as long! haha

 

But I shall dabble, I was hoping to hear of people's efforts such as yourself before plunging into it, hopefully I'll hear some more insight :)

 

But thanks for the comments!

 

x

So to use them to deploy the trucks from station?

Why not put master script that calls the other scripts on alarm panel by the station?  Even if you can not combine them putting them there at least would not take up all command space on the person. 

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