Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Release Forum » [script]Parachute function  () 1 Vote
[script]Parachute function [message #301225] Wed, 05 December 2007 11:34 Go to previous message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma:
General (3 Stars)
This function has not been tested very much, infact it has only been tested by me in a one man environment a few times.
The function itself I believe it pretty much ready. But attaching the script to players at the right time is not something I have done yet.
It shouldn't be too hard to do. Just get the occupants of a tranny/orca/apache on it's killed event and attach the script to the players.
I also have not been able to find a bone name that is suitable for attaching the parachute too. This is where I really hope someone might be willing to step up a little here and share some input.
You will notice in the movie that the parachute is attached tot he player, but it isn't in the right position, it's kind of at right angles to the player. I tried resolving this with various bone names and set_facing, but I havn't had much luck, maybe someone will post a helpful hint? Otherwise I will look into it further.

Here is a video of it working in-game (it's pretty funny because I forgot I left the recording of sounds option on, and you can hear me in the background make a little whoosh noise as I fall, lol Razz):

http://www.mp-gaming.com/reborn/movies/Parachute.wmv


Here is how I made it work:

(please note, I was calling the function via a chat-hook, not by exiting a vehichle. So I have set the timer to "5.0f" on the line "Commands->Start_Timer(obj,this,5.0f,1);", this really should be set to about "0.01f" for a realistic setting. otherwise it may take a few seconds for the parachute to dissapear when they land).


void reb_parachute::Created(GameObject *obj) {
//int ID = Commands->Get_ID(obj);
//float Facing = Commands->Get_Facing(obj);
Commands->Attach_Script(obj,"M00_No_Falling_Damage_DME","");
parachute = Commands->Create_Object_At_Bone(obj,"Invisible_Object", "c CHEST");
//Commands->Set_Facing(parachute,Facing);
Commands->Attach_Script(parachute,"MDB_SSGM_Destroy_When_Object_Destroyed",ToString(Commands->Get_ID(obj)).c_str());
parachuteID = Commands->Get_ID(parachute);
Commands->Set_Model(parachute, "X5D_Parachute");
Commands->Attach_To_Object_Bone(parachute, obj, "c CHEST");
position = Commands->Get_Position(obj).Z;
Commands->Start_Timer(obj,this,5.0f,1);
}
void reb_parachute::Timer_Expired(GameObject *obj, int number) {
if (number == 1) {
float position2;
position2 = Commands->Get_Position(obj).Z;

if (position2 > position){
// then they are still falling
}
else {
Commands->Destroy_Object(parachute);
Destroy_Script();
}
}
}
void reb_parachute::Killed(GameObject *obj, GameObject *shooter) {
	Destroy_Script();
}
void reb_parachute::Destroyed(GameObject *obj) {
Destroy_Script();
}


ScriptRegistrant<reb_parachute> reb_parachute_Registrant("reb_parachute","");



class reb_parachute : public ScriptImpClass {
	void Created(GameObject *obj);
	void Timer_Expired(GameObject *obj, int number);
	void Killed(GameObject *obj, GameObject *shooter);
	void Destroyed(GameObject *obj);
	int parachuteID;
	int ID;
	float position;
	GameObject *parachute;
};


Here is the chat hook i used to test the function:

class paraChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		GameObject *obj = Get_GameObj(ID);
		Commands->Attach_Script(obj,"reb_parachute","");
	}
};
ChatCommandRegistrant<paraChatCommand> paraChatCommandReg("!para",CHATTYPE_TEAM,0,GAMEMODE_AOW);


Any volunteers for writing the code to call this in the right places, such as helicopters getting destroyed and attaching it to all the players, or a key hook to eject players and attach it to them?



[Updated on: Fri, 30 January 2009 14:16] by Moderator

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [script]AirStrike function
Next Topic: [script]!sellveh
Goto Forum:
  


Current Time: Tue Nov 26 11:52:23 MST 2024

Total time taken to generate the page: 0.01846 seconds