Jump to content
Sign in to follow this  
Koni

Spawn weapons to be picked up

Recommended Posts

Title sums it up really.

How do you spawn a weapon which can be placed on an object like a table that can be picked up and used ?

Thanks

Answer was...

AKM = "WeaponHolder" createVehicle getPos this; AKM addWeaponCargo ["AK_47_M",1]; AKM setPos [getPos this select 0,getPos this select 1,0.78]; AKM addMagazineCargo ["30Rnd_762x39_AK47",2];

In a game logic

Edited by Koni
Was in a bad mood :)

Share this post


Link to post
Share on other sites

I do always search for everything I need to know, sometimes for hours on and off.

One big problem is people not posting descriptive thread titles, making finding things very difficult.

Anyway, I finally found a simply way to do this, on page 5 or 6 of results from something like the 6th different search term I had used.

Thanks.

Share this post


Link to post
Share on other sites

Part of the reason it was hard to find it may have also been because of people doing what you just did. Crossing out their whole post, replacing it with a Nevermind, and not actually posting the answer.

Share this post


Link to post
Share on other sites

There was a post a few days ago where F2K Sel and myself joined forces to answer this question, but now it's missing. :(

Yup, it's gone. The mirror post on ArmAholic was still around though. :) This shows ArmA1, but works the same in ArmA2.

Place a GameLogic where you want the weapons to appear. Put this code in it's init field:

numpty = "weaponholder" createVehicle position this;  
numpty addMagazineCargo ["30Rnd_556x45_Stanag", 6];
numpty addWeaponcargo ["M16A2",2];

A pile of 6 magazines and 2 rifles will appear there.

weaponholder.jpg

Edited by kylania

Share this post


Link to post
Share on other sites

Yeah thanks Kylania, thats near enough what I used to place some weapons on a table, but one thing I cannot find, is how to stop your unit from bending down to the floor to pick them up from a table which ends up above you ?

---------- Post added at 10:30 AM ---------- Previous post was at 10:23 AM ----------

;1996485']Part of the reason it was hard to find it may have also been because of people doing what you just did. Crossing out their whole post' date=' replacing it with a Nevermind, and not actually posting the answer.[/quote']

Part of the reason people like me do things like I did is probably getting replies to their questions like you did :)

Don't get me wrong, I am always very greatful when people answer any questions that I may need to finally ask for in the forums, but I never post a question without trying to find the answer first.

If I didn't, my post\question count could well be 10 times to what it is now.

Anyway, one last question for now, can you name or attach anything to a spawned weapon so that it can be detected if a unit picks up that spawned weapon\object ?

I was looking at

location attachObject SpawnedWeapon -

but the problem arises there, I need to name the weapon to be able to attach anything to it, therefor wouldn't need to attach if I could already name the spawned weapon... I'm rambling now.....

Edited by Koni

Share this post


Link to post
Share on other sites

You can check if they go into the gear animation sequence and are near the weaponHolder. Or if it's a unique type of weapon you can check when they have it in their weapons list.

Share this post


Link to post
Share on other sites

Yeah, it's not a unique weapon, just random AK's so that's a no go then, pitty.

Share this post


Link to post
Share on other sites

Well you can just check if they have an AK. When I said unique I mean unique in the mission. If the only source of AKs in this box, then it's unique and simply checking if the player has an AK means they got it from the box. If you're fighting Russians or something though, then there's AKs all over that players could have picked up so you couldn't know if it's the exact one.

Why do you need to know if they picked up an AK from that particular box if they are available elsewhere? What were you trying to do with that information?

Share this post


Link to post
Share on other sites

I was working on the basis of the player stealing a rifle from a weapon traders stall in a market for one part of a mission, but my original plan was to be able to detect if the rifle was taken from the market stall, and not just the player having an AK full stop.

Though I have now changed the mission layout idea, instead of the missions being more fluid, I'm now changing it so the start of this mission, the only source of getting a weapon is from the market, which works just fine.

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  

×