s4ikD 10 Posted July 5, 2011 hey all, i thought 15 mins about a matching title for my problem, that was the closest i could get. my problem, example: a player finds an item "Evidence(Money)" that item must be brought to a commander(player), he then has to put the item(s) in the commanders inventory and then for each item of that type the commander gets 100$ (westcoinfunds = westcoinfunds + 100) after that happened the "Evidence(Money)" in the commanders inventory has to be removed. does anyone know how to achieve that? thx in advance, s4ikD Share this post Link to post Share on other sites
roguetrooper 2 Posted July 5, 2011 (edited) You could do it by a trigger that activates when the collector and the commander are very close to each other: activation: [b]repeatedly[/b] condition: ([color="RoyalBlue"]collectorname[/color] distance [color="RoyalBlue"]commandername[/color]) < 3 code: [[color="RoyalBlue"]collectorname,commandername[/color]] exec "file.sqf"; If you have move than one collectors, you need a trigger for every collector: condition: ([color="RoyalBlue"]collectorname[/color][color="Red"]2[/color] distance [color="RoyalBlue"]commandername[/color]) < 3 code: [[color="RoyalBlue"]collectorname[/color][color="Red"]2[/color],[color="RoyalBlue"]commandername[/color]] exec "file.sqf"; file.sqf may look like this: _bringer = _this select 0; _taker = _this select 1; if !(_bringer hasWeapon "[color="RoyalBlue"]money[/color]") then {exit}; _bringer removeweapon "[color="RoyalBlue"]money[/color]"; _bringer action ["heal",_bringer]; _taker action ["heal",_taker]; if (isServer) then { westcoinfunds = westcoinfunds + 100; publicVariable "westcoinfunds"; }; if !(local _taker) then {exit}; _text = format ["I have received 100 credits from %1 %2.", rank _bringer, name _bringer]; [nil, nil, rSPAWN, [_taker, _text], { (_this select 0) groupChat (_this select 1) }] call RE; The commander does not need to have the money in his inventory. The heal-action is optional or might be replaced by another animation. But there should be some animation or the transaction is done in the background without any optical appearance. This code above also makes the commander say the sentence "I have received 100 credits from Corporal xy." on the server and all clients. You need to place a function-module on the map. The blue things have to be replaced by the actual, real unitnames and the classname of the money-item. Edited July 5, 2011 by RogueTrooper Share this post Link to post Share on other sites
s4ikD 10 Posted July 5, 2011 thank you so much, i'll try that asap Share this post Link to post Share on other sites
roguetrooper 2 Posted July 5, 2011 I think you have read my post while I was editing it. Make sure, you have copied (?) the latest version. Share this post Link to post Share on other sites
kylania 568 Posted July 5, 2011 The "money" object classname is EvMoney btw. :) Share this post Link to post Share on other sites
roguetrooper 2 Posted July 5, 2011 (edited) Is the money contained in Arma II: "Chernarus" AND Operation Arrowhead? If the money-item is not part of Operation Arrowhead and you don't own the original Chernarus-Arma2, all this won't work. Edited July 5, 2011 by RogueTrooper Share this post Link to post Share on other sites
s4ikD 10 Posted July 5, 2011 i own both, and play co and ace2, EvMoney is correct, i already replaced that. and another thing, the collector can be anybody, so do i replace that with "player"? the commander has a specific text (west_commander & ins_commander) and all other players must be able to bring back EvMoney Share this post Link to post Share on other sites
kylania 568 Posted July 5, 2011 Is the money contained in Arma II: "Chernarus" AND Operation Arrowhead?If the money-item is not part of Operation Arrowhead and you don't own the original Chernarus-Arma2, all this won't work. As my link said, all the evidence stuff is A2 only (except for the PMC documents). Operation Arrowhead seems to have access to them, kind of, but result in p3d errors. CO is so cheap ($30) these days there's no reason not to have both. :) Share this post Link to post Share on other sites
roguetrooper 2 Posted July 5, 2011 (edited) CO is so cheap ($30) these days there's no reason not to have both. :) Off topic, but: you can't imagine how many players who only have Arrowhead, try to connect to my server that requires Chernarus and Arrowhead (although server description includes requirement descriptions). I would say, many of those people who joined into the Arma world with the release of Arrowhead, do not have Arma II (thanks to BIS' intelligent addon politics :( ) and another thing, the collector can be anybody, so do i replace that with "player"? When all collectors are human players, it would probably enough to have only one trigger with player as substitute for "collectorname". But since I am to lazy now to think about all that stupid locality stuff, I would have a trigger for each collector with "collectorname" the name of the unit (which can be defined in the editor name field just above the skill slider). My suggestion above also requires all triggers to be executed on all computers, or the money handling and the chat won't work. Edited July 5, 2011 by RogueTrooper Share this post Link to post Share on other sites
s4ikD 10 Posted July 5, 2011 (edited) RogueTrooper, did u notice my post? i need the collector/bringer to be anybody from west and in the 2nd anybody from resistance also my commanders are called west_commander & ins_commander, i do need to change that, right? edit: alright nevermind :) thx ;) ---------- Post added at 05:59 PM ---------- Previous post was at 05:36 PM ---------- (which can be defined in the editor name field just above the skill slider). i thought that name had to be unique for each unit? (just tested it, yes it is...) that would mean with the current version of your script there could only be one collector? Edited July 5, 2011 by s4ikD Share this post Link to post Share on other sites
kylania 568 Posted July 5, 2011 If the script it called via a trigger it'll run on everyone computer and the server as well. However, if you combine that with "player" you'll end up having that transaction happen to each player, not just the one doing it. Personally I'd do something with an addAction on the commander which set a variable and publicized it and have a trigger check for that and do the funds changing. That way you know who is redeeming and everyone gets the updated funds amount. I'll try do work up a little demo for this. Share this post Link to post Share on other sites
roguetrooper 2 Posted July 5, 2011 i thought that name had to be unique for each unit? (just tested it, yes it is...) that would mean with the current version of your script there could only be one collector? Kylania's version with the addAction seems to be a better solution. Beside that: when you have 10 collectors, as I said, you need 10 triggers with collectorname1 collectorname2 etc. Share this post Link to post Share on other sites
s4ikD 10 Posted July 5, 2011 ok, so theres no solution to solve this via pickup of EvMoney? that would solve the collecter problem for sure. so anyone can bring it home, drop it on the ground or put it in a box and the commander picks it up, it adds +100 and gets removed. Share this post Link to post Share on other sites
kylania 568 Posted July 5, 2011 I got a small mission mostly working for this, a few things need to be changed though. I didn't realize you wanted to leave it somewhere then redeem it. So right now it works by the player using the action on the collector and the funds deposit right away. Share this post Link to post Share on other sites
s4ikD 10 Posted July 6, 2011 im currently working with kylania on a more complex version with a few more features of the script. (atm kylania is doing all the work :p) as soon as we get it working i'll post it here, until then i got this here: Trigger cond: (west_commander hasWeapon "EvMoney") onact: [west_commander] exec "evmoney_west.sqf"; evmoney_west.sqf _taker = _this select 0; if (isServer) then { westCoinFunds = westCoinFunds + 1000; publicVariable "westCoinFunds"; }; _taker removeweapon "EvMoney"; if !(local _taker) then {exit}; _text = format ["I have received 1000$"]; [nil, nil, rSPAWN, [_taker, _text], { (_this select 0) groupChat (_this select 1) }] call RE; this is a simplified version of roguetroopers script, works via pickup of the said item by the commander. now i want to add a trigger for the "ACE_DogTag" which u get as soon as you check a dead soldier for dogtag via ace interaction. the only problem i have now is that said dogtag counts as magazin, and i couldnt find a syntax that lets me check "hasMagazines". does anyone have a solution/workaround for that? tia & greetings, s4ikD Share this post Link to post Share on other sites