Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » !para
!para [message #471168] Wed, 11 July 2012 04:47 Go to next message
Distrbd21 is currently offline  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

http://dsgaming.us/distrbd21/Distrbd21%20siggy.png

Cookie Jar

Suicide
Re: !para [message #471219 is a reply to message #471168] Wed, 11 July 2012 10:06 Go to previous messageGo to next message
Ethenal is currently offline  Ethenal
Messages: 2532
Registered: January 2007
Location: US of A
Karma: 0
General (2 Stars)

Christ, that's way more confusing than the last parachute script I saw... do you know how to attach a debugger to server.exe? If you do that, you can probably step through your code and eventually figure out what's not working, but I can't gather a thing from that source.

-TLS-DJ-EYE-K wrote on Mon, 18 March 2013 07:29

Instead of showing us that u aren't more inteligent than a Toast, maybe you should start becomming good in renegade Thumbs Up

Re: !para [message #471227 is a reply to message #471168] Wed, 11 July 2012 10:53 Go to previous messageGo to next message
Distrbd21 is currently offline  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

http://dsgaming.us/distrbd21/Distrbd21%20siggy.png

Cookie Jar

Suicide

[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 Go to previous messageGo to next message
iRANian is currently offline  iRANian
Messages: 4300
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 Go to previous messageGo to next message
Distrbd21 is currently offline  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

http://dsgaming.us/distrbd21/Distrbd21%20siggy.png

Cookie Jar

Suicide
Re: !para [message #471232 is a reply to message #471168] Wed, 11 July 2012 11:10 Go to previous messageGo to next message
iRANian is currently offline  iRANian
Messages: 4300
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 #471264 is a reply to message #471168] Wed, 11 July 2012 13:58 Go to previous messageGo to next message
Xpert is currently offline  Xpert
Messages: 1588
Registered: December 2005
Location: New York City
Karma: 0
General (1 Star)
Commands->Is_A_Star(obj) instead of (obj->As_SoldierGameObj())


Funny, I was gonna release a parachute plugin using this script.


Quote:


VectorClass<GameObject *> *ptr = (VectorClass<GameObject *>*)(obj+0x9AC);
VectorClass<GameObject *> occupants = (VectorClass<GameObject *>)*ptr;




This will crash in 4.0


http://i32.photobucket.com/albums/d42/XpertMaverick/xpertyankee.jpg

Creator of NetGuard, an IRC network regulator.
Developer of the CloudyServ 0.982-X project.
Developer of the CloudyServ Ren-X bot.

Part time streamer - https://twitch.tv/gg_wonder
Re: !para [message #471365 is a reply to message #471168] Wed, 11 July 2012 19:24 Go to previous messageGo to next message
jonwil is currently offline  jonwil
Messages: 3556
Registered: February 2003
Karma: 0
General (3 Stars)

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 Go to previous messageGo to next message
Distrbd21 is currently offline  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

http://dsgaming.us/distrbd21/Distrbd21%20siggy.png

Cookie Jar

Suicide
Re: !para [message #471798 is a reply to message #471168] Tue, 17 July 2012 06:03 Go to previous messageGo to next message
Distrbd21 is currently offline  Distrbd21
Messages: 743
Registered: September 2008
Karma: 0
Colonel

bump been few days...

Live Your Life Not Some one Else's.| Sharing Is Caring

http://dsgaming.us/distrbd21/Distrbd21%20siggy.png

Cookie Jar

Suicide
Re: !para [message #471812 is a reply to message #471168] Tue, 17 July 2012 10:13 Go to previous messageGo to next message
Ethenal is currently offline  Ethenal
Messages: 2532
Registered: January 2007
Location: US of A
Karma: 0
General (2 Stars)

Did you not compile it with their changes and try again?

-TLS-DJ-EYE-K wrote on Mon, 18 March 2013 07:29

Instead of showing us that u aren't more inteligent than a Toast, maybe you should start becomming good in renegade Thumbs Up

Re: !para [message #471821 is a reply to message #471168] Tue, 17 July 2012 11:51 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
You should fix the facing of the parachute and when a player get's killed when falling. I have no use for this I just wanted to test it out. I remember when hex posted this a long time ago. Script should be remade.

Parachute 4.0 Plugin



http://s18.postimage.org/jc6qbn4k9/bricks3.png
Re: !para [message #472027 is a reply to message #471168] Fri, 20 July 2012 10:40 Go to previous messageGo to next message
iRANian is currently offline  iRANian
Messages: 4300
Registered: April 2011
Karma: 0
General (4 Stars)
What's wrong with the parachute facing? I'll release it as a plugin and add an option to have infantry parachutes.

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

[Updated on: Fri, 20 July 2012 10:47]

Report message to a moderator

Re: !para [message #472028 is a reply to message #471168] Fri, 20 July 2012 10:53 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
Last time i looked at it, it looked like the para was facing the player's side.

http://s18.postimage.org/jc6qbn4k9/bricks3.png
Re: !para [message #472029 is a reply to message #472028] Fri, 20 July 2012 12:09 Go to previous messageGo to next message
Xpert is currently offline  Xpert
Messages: 1588
Registered: December 2005
Location: New York City
Karma: 0
General (1 Star)
jonwil wrote on Wed, 11 July 2012 22:24

You need to replace that blob of code (with the 0x9AC thing) with calls to ->Get_Occupant_Count() and ->Get_Occupant()



VectorClass<GameObject *>& occupants = *(VectorClass<GameObject *>*)((char*)obj+0x9AC);

Gen_Blacky wrote on Fri, 20 July 2012 13:53

Last time i looked at it, it looked like the para was facing the player's side.


It does I think.


http://i32.photobucket.com/albums/d42/XpertMaverick/xpertyankee.jpg

Creator of NetGuard, an IRC network regulator.
Developer of the CloudyServ 0.982-X project.
Developer of the CloudyServ Ren-X bot.

Part time streamer - https://twitch.tv/gg_wonder
Re: !para [message #472030 is a reply to message #471168] Fri, 20 July 2012 13:15 Go to previous message
iRANian is currently offline  iRANian
Messages: 4300
Registered: April 2011
Karma: 0
General (4 Stars)
nope it doesn't, blacky showed me a screenshot of it like an hour ago

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
Previous Topic: set object type for vehicles
Next Topic: Get_Damage_Bone_Name
Goto Forum:
  


Current Time: Sat Jul 13 18:16:38 MST 2024

Total time taken to generate the page: 0.00868 seconds