!para [message #471168] |
Wed, 11 July 2012 04:47 |
|
Distrbd21
Messages: 743 Registered: September 2008
Karma: 0
|
Colonel |
|
|
I'm trying to get it to work with 4.0, but I don't know exactly what I have done wrong.
The server doesn't crash when I do !para or when I get out of a veh, nothing happens I still die ;p
void ObjectHookCall(void *data,GameObject *obj) {
if (obj->As_SoldierGameObj()) {
Attach_Script_Once(obj,"Parachute","");
}
else if (obj->As_VehicleGameObj()) {
if (obj->As_PhysicalGameObj() && (Get_Vehicle_Mode(obj) == VEHICLE_TYPE_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 (obj->As_VehicleGameObj()) {
if (Commands->Get_ID(obj) && obj && obj->As_VehicleGameObj()) {
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 (obj->As_SoldierGameObj()) {
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_EXITED) {
Commands->Send_Custom_Event(sender,sender,4612,0,0);
}
else if (message == CUSTOM_EVENT_VEHICLE_ENTERED) {
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;
}
}
}
Live Your Life Not Some one Else's.| Sharing Is Caring
Cookie Jar<glome> Who stole the cookie from the cookie jar?!
<content> glome stole the cookie from the cookie jar!
<glome> Who me?!
<content> Yes you!
<glome> Couldn't be!
<content> Then WHO?!!
<glome> Woody stole the cookie from the cookie jar!
*** glome has been kicked by DrWoody (fuck you i didn't touch the motherfucking cookie, bitch
Suicide<TB> I was depressed last night so I called the Suicide Life Line.
<TB> I reached a call center in Pakistan.
<TB> I told them I was suicidal.
<TB> They got all excited and asked if I could drive a truck
|
|
|
|
Re: !para [message #471227 is a reply to message #471168] |
Wed, 11 July 2012 10:53 |
|
Distrbd21
Messages: 743 Registered: September 2008
Karma: 0
|
Colonel |
|
|
My test server is hooked to debug, but I'm having problems with it not copying over the sciprts.dll to the server folder.
The script is suppost to auto deploy your parachute if you exit the veh in mid air, or if your veh is killed mid air, I was also trying to make it work with !para, so I didn't have to have 2 scripts.
Most of it is to get the parachute to be placed in the right facing on your back.
EDIT: My guess is I don't have the As_ stuff right, as I don't know it all that well.
Live Your Life Not Some one Else's.| Sharing Is Caring
Cookie Jar<glome> Who stole the cookie from the cookie jar?!
<content> glome stole the cookie from the cookie jar!
<glome> Who me?!
<content> Yes you!
<glome> Couldn't be!
<content> Then WHO?!!
<glome> Woody stole the cookie from the cookie jar!
*** glome has been kicked by DrWoody (fuck you i didn't touch the motherfucking cookie, bitch
Suicide<TB> I was depressed last night so I called the Suicide Life Line.
<TB> I reached a call center in Pakistan.
<TB> I told them I was suicidal.
<TB> They got all excited and asked if I could drive a truck
[Updated on: Wed, 11 July 2012 10:55] Report message to a moderator
|
|
|
Re: !para [message #471228 is a reply to message #471168] |
Wed, 11 July 2012 10:55 |
iRANian
Messages: 4308 Registered: April 2011
Karma: 0
|
General (4 Stars) |
|
|
Hex' script doesn't require you to type !para, the reason it's not doing anything is because you forgot the scriptregistrant line.
Long time and well respected Renegade community member, programmer, modder and tester.
Scripts 4.0 private beta tester since May 2011.
My Renegade server plugins releases
|
|
|
Re: !para [message #471230 is a reply to message #471228] |
Wed, 11 July 2012 10:56 |
|
Distrbd21
Messages: 743 Registered: September 2008
Karma: 0
|
Colonel |
|
|
iRANian wrote on Wed, 11 July 2012 12:55 | Hex' script doesn't require you to type !para, the reason it's not doing anything is because you forgot the scriptregistrant line.
|
no thats there at the bottum...
ScriptRegistrant<Parachute> Parachute_Registrant("Parachute","");
Live Your Life Not Some one Else's.| Sharing Is Caring
Cookie Jar<glome> Who stole the cookie from the cookie jar?!
<content> glome stole the cookie from the cookie jar!
<glome> Who me?!
<content> Yes you!
<glome> Couldn't be!
<content> Then WHO?!!
<glome> Woody stole the cookie from the cookie jar!
*** glome has been kicked by DrWoody (fuck you i didn't touch the motherfucking cookie, bitch
Suicide<TB> I was depressed last night so I called the Suicide Life Line.
<TB> I reached a call center in Pakistan.
<TB> I told them I was suicidal.
<TB> They got all excited and asked if I could drive a truck
|
|
|
Re: !para [message #471232 is a reply to message #471168] |
Wed, 11 July 2012 11:10 |
iRANian
Messages: 4308 Registered: April 2011
Karma: 0
|
General (4 Stars) |
|
|
if (obj->As_PhysicalGameObj() && (Get_Vehicle_Mode(obj) == VEHICLE_TYPE_FLYING)) {
the As_PhysicalGameObj() call is redundant.
Long time and well respected Renegade community member, programmer, modder and tester.
Scripts 4.0 private beta tester since May 2011.
My Renegade server plugins releases
|
|
|
|
Re: !para [message #471365 is a reply to message #471168] |
Wed, 11 July 2012 19:24 |
|
You need to replace that blob of code (with the 0x9AC thing) with calls to ->Get_Occupant_Count() and ->Get_Occupant()
Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
|
|
|
Re: !para [message #471396 is a reply to message #471264] |
Thu, 12 July 2012 02:47 |
|
Distrbd21
Messages: 743 Registered: September 2008
Karma: 0
|
Colonel |
|
|
Xpert wrote on Wed, 11 July 2012 15:58 | Commands->Is_A_Star(obj) instead of (obj->As_SoldierGameObj())
|
so like this?
void ObjectHookCall(void *data,GameObject *obj) {
if (Commands->Is_A_Star(obj)) {
Attach_Script_Once(obj,"Parachute","");
}
else if (obj->As_VehicleGameObj()) {
Attach_Script_Once(obj,"Parachute","");
}
}
And this one is built into gmgame, and ssgm.
@ Iran so just take it out right?
@ Jonwil, Can you explain a little more?
This is what I did to replace it not sure if it's right or not.
void Parachute::Killed(GameObject *obj, GameObject *shooter) {
if (obj->As_VehicleGameObj()->Get_Occupant()) {
if (obj->As_VehicleGameObj()->Get_Occupant_Count()) {
}
else if (Commands->Is_A_Star(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;
}
}
Live Your Life Not Some one Else's.| Sharing Is Caring
Cookie Jar<glome> Who stole the cookie from the cookie jar?!
<content> glome stole the cookie from the cookie jar!
<glome> Who me?!
<content> Yes you!
<glome> Couldn't be!
<content> Then WHO?!!
<glome> Woody stole the cookie from the cookie jar!
*** glome has been kicked by DrWoody (fuck you i didn't touch the motherfucking cookie, bitch
Suicide<TB> I was depressed last night so I called the Suicide Life Line.
<TB> I reached a call center in Pakistan.
<TB> I told them I was suicidal.
<TB> They got all excited and asked if I could drive a truck
|
|
|
Re: !para [message #471798 is a reply to message #471168] |
Tue, 17 July 2012 06:03 |
|
Distrbd21
Messages: 743 Registered: September 2008
Karma: 0
|
Colonel |
|
|
bump been few days...
Live Your Life Not Some one Else's.| Sharing Is Caring
Cookie Jar<glome> Who stole the cookie from the cookie jar?!
<content> glome stole the cookie from the cookie jar!
<glome> Who me?!
<content> Yes you!
<glome> Couldn't be!
<content> Then WHO?!!
<glome> Woody stole the cookie from the cookie jar!
*** glome has been kicked by DrWoody (fuck you i didn't touch the motherfucking cookie, bitch
Suicide<TB> I was depressed last night so I called the Suicide Life Line.
<TB> I reached a call center in Pakistan.
<TB> I told them I was suicidal.
<TB> They got all excited and asked if I could drive a truck
|
|
|
|
|
|
|
|
|