Jump to content
Chessmaster

[HELP] No Interaction W/ Items & Weapons

Recommended Posts

Hello!

I'm quite new to this and I was wondering how I could make items & weapons without interaction? I was browsing the forum and I did come across this code:

lwh = "Library_WeaponHolder" createVehicle position this;
lwh addWeaponCargoGlobal ["arifle_katiba_f", 1];
lwh enableSimulation false;
lwh setPos (this modelToWorld [0, 0, 0.5]);
lwh setdamage 1;
lwh setvectorup [0,-1,0.01];
deleteVehicle this;

After tinkering around with it, I have had trouble with the rotation. I would like to place items & weapons as if they're on show. Any ideas? Please make this as noob friendly as possible!

Thanks!

Share this post


Link to post
Share on other sites

The setvectorup command is a bit hard to understand (at least for me). I prefer to use BIS_fnc_setPitchBank to rotate an object. So instead of your code I'd use:

lwh = "Library_WeaponHolder" createVehicle position this;
lwh addWeaponCargoGlobal ["arifle_katiba_f", 1];
lwh enableSimulation false;
lwh setPos (this modelToWorld [0, 0, 0.5]);
lwh setdamage 1;
[lwh, 45, -45] call BIS_fnc_setPitchBank;
deleteVehicle this;

and change 45 and -45 to your needs.

Share this post


Link to post
Share on other sites

Instead of spawning a weaponholder and adding a gun to it, then disabling the interaction, use the static props for weapons available in the editor

_gun = createVehicle  ["Weapon_arifle_Katiba_F",position player,[],0,"can_collide"];
// positioning stuff here

 

Share this post


Link to post
Share on other sites
On 7/14/2017 at 5:06 PM, 7erra said:

The setvectorup command is a bit hard to understand (at least for me). I prefer to use BIS_fnc_setPitchBank to rotate an object. So instead of your code I'd use:


lwh = "Library_WeaponHolder" createVehicle position this;
lwh addWeaponCargoGlobal ["arifle_katiba_f", 1];
lwh enableSimulation false;
lwh setPos (this modelToWorld [0, 0, 0.5]);
lwh setdamage 1;
[lwh, 45, -45] call BIS_fnc_setPitchBank;
deleteVehicle this;

and change 45 and -45 to your needs.


This helps somewhat but I am after rotation of an item say if it was placed on a table for display purposes. Is there a code for that?

Share this post


Link to post
Share on other sites

Use the command that @das attorney recommended:

On 14.7.2017 at 6:39 PM, das attorney said:

Instead of spawning a weaponholder and adding a gun to it, then disabling the interaction, use the static props for weapons available in the editor


_gun = createVehicle  ["Weapon_arifle_Katiba_F",position player,[],0,"can_collide"];
// positioning stuff here
[_gun, -45, 45] call BIS_fnc_setPitchBank;

 

 

Share this post


Link to post
Share on other sites
9 minutes ago, 7erra said:

Use the command that @das attorney recommended:

 


Okay, just copied the code to the init and it returned with the error "Local variable in global space" I removed the "// Positioning..." 

Share this post


Link to post
Share on other sites

Does the gun already exist (placed in editor)? If so then you'll have to use this instead of _gun. And only put this in the init:

[this, -45, 45] call BIS_fnc_setPitchBank;

 

Share this post


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

Does the gun already exist (placed in editor)? If so then you'll have to use this instead of _gun. And only put this in the init:


[this, -45, 45] call BIS_fnc_setPitchBank;

 

 

Ngl, none of this is working for me :( I have no idea how to position the item properly on the table without it being interactive. Here is an image to see where I am coming from:
 

8dqEVPf.png

When testing, with the code, all items turn a different direction.

 

Edit: Cracked it! Thanks guys!

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

×