Home » Renegade Discussions » Mod Release Forum » [script]Parachute function
() 1 Vote
[script]Parachute function [message #301225] |
Wed, 05 December 2007 11:34 |
|
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 ):
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
|
|
|
|
|
[script]Parachute function
By: reborn on Wed, 05 December 2007 11:34
|
|
|
Re: Parachute function
By: Hex on Wed, 05 December 2007 11:38
|
|
|
Re: Parachute function
By: reborn on Wed, 05 December 2007 11:47
|
|
|
Re: Parachute function
|
|
|
Re: Parachute function
By: cnc95fan on Wed, 05 December 2007 11:56
|
|
|
Re: Parachute function
By: Hex on Wed, 05 December 2007 12:32
|
|
|
Re: Parachute function
By: cnc95fan on Wed, 05 December 2007 12:50
|
|
|
Re: Parachute function
By: reborn on Wed, 05 December 2007 13:19
|
|
|
Re: Parachute function
By: cnc95fan on Wed, 05 December 2007 13:31
|
|
|
Re: Parachute function
|
|
|
Re: Parachute function
|
|
|
Re: Parachute function
By: reborn on Tue, 15 January 2008 08:46
|
|
|
Re: Parachute function
|
|
|
Re: Parachute function
|
|
|
Re: Parachute function
By: reborn on Wed, 16 January 2008 20:01
|
|
|
Re: Parachute function
|
|
|
Re: Parachute function
By: reborn on Tue, 15 January 2008 10:04
|
|
|
Re: Parachute function
|
|
|
Re: Parachute function
By: reborn on Tue, 15 January 2008 10:21
|
|
|
Re: Parachute function
By: fatalcry on Tue, 15 January 2008 12:18
|
|
|
Re: Parachute function
By: jnz on Tue, 15 January 2008 12:31
|
|
|
Re: Parachute function
By: fatalcry on Wed, 16 January 2008 01:51
|
|
|
Re: Parachute function
By: Rocko on Wed, 16 January 2008 23:05
|
|
|
Re: Parachute function
By: reborn on Thu, 17 January 2008 05:43
|
|
|
Re: Parachute function
By: reborn on Thu, 17 January 2008 08:48
|
|
|
Re: Parachute function
|
|
|
Re: Parachute function
|
|
|
Re: Parachute function
|
Goto Forum:
Current Time: Fri Nov 22 11:21:33 MST 2024
Total time taken to generate the page: 0.00985 seconds
|