Jump to content
Sign in to follow this  
clydefrog

Place a weapon that can't be picked up

Recommended Posts

Hi, does anybody know of a way to place a weapon that can't be interacted with? I would like to be able to spawn an AT launcher or something that will be the obect for an IED, but I don't want the person who finds it to be able to pick the weapon up. Is this possible?

Share this post


Link to post
Share on other sites

Little bit of a hack, but it works:

[color=#FF8040][color=#000000]player[/color] [color=#191970][b]addEventHandler[/b][/color]
[color=#8B3E2F][b][[/b][/color]
   [color=#7A7A7A]"Take"[/color][color=#8B3E2F][b],[/b][/color]
   [color=#8B3E2F][b]{[/b][/color]
       [color=#1874CD]_unit[/color]    [color=#8B3E2F][b]=[/b][/color] [color=#000000]_this[/color] [color=#191970][b]select[/b][/color] [color=#FF0000]0[/color][color=#8B3E2F][b];[/b][/color]
       [color=#1874CD]_container[/color]    [color=#8B3E2F][b]=[/b][/color] [color=#000000]_this[/color] [color=#191970][b]select[/b][/color] [color=#FF0000]1[/color][color=#8B3E2F][b];[/b][/color]
       [color=#1874CD]_item[/color]    [color=#8B3E2F][b]=[/b][/color] [color=#000000]_this[/color] [color=#191970][b]select[/b][/color] [color=#FF0000]2[/color][color=#8B3E2F][b];[/b][/color]

       [color=#191970][b]if[/b][/color][color=#8B3E2F][b]([/b][/color][color=#1874CD]_item[/color] [color=#8B3E2F][b]=[/b][/color][color=#8B3E2F][b]=[/b][/color] [color=#7A7A7A]"arifle_MX_ACO_pointer_F"[/color][color=#8B3E2F][b])[/b][/color] [color=#191970][b]then[/b][/color]
       [color=#8B3E2F][b]{[/b][/color]
           [color=#1874CD]_container[/color] [color=#191970][b]addItemCargoGlobal[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#1874CD]_item[/color][color=#8B3E2F][b],[/b][/color] [color=#FF0000]1[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color]
           [color=#1874CD]_item[/color] [color=#191970][b]spawn[/b][/color]
           [color=#8B3E2F][b]{[/b][/color]
               [color=#1874CD]_playerWeapons[/color] [color=#8B3E2F][b]=[/b][/color] [color=#191970][b]weapons[/b][/color] [color=#000000]player[/color][color=#8B3E2F][b];[/b][/color]
               [color=#191970][b]waitUntil[/b][/color] [color=#8B3E2F][b]{[/b][/color][color=#000000]_this[/color] [color=#191970][b]in[/b][/color] [color=#1874CD]_playerWeapons[/color][color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color]
               [color=#000000]player[/color] [color=#191970][b]removeWeapon[/b][/color] [color=#8B3E2F][b]([/b][/color][color=#1874CD]_playerWeapons[/color] [color=#191970][b]select[/b][/color] [color=#8B3E2F][b]([/b][/color][color=#1874CD]_playerWeapons[/color] [color=#191970][b]find[/b][/color] [color=#000000]_this[/color][color=#8B3E2F][b])[/b][/color][color=#8B3E2F][b])[/b][/color][color=#8B3E2F][b];[/b][/color]
           [color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color]
       [color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color]
   [color=#8B3E2F][b]}[/b][/color]
[color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color]
[/color]

Kudos to Killzone_Kid for his SQF to BBCode Converter.

It's simply putting the picked weapon back to the ground, waits until the picked weapon is in the player's inventory and then deletes it from there.

Share this post


Link to post
Share on other sites
enableSimulationGlobal used to do the job for weapon holders.

Right.

[color="#FF8040"][color="#1874CD"]_weaponHolder[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]createVehicle[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"GroundWeaponHolder"[/color][color="#8B3E2F"][b],[/b][/color] [color="#191970"][b]getPosATL[/b][/color] [color="#000000"]player[/color][color="#8B3E2F"][b],[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color] [color="#7A7A7A"]"CAN_COLLIDE"[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_weaponHolder[/color] [color="#191970"][b]addItemCargoGlobal[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"arifle_MX_ACO_pointer_F"[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_weaponHolder[/color] [color="#191970"][b]enableSimulationGlobal[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b];[/b][/color][/color]

does the job as well.

Share this post


Link to post
Share on other sites

Thanks for the suggestions.

setDamage 1 works, I didn't know that would do anything on weapons.

enableSimulationGlobal false might work if you spawn a weaponholder through a script but enableSimulation false doesn't work on an editor placed weapon, I still have the inventory option on it.

Share this post


Link to post
Share on other sites

Well, I didn't know how you placed the AT launcher, that's why I considered both the enableSimulationGlobal false and the "Take" EH as working solutions. But anyway, good you could solve your issue. :)

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  

×