Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » jfw_attach_script_vehicle_created
- jfw_attach_script_vehicle_created [message #446683] Sun, 08 May 2011 03:52 Go to next message
robbyke is currently offline  robbyke
Messages: 348
Registered: September 2010
Location: Belgium
Karma: 0
Recruit
jfw_attach_script_vehicle_created

id like to use this but i have no clue how does anyone has an example or something?


Owner of kambot TT server

kambot.freeforums.org
- Re: jfw_attach_script_vehicle_created [message #446684 is a reply to message #446683] Sun, 08 May 2011 04:04 Go to previous messageGo to next message
ExEric3 is currently offline  ExEric3
Messages: 746
Registered: February 2005
Location: Slovakia
Karma: 0
Colonel
From readme.txt in scripts344.zip:

JFW_Attach_Script_Vehicle_Created (attaches a script to all objects vehicles when they are created)
	Script (script to attach)
	Params (parameters to use)
	Delim (delimiter, anytime you see this in the "params" string it will be replaced with a comma)
	Player_Type (what player type to attach to, 0 = Nod, 1 = GDI, 2 = any)
Note that all the _Created scripts won't trigger for objects that are placed on the map at startup, only for those created by the game
This includes the players, vehicles they buy, harvesters etc but not preplaced things like the building controlers.
Although there are a few instances where the Object Create Hook might not trip (e.g. certain spawner objects). This is because those objects don't
call through to ScriptableGameObj::Start_Observers (the place where the scripts get started up and the place I am hooking)
- Re: jfw_attach_script_vehicle_created [message #446687 is a reply to message #446683] Sun, 08 May 2011 04:09 Go to previous messageGo to next message
robbyke is currently offline  robbyke
Messages: 348
Registered: September 2010
Location: Belgium
Karma: 0
Recruit
I do read the readme Wink

but that doesnt explain me how i use it only how it works i need to know:

Do i have to attach it to something or do i have to call it as if its a function if so how?

edit:

ive found another way but if i would still like to know for future uses Wink


Owner of kambot TT server

kambot.freeforums.org

[Updated on: Sun, 08 May 2011 04:13]

Report message to a moderator

- Re: jfw_attach_script_vehicle_created [message #446707 is a reply to message #446683] Sun, 08 May 2011 11:56 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
look at scripts 344 source. Code explains itself.

http://s18.postimage.org/jc6qbn4k9/bricks3.png
- Re: jfw_attach_script_vehicle_created [message #446766 is a reply to message #446683] Mon, 09 May 2011 02:30 Go to previous messageGo to next message
zunnie is currently offline  zunnie
Messages: 2959
Registered: September 2003
Location: Netherlands
Karma: 0
General (2 Stars)

Put the script on a daves arrow for example

Attach_Script_Is_Type(obj,Vehicle,script,params,Get_Int_Parameter("Player_Type"));


It attaches the script on all vehicles that are created on the daves arrows ::Created event


https://multiplayerforums.com/uploads/monthly_2018_03/TCW2_Signature.png.6236a0dbc6e1e53472a18fe8cd15e47b.png

[Updated on: Mon, 09 May 2011 02:33]

Report message to a moderator

- Re: jfw_attach_script_vehicle_created [message #446767 is a reply to message #446683] Mon, 09 May 2011 02:47 Go to previous messageGo to next message
robbyke is currently offline  robbyke
Messages: 348
Registered: September 2010
Location: Belgium
Karma: 0
Recruit
OK thnx exactly what i needed to know so i only have to attach it to an object like a normal script

Owner of kambot TT server

kambot.freeforums.org
- Re: jfw_attach_script_vehicle_created [message #446770 is a reply to message #446683] Mon, 09 May 2011 02:52 Go to previous messageGo to next message
zunnie is currently offline  zunnie
Messages: 2959
Registered: September 2003
Location: Netherlands
Karma: 0
General (2 Stars)

Note that this script does not attach the script to vehicles created later in the game.
So say a vehicle is created 5 mins into the game, the script will not be attached to it.
You must modify the script and include a timer and loop checking for vehs.

IE something like this:

void JFW_Attach_Script_Vehicle_Created::ObjectCreateHook(GameObject *obj)
{
	const char *script;
	const char *paramx;
	char *params;
	char delim;
	script = Get_Parameter("Script");
	paramx = Get_Parameter("Params");
	params = newstr(paramx);
	delim = Get_Parameter("Delim")[0];
	unsigned int x = strlen(params);
	for (unsigned int i=0;i<x;i++)
	{
		if (params[i] == delim)
		{
			params[i] = ',';
		}
	}
	Attach_Script_Is_Type(obj,Vehicle,script,params,Get_Int_Parameter("Player_Type"));
	delete[] params;
	Commands->Start_Timer(obj,this,1.0f,1000);
}
void JFW_Attach_Script_Vehicle_Created::Timer_Expired(GameObject *obj, int number)
{
	if (number == 1000)
	{
		const char *script;
		const char *paramx;
		char *params;
		char delim;
		script = Get_Parameter("Script");
		paramx = Get_Parameter("Params");
		params = newstr(paramx);
		delim = Get_Parameter("Delim")[0];
		unsigned int x = strlen(params);
		for (unsigned int i=0;i<x;i++)
		{
			if (params[i] == delim)
			{
				params[i] = ',';
			}
		}
		Attach_Script_Is_Type(obj,Vehicle,script,params,Get_Int_Parameter("Player_Type"));
		delete[] params;
		Commands->Start_Timer(obj,this,1.0f,1000);
	}
}


https://multiplayerforums.com/uploads/monthly_2018_03/TCW2_Signature.png.6236a0dbc6e1e53472a18fe8cd15e47b.png

[Updated on: Mon, 09 May 2011 02:53]

Report message to a moderator

- Re: jfw_attach_script_vehicle_created [message #446771 is a reply to message #446683] Mon, 09 May 2011 02:56 Go to previous messageGo to next message
robbyke is currently offline  robbyke
Messages: 348
Registered: September 2010
Location: Belgium
Karma: 0
Recruit
doesnt it just attach a script to veh as soon as it it created?

Owner of kambot TT server

kambot.freeforums.org
- Re: jfw_attach_script_vehicle_created [message #446772 is a reply to message #446683] Mon, 09 May 2011 02:57 Go to previous messageGo to next message
zunnie is currently offline  zunnie
Messages: 2959
Registered: September 2003
Location: Netherlands
Karma: 0
General (2 Stars)

ONly at mapload, not at later times into the game, unless you modify the code like i showed you.

https://multiplayerforums.com/uploads/monthly_2018_03/TCW2_Signature.png.6236a0dbc6e1e53472a18fe8cd15e47b.png
- Re: jfw_attach_script_vehicle_created [message #446773 is a reply to message #446683] Mon, 09 May 2011 02:59 Go to previous message
robbyke is currently offline  robbyke
Messages: 348
Registered: September 2010
Location: Belgium
Karma: 0
Recruit
ok thnx

Owner of kambot TT server

kambot.freeforums.org
Previous Topic: modifying weapons&ammos with serverside scripts.dll
Next Topic: level load
Goto Forum:
  


Current Time: Sat Dec 21 07:27:43 MST 2024

Total time taken to generate the page: 0.01100 seconds