Home » Renegade Discussions » Mod Release Forum » [script]Parachute function
( ) 1 Vote
[script]Parachute function [message #301225] |
Wed, 05 December 2007 11:34 ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/3415.gif) |
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
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
|
|
|
Re: Parachute function [message #301226 is a reply to message #301225] |
Wed, 05 December 2007 11:38 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/2253.jpg) |
Hex
Messages: 858 Registered: March 2004
Karma: 0
|
Colonel |
|
|
I can help with that, we already have a paracute script on my server for flying vehicles
We had the same problem trying to get it to face the right way
goztow wrote on Tue, 11 May 2010 08:00 | If we had to ban all who ever cheated or ever created a cheat (obj3cts and such) then I don't think there would be many members left here (sad fact).
|
reborn wrote on Fri, 29 January 2010 23:37 | std is for pro's. ![Razz](images/smiley_icons/icon_razz.gif)
|
[Updated on: Wed, 05 December 2007 11:39] Report message to a moderator
|
|
|
|
|
Re: Parachute function [message #301230 is a reply to message #301225] |
Wed, 05 December 2007 12:32 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/2253.jpg) |
Hex
Messages: 858 Registered: March 2004
Karma: 0
|
Colonel |
|
|
May have a bracket missing somewere as it was pulled from one of our large plugins
Sorry I din't use your code, was just easyer to use what I already had.
//.h
class Parachute : public ScriptImpClass {
void Created(GameObject *obj);
void Damaged(GameObject *obj,GameObject *damager,float damage);
void Killed(GameObject *obj, GameObject *shooter);
void Timer_Expired(GameObject *obj,int number);
void Custom(GameObject *obj, int message, int param, GameObject *sender);
float health, fallin;
int pchuteID, floaterID;
Vector3 pos, newpos;
bool isFalling;
};
//.cpp
void ObjectHookCall(void *data,GameObject *obj) {
if (Is_Soldier(obj)) {
Attach_Script_Once(obj,"Parachute","");
}
else if (Is_Vehicle(obj)) {
if (!Is_DecorationPhys(obj) && (Get_Vehicle_Mode(obj) == FLYING)) {
Attach_Script_Once(obj,"Parachute","");
}
}
}
void Parachute::Created(GameObject *obj) {
isFalling = false;
floaterID = 0;
pchuteID = 0;
fallin = 0;
health = Commands->Get_Health(obj);
}
void Parachute::Damaged(GameObject *obj,GameObject *damager,float damage) {
if (!damager && isFalling && (damage < 1000)) {
Commands->Set_Health(obj,health);
isFalling = false;
}
else {
health = Commands->Get_Health(obj);
}
}
void Parachute::Killed(GameObject *obj, GameObject *shooter) {
if (Is_Vehicle(obj)) {
if (Commands->Get_ID(obj) && obj && As_VehicleGameObj(obj)) {
VectorClass<GameObject *> *ptr = (VectorClass<GameObject *>*)(obj+0x9AC);
VectorClass<GameObject *> occupants = (VectorClass<GameObject *>)*ptr;
int x = occupants.Length();
for (int i = 0;i < x;i++) {
if (occupants[i]) {
Commands->Send_Custom_Event(occupants[i],occupants[i],4612,0,0);
}
}
}
}
else if (Is_Soldier(obj)) {
Commands->Enable_Collisions(obj);
if (Commands->Find_Object(pchuteID)) {
Commands->Destroy_Object(Commands->Find_Object(pchuteID));
pchuteID = 0;
}
if (Commands->Find_Object(floaterID)) {
Commands->Destroy_Object(Commands->Find_Object(floaterID));
floaterID = 0;
}
isFalling = false;
}
}
void Parachute::Timer_Expired(GameObject *obj,int number) {
if (number == 1) {
newpos = Commands->Get_Position(obj);
if (newpos.Z < pos.Z) {
fallin += pos.Z - newpos.Z;
if (fallin > 10 && !isFalling) {
isFalling = true;
GameObject *floater = Commands->Create_Object("CnC_Beacon_IonCannon",Commands->Get_Position(obj));
Commands->Set_Model(floater,"null");
Commands->Set_Facing(floater,Commands->Get_Facing(obj));
GameObject *pchute = Commands->Create_Object("Generic_Cinematic",Commands->Get_Position(obj));
Commands->Set_Model(pchute,"X5D_Parachute");
Commands->Disable_All_Collisions(pchute);
Commands->Disable_Physical_Collisions(obj);
Commands->Attach_To_Object_Bone(obj,floater,"");
Commands->Attach_To_Object_Bone(pchute,obj,"");
floaterID = Commands->Get_ID(floater);
pchuteID = Commands->Get_ID(pchute);
}
pos = Commands->Get_Position(obj);
Commands->Start_Timer(obj, this, 0.1f, 1);
}
else {
Commands->Enable_Collisions(obj);
if (Commands->Find_Object(pchuteID)) {
Commands->Destroy_Object(Commands->Find_Object(pchuteID));
pchuteID = 0;
}
if (Commands->Find_Object(floaterID)) {
Commands->Destroy_Object(Commands->Find_Object(floaterID));
floaterID = 0;
}
Commands->Start_Timer(obj, this, 2.0f, 2);
}
}
else if (number == 2) {
isFalling = false;
}
}
void Parachute::Custom(GameObject *obj, int message, int param, GameObject *sender) {
if (message == CUSTOM_EVENT_VEHICLE_EXIT) {
Commands->Send_Custom_Event(sender,sender,4612,0,0);
}
else if (message == CUSTOM_EVENT_VEHICLE_ENTER) {
Commands->Send_Custom_Event(sender,sender,4613,0,0);
}
else if (message == 4612) {
health = Commands->Get_Health(obj);
fallin = 0;
pos = Commands->Get_Position(obj);
Commands->Start_Timer(obj, this, 0.1f, 1);
}
else if (message == 4613) {
isFalling = false;
if (Commands->Find_Object(pchuteID)) {
Commands->Destroy_Object(Commands->Find_Object(pchuteID));
pchuteID = 0;
}
if (Commands->Find_Object(floaterID)) {
Commands->Destroy_Object(Commands->Find_Object(floaterID));
floaterID = 0;
}
}
}
ScriptRegistrant<Parachute> Parachute_Registrant("Parachute","");
goztow wrote on Tue, 11 May 2010 08:00 | If we had to ban all who ever cheated or ever created a cheat (obj3cts and such) then I don't think there would be many members left here (sad fact).
|
reborn wrote on Fri, 29 January 2010 23:37 | std is for pro's. ![Razz](images/smiley_icons/icon_razz.gif)
|
|
|
|
|
Re: Parachute function [message #301241 is a reply to message #301225] |
Wed, 05 December 2007 13:19 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/3415.gif) |
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
Ah,thanks hex. I see what you did now. You created the object, set it's model to null, then set the facing etc etc. Pretty cool. Thankyou.
|
|
|
|
|
|
Re: Parachute function [message #311090 is a reply to message #301226] |
Tue, 15 January 2008 06:34 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/23247.jpg) |
The Elite Officer
Messages: 602 Registered: September 2007 Location: Chapel Hill, North Caroli...
Karma: 0
|
Colonel |
|
|
Ugggghhhh, that sucs. Yesterday I was playing on the C&C wittlebox server and once you got the parachute it would not go away! Even if you refill, or buy a new character, or just plain out die. The parachute stuck to you like magic gold without a home. Is there a away to get rid of it or is it just stuck with you for life like your brother's friend that you saved from death in a blazing fire from blazer and he just follows you everyewhere and he will never go away. Unless of course they see Crimsion and then they go for it. So what do you guys think??
The reason Uranus is tilted 90 degrees is because god got angry and kicked it over.....
|
|
|
|
Re: Parachute function [message #311119 is a reply to message #311106] |
Tue, 15 January 2008 09:54 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/23247.jpg) |
The Elite Officer
Messages: 602 Registered: September 2007 Location: Chapel Hill, North Caroli...
Karma: 0
|
Colonel |
|
|
^^ I was not talking about from a modders or scripters point of view. I am talking about in game, how do I get the parachute off? I mean after the messages on the wittlebox sever says that reborn help code the scripts. Great game!!!
The reason Uranus is tilted 90 degrees is because god got angry and kicked it over.....
|
|
|
Re: Parachute function [message #311126 is a reply to message #301225] |
Tue, 15 January 2008 10:04 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/3415.gif) |
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
You should be asking the server owner. I have had no direct help in the servers solution. I guess he is messaging that because he has modified some of the code posted here, I have no idea what his parachute code looks like.
|
|
|
Re: Parachute function [message #311128 is a reply to message #311126] |
Tue, 15 January 2008 10:06 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/23247.jpg) |
The Elite Officer
Messages: 602 Registered: September 2007 Location: Chapel Hill, North Caroli...
Karma: 0
|
Colonel |
|
|
Does anyone know the site of the whittlebox server?
The reason Uranus is tilted 90 degrees is because god got angry and kicked it over.....
|
|
|
Re: Parachute function [message #311133 is a reply to message #301225] |
Tue, 15 January 2008 10:21 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/3415.gif) |
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
I tested the parachute function a bit and never had that problem, so I doubt it is my code he is using (or he has modified it allot) but I don't mind helping either way if it is an issue on his server.
Your signature is quite large officier, would you mind scaling it down please?
|
|
|
|
|
|
Re: Parachute function [message #311518 is a reply to message #311106] |
Wed, 16 January 2008 19:16 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/22789.jpg) |
wittebolx
Messages: 332 Registered: May 2007 Location: the netherlands
Karma: 0
|
Recruit |
|
|
reborn wrote on Tue, 15 January 2008 16:46 | Commands->Destroy_Object(parachute);
He is doing something worng...
|
1. the parachute script in the C&C Server thats you can use with !para is Reborn's Script. (facing bugged and indeed the parachute wont always go away.
2. since Hex made his Parachute working with facing etc etc, i tried to compile it and i added a chat hook for testing !para (just replaced the other !para command)
regarding 2. : the parachute wont appear. (doesnt work)
reborn: he is doing something wrong..
what do you mean by this?
http://www.wittebolx.com
|
|
|
Re: Parachute function [message #311534 is a reply to message #311518] |
Wed, 16 January 2008 20:01 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/3415.gif) |
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
wittebolx wrote on Wed, 16 January 2008 21:16 |
reborn wrote on Tue, 15 January 2008 16:46 | Commands->Destroy_Object(parachute);
He is doing something worng...
|
1. the parachute script in the C&C Server thats you can use with !para is Reborn's Script. (facing bugged and indeed the parachute wont always go away.
2. since Hex made his Parachute working with facing etc etc, i tried to compile it and i added a chat hook for testing !para (just replaced the other !para command)
regarding 2. : the parachute wont appear. (doesnt work)
reborn: he is doing something wrong..
what do you mean by this?
|
That code was to show you how to make the parachute attach to a player and recognise when they have stopped falling. It was never meant to be a chat hook like that. You were supposed to attach the script to the player when they are ejected from a chin00k or whatever...
But yes, the facing is set-up wrong, I did fix this later on after I first posted, but I cannot locate the code atm. Under what conditions does the parachute not dissapear?
|
|
|
Re: Parachute function [message #311553 is a reply to message #301225] |
Wed, 16 January 2008 23:05 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
Rocko
Messages: 833 Registered: January 2007 Location: Long Beach, California
Karma: 0
|
Colonel |
|
|
didn't black cell already have some parachute mod?
shame they're selfish fags tho
black and proud
|
|
|
Re: Parachute function [message #311594 is a reply to message #311553] |
Thu, 17 January 2008 05:43 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/3415.gif) |
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
Rocko wrote on Thu, 17 January 2008 01:05 | didn't black cell already have some parachute mod?
shame they're selfish fags tho
|
I have read all your posts and threads and really cannot tell if you're an idiot or a very clever troll.
I've never really replied to you, but you bring out the worst in me, I guess that's what you want.
Just for the record, http://www.black-cell.net have contributed more to the community then anyone else has. They are followed closely by other groups, but I believe they've done the most.
|
|
|
Re: Parachute function [message #311605 is a reply to message #311534] |
Thu, 17 January 2008 06:50 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/22789.jpg) |
wittebolx
Messages: 332 Registered: May 2007 Location: the netherlands
Karma: 0
|
Recruit |
|
|
reborn wrote on Thu, 17 January 2008 04:01 |
wittebolx wrote on Wed, 16 January 2008 21:16 |
reborn wrote on Tue, 15 January 2008 16:46 | Commands->Destroy_Object(parachute);
He is doing something worng...
|
1. the parachute script in the C&C Server thats you can use with !para is Reborn's Script. (facing bugged and indeed the parachute wont always go away.
2. since Hex made his Parachute working with facing etc etc, i tried to compile it and i added a chat hook for testing !para (just replaced the other !para command)
regarding 2. : the parachute wont appear. (doesnt work)
reborn: he is doing something wrong..
what do you mean by this?
|
That code was to show you how to make the parachute attach to a player and recognise when they have stopped falling. It was never meant to be a chat hook like that. You were supposed to attach the script to the player when they are ejected from a chin00k or whatever...
But yes, the facing is set-up wrong, I did fix this later on after I first posted, but I cannot locate the code atm. Under what conditions does the parachute not dissapear?
|
i cant find to code either.
about the conditions: like when i am at ground and use !para it appears ok (facing..not ok) when im walking etc and getting in a orca or whatever and eject from it in the sky, the parachute does its job, im not being killed, but when i hit the ground it stays on me. if i use the commmand when im on a building and jump, all goes ok and the parachute disappears when i hit the ground.
it seems it works ok if i fall withing a few seconds after i use the command, but wont work if i fall some minutes after i used the command.
http://www.wittebolx.com
|
|
|
Re: Parachute function [message #311624 is a reply to message #301225] |
Thu, 17 January 2008 08:48 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to previous message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/3415.gif) |
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
Right ok, I will see what I can do to locate the problem. But in actual fact you should not really be able to attach the script to the player with a chat hook. I thought you would attach it to the player when they exit a vehichle and the vehichle preset name equals cnc_GDI_orca or whatever...
If I have time I will write the rest and post it here.
|
|
|
Goto Forum:
Current Time: Tue Sep 03 16:36:04 MST 2024
Total time taken to generate the page: 0.01220 seconds
|