IPB


Welcome Guest ( Log In | Register )

 Forum Rules ArmedAssault.info Forum Rules
 
Reply to this topicStart new topic
> Weapons spawning under buildings
Ender
post Mar 28 2014, 08:15
Post #1


New Member
*

Group: Members
Posts: 2
Joined: 28-March 14
Member No.: 10,415



I am currently trying to make a game mode in which a random weapon will spawn on the exact location that i place another object (Eg. a flag) But currently any weapon i spawn inside a building will be moved to ground level beneath the floor of the building. Is there any way that i can spawn my weapon on the exact location that the initial object is so that it remains above floor level.

The code i use is:

gun = ["hgun_PDW2000_F", "SMG_01_F", "SMG_02_F"] call BIS_fnc_selectRandom;
if (gun=="hgun_PDW2000_F") then {vammo ="30Rnd_9x21_Mag"} else
{if (gun=="SMG_01_F") then {vammo="30Rnd_45ACP_Mag_SMG_01_Tracer_Green"} else
{if (gun=="SMG_02_F") then {vammo="30Rnd_9x21_Mag"}}};
//-----All of the above just defines the random weapon spawned.
Waffe1 = createVehicle ["groundweaponHolder",getPos this,[], 1, "can_collide"];
Waffe1 addMagazineCargo [vammo,1];
Waffe1 addWeaponCargo [gun,1];
Waffe1 setPos [getPos this select 0,getPos this select 1,0.00];
deleteVehicle this;

//Called with: [] call compile preProcessFileLineNumbers "RandomSMG.sqf"

Any advice is appreciated,
Thanks biggrin.gif
 
Quote Post
D@V£
post Mar 28 2014, 10:52
Post #2


Gee, I wish we had one of them doomsday machines.
Group Icon

Group: Moderators
Posts: 2,037
Joined: 13-November 06
From: Wales
Member No.: 155



This line:
CODE
Waffe1 setPos [getPos this select 0,getPos this select 1,0.00];

Basically says "use the position of placeholder, but completely ignore the height and just place it at ground level instead".

Instead use this:
CODE
Waffe1 setPos (getPos this);


--------------------
The Rules - Nothing too complicated, follow these and we'll have no problems.
Moderation Feedback Thread - Tell everyone how much you hate me love me secretly fear that Mark is watching you while you sleep. secretly wish that Mark is watching you while you sleep.
Site Issues Thread - Complain about site issues here. We might even fix them!
Community Chatter Thread - Furthest Mud-sling gets a free subscription to "JdB Monthly".

QUOTE(Major Mike Shearer)
We can categorically state that we have not released man-eating badgers into the area.
QUOTE(Brace Belden)
A machine gun is like a woman, I donít understand it, Iím afraid of it, and one day Iíll accidentally be killed by one.
 
Quote Post
Ender
post Mar 31 2014, 12:01
Post #3


New Member
*

Group: Members
Posts: 2
Joined: 28-March 14
Member No.: 10,415



Awesome, Thanks alot, didnt think that over complicating things would make me suffer.
 
Quote Post

Reply to this topicStart new topic
6 User(s) are reading this topic (6 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 16th November 2018 - 02:20