Jump to content
Sign in to follow this  
Daemios

Do backpack not count as objects in the world?

Recommended Posts

I'm confused as to why this piece of code doesn't work entirely:

op_hq_techBack1 = "O_UAV_01_backpack_F" createVehicle (getpos op_hq);
op_hq_techBack1 allowDamage false;
op_hq_techBack1 setPos [((getPos op_hq select 0)-3.75),((getPos op_hq select 1)-7.288),((getPos op_hq select 2)+10.25)];
op_hq_techBack1 setDir 270;
op_hq_techBack1 setVectorUp [0,2,0];

It spawns the backpack, and if I do something like the following code, it will give me a position.

_t = getPos op_hq_techBack1; player sidechat format["%1", _t]; 

But I cannot use setPos, and I cannot do

deletevehicle op_hq_techBack1;

And have the actual backpacks be deleted.

Am I not understanding some sort of rule about stuff like this? My ultimate goal is to add these to be part of a base that gives a player a sense of progression by unlocking specific pieces of it. The backpack is supposed to be hanging on the wall.

Share this post


Link to post
Share on other sites

The problem is it's actually two items.

A weaponholder (invisible) and the backpack or weapon that you can see.

To move it or delete it you need to identify the weaponholder.

wh = nearestobject  [op_hq_techBack1,"groundweaponholder"]; wh setpos getpos player

wh = nearestobject  [op_hq_techBack1,"groundweaponholder"]; deletevehicle wh 

You can also add things to the weapon holder.

wh addWeaponCargo [currentweapon player, 10];

will add weapons which can be seen on the ground.

Share this post


Link to post
Share on other sites

I don't know the context for which you spawn the backpacks, but if you use the editor, just look under backpacks and place it on the map. It will also let you enter the height you want it at. They spawn laying on their backs. I can see how "their backs" might mean different things to different people, imagine you are in the prone position. The backpacks spawn in that position.

Even if you don't want to place them in the editor, you can at least get the correct classname of the backpack by using the editor.

For hanging them on the wall, you would just enter the height, then use the setvector up command.

this setVectorUp [0,0,1]; this code will place it flat. putting it upside down would be this setVectorUp [0,0,-1];

So that gives you and idea. Changing the other values will change it the angle, bank, or pitch...etc.

Play around with it to find what you want

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  

×