Jump to content
Sign in to follow this  
Hank Rearden

Game logic object - attaching spawned weapons.

Recommended Posts

*SEARCHED BEFORE POSTING*

I'm trying to create a grouping of objects to represent an insurgent arms cache. What I have so far is a wooden table with some ammo crates piled around/on it. I also have two separate object groupings spawned in game logics using the box = weaponholder command to spawn weapons directly on the ground.

I'm having issues in figuring out how to elevate these weapons or the game logic controlling them. Alternatively, is there a way for me to attach them to the table?

this attachTo [cachetable,[0,0,1]]; box = "WeaponHolder" createVehicle getpos this; box addWeaponCargo ["AK_47_M",1]; box addWeaponCargo["RPG7V",1]; box addMagazineCargo ["30RND_762X39_AK47",1]; box addMagazineCargo["ACE_30RND_762X39_S_AK47",1];box addMagazineCargo["MINEE",1];

As above, I tried using the attachTo command to connect them with the gamelogic but that didn't fly either. Care to point me in the right direction?

Share this post


Link to post
Share on other sites

Your not far off, the problem is that items can't be attached to the table, some objects just don't work.

You can attach objects to a pallet so just place that under the table and make it invisible pallet hideobject true and attach items to that instead.

box = "WeaponHolder" createVehicle getpos this;box attachTo [pallet,[0,0,1.4]]; box addWeaponCargo ["AK_47_M",1]; box addWeaponCargo["RPG7V",1]; box addMagazineCargo ["30RND_762X39_AK47",1]; box addMagazineCargo["ACE_30RND_762X39_S_AK47",1];box addMagazineCargo["MINEE",1];

Share this post


Link to post
Share on other sites

This worked, thank you. Was the difference between the table and the pallet that the table was under 'furniture'? I've previously had problems attaching laptops or radios to tables. I've also noticed that the table uses a different physic to the pallet, flying away if driven into, being affected by gravity etc.

Share this post


Link to post
Share on other sites

Any idea's why when you do so with a weapon it seems to be clientside rather then global as far as someone grabbing the weapons. When i've tried running it like that everyone grabs the same weapon, so it goes from 1 to around 8. Everyone can grab it even after someone else does and its not on that persons screen anymore

Share this post


Link to post
Share on other sites

I've never done any MP scripting but it sounds like it's running on all clients.

Maybe it should run on the server only, this may work but it's a guess.

if  (isServer)  then {;box = "WeaponHolder" createVehicle getpos this;box attachTo [pallet,[0,0,1.4]]; box addWeaponCargo ["AK_47_M",1]; box addWeaponCargo["RPG7V",1]; box addMagazineCargo ["30RND_762X39_AK47",1]; box addMagazineCargo["ACE_30RND_762X39_S_AK47",1];box addMagazineCargo["MINEE",1];}

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
Sign in to follow this  

×