Jump to content
Nowhere

Respawning a vehicle with objects attached to it

Recommended Posts

I'm trying to get a vehicle that has three objects attached to it to respawn with the objects attached to it.

In this case its a UGV Stomper that has an ammo crate and two fuel pods attached with the attachto command.

I have the drone synced to a vehicle spawn point and it respawns correctly. The objects that are attached do NOT respawn at all even after syncing them to the vehicle respawn point.

 

So, how do I get those objects to respawn and reattach themselves to the drone after the drone is destroyed and respawns?

Share this post


Link to post
Share on other sites
7 hours ago, Nowhere said:

I'm trying to get a vehicle that has three objects attached to it to respawn with the objects attached to it.

In this case its a UGV Stomper that has an ammo crate and two fuel pods attached with the attachto command.

I have the drone synced to a vehicle spawn point and it respawns correctly. The objects that are attached do NOT respawn at all even after syncing them to the vehicle respawn point.

 

So, how do I get those objects to respawn and reattach themselves to the drone after the drone is destroyed and respawns?

 

If you need help with a script not working, show us the script dude. 

Share this post


Link to post
Share on other sites
43 minutes ago, BlacKnightBK said:

If you need help with a script not working, show us the script dude. 

That's what I'm asking.

What script should I use in order to make this happen?

Share this post


Link to post
Share on other sites
2 hours ago, Nowhere said:

That's what I'm asking.

What script should I use in order to make this happen?

 

AH, sorry I misunderstood the question. Thought you were saying that they weren't getting attached. You can create a trigger on the respawn point, so when the UGV respawns on that position the trigger would then spawn the crates and attach them to the UGV. If the crates are not destroyed with the drone you can teleport them to the drone location using the setPos and then attach them to the drone.

Share this post


Link to post
Share on other sites

Don't see where the problem is.

You know how to attach objects to the UGV?

Simply use the respawn eventhandler, spawn the objects inside that EH and attach them to the UGV again.

 

Cheers

Share this post


Link to post
Share on other sites
9 hours ago, Grumpy Old Man said:

You know how to attach objects to the UGV?

Simply use the respawn eventhandler, spawn the objects inside that EH and attach them to the UGV again.

The objects attach fine and the vehicle works as intended. The problem is when the vehicle respawns after being destroyed.

 

I started messing around with the scripts in A3 a few days ago so I don't understand how most of them work. The wiki isn't much help because it doesn't explain the scripts very clearly.

Is this how the eventhandler works? How would I get something that's created inside of an event handler to attach to something else?

this addMPEventHandler ["MPRespawn",{createvehicle "_ammobox" attachto [_drone, [0.5, 0, -0.25] ]}];

 

Share this post


Link to post
Share on other sites
23 minutes ago, Nowhere said:

The wiki isn't much help because it doesn't explain the scripts very clearly.

What else besides description, syntax, alternative syntax, parameters, additional information, comments and various examples would you need?

This:

this addMPEventHandler ["MPRespawn",{createvehicle "_ammobox" attachto [_drone, [0.5, 0, -0.25] ]}];

Won't do anything. Wrong syntax, "_ammobox" is not a config class, _drone is undefined within the EH scope.

Try something like this and fill in the proper object class names and respawn position:

this addMPEventHandler ["MPRespawn",{

	params ["_vehicle"];

	_class1 = "YourClassNameHere";//use proper ammocrate or fuel can classname
	_obj1 = _class1 createVehicle [0,0,0];
	_obj1 attachTo [_vehicle, [0.5, 0, -0.25]];//repeat these three lines until you got all objects attached

	getposatl player //replace with respawn position of your choice, EH needs to return position

}];

 

Cheers

Share this post


Link to post
Share on other sites
28 minutes ago, Grumpy Old Man said:

Try something like this and fill in the proper object class names and respawn position:

 

this addMPEventHandler ["MPRespawn",{

	params ["_vehicle"];

	_class1 = "box_NATO_ammoveh_F";//use proper ammocrate or fuel can classname
	_obj1 = _class1 createVehicle [0,0,0];
	_obj1 attachTo [_vehicle, [0.5, 0, -0.25]];//repeat these three lines until you got all objects attached

	getposatl vehres //replace with respawn position of your choice, EH needs to return position

}];

Did this with one object to see if it would work.

For getposatl I put the name of the respawn module (vehres), left it as player, and tried using position coords. Each time I got:

..._class1 = "box_NATO_ammoveh_F";#//use proper ammocrate or fuel can class...
Error: Invalid number in expression

 

Share this post


Link to post
Share on other sites

Tried again with:

this addMPEventHandler ["MPRespawn",{

	params ["_vehicle"];

	_class1 = "box_NATO_ammoveh_F";
	_obj1 = _class1 createVehicle [0,0,0];
	_obj1 attachTo [_vehicle, [0.5, 0, -0.25]];

	getposatl player 

}];

I have tried changing "player" to the name of the respawn point, the name of the drone, the coords I want it to respawn at and just leaving it as player.

The drone respawns but nothing is attached to it.

Share this post


Link to post
Share on other sites

class names are case sensitive...

use

Box_NATO_AmmoVeh_F

if this is ur desired object

Share this post


Link to post
Share on other sites

Fixed the classname.

Getting the same result.

Share this post


Link to post
Share on other sites

this vector:

[0.5, 0, -0.25]

is relative to the center of the drone.

maybe you are attaching the object inside of the drone and cant see it because of that?

idk how big ur drone is...

nonsense. u did it before so it should be correct...

Edited by sarogahtyp

Share this post


Link to post
Share on other sites
1 minute ago, sarogahtyp said:

this vector:

[0.5, 0, -0.25]

is relative to the center of the drone.

maybe you are attaching the object inside of the drone and cant see it because of that?

The object itself is twice the height of the drone.

If it was attached in any way, I would be able to see it sticking out somewhere.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×