Jump to content
Sign in to follow this  
cpt-craig

Check weapons in box

Recommended Posts

I have checked around and i can't quite find out how I am supposed to make it so when a specific number of SPECIFIC weapons are in an ammo box e.g when there are more than say 5 EvDogTags in the box a trigger is activated, any response is appreciated

Share this post


Link to post
Share on other sites

Unfortunately, there's no way to query the contents of an ammo container. You're going to have to find a workaround. Perhaps keep track of how mant times someone approaches with a weapon and then loses it?

Share this post


Link to post
Share on other sites

yeah okay i'll have a look for how to do that

---------- Post added at 01:35 PM ---------- Previous post was at 12:41 PM ----------

okay I have though of a new way of going around this and that is, you approach an object and a action is added which when activated runs a script which checks if the player has any dog tags and if he does it adds rating which is checked when you approach pre defined ammo boxes and if the rating is above a certain threshold it adds a weapon. I would prefer if i didn't have to use rating as that means just killing enemies will raise the rating but I couldn't find any other way. so far I have made the action and the script called "tag.sqf" which looks like

If(player hasWeapon "EvDogTags")Then{removeweapon "EvDogTags"; player addRating 2000; hint "tag added"}

Else{hint "You don't have any dog tags ;exit};

i really have no idea how to do this because when I activate the action nothing happens, I haven't started working on the trigger which checks rating yet because I want to get this done first, any help is appreciated

Share this post


Link to post
Share on other sites

addTag.sqf:

_player = _this select 1;

if(_player hasWeapon "EvDogTags")then{
_player removeWeapon "EvDogTags";
retrievedDogTags = retrievedDogTags + 1;
hint format ["Dog Tags Retrieved: %1",retrievedDogTags];
};

crate init:

retrievedDogTags = 0; this addAction ["Add Dog Tags","addTag.sqf",[],1,true,true,"","(_this hasWeapon 'EvDogTags') && (_this == player)"]

Share this post


Link to post
Share on other sites

Thanks works brilliantly, btw if you wanna know what its for its for my mission I'm working on where youre stranded and have to help NAPA fight the Chkzd and every officer Chkzd officer is carrying a set of dog tags and if you bring back enough then it unlocks more weapons in the ammo box

Share this post


Link to post
Share on other sites

Don't add it to the ammo box. If you do you will have some issues, namely:

1. It will not be synchronized on the network - You have to run the command on all machines and then it will still not get properly synchronized for JIPs. There may be a workaround for this but I haven't tried it yet and it's not the most simple thing.

2. Nothing stops a player to take a dogtag back out of the box and then put it in again.

So, to keep things simple and logical, just have the script totally remove the dogtag from the game while giving you credit for it. If it's never in an ammo box and it disappears as soon as you credit the player for it, then it can't break.

Share this post


Link to post
Share on other sites

ok, is there a way of remotely accessing a gear/ammobox/placeholder thing so you could store your tags in it and remove them, simulating a backpack?

Okay doesn't matter I found a way by editing your original script to make one so you can "add it to backpack" in the same way that Murrays editing guide uses. this is kind of important because you can only ussually carry one set of dog tags at a time but with this you can "carry" as many as you need and get ONE set out to "deposit" to the ammo box. its not super simple to use in vast quantities but you won't encounter them in vast quantities :).

An example mission of my system thanks be to Big Dawg KS for his help.

http://www.filefront.com/16864229/Dogtags%20by%20Cpt-craig.7z

Edited by cpt-craig

Share this post


Link to post
Share on other sites

Keep in mind that if a player dies or disconnects, all rucksack content is pretty much lost.

Share this post


Link to post
Share on other sites

its designed for use in a single player mission so it should be alright

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  

×