cael817 10 Posted February 8, 2015 (edited) I have an variable with a scalar value that changes if the players gets killed or kills someone (cbounty), when they kill someone they get the targets cbounty value added to theirs which is fine in itself. Now i want to add so if cbounty reaches a certain value (lets say 1000) and above it will globally hint the server that "player name" has a bounty of "cbounty" and was last seen near "town name" and place a marker (preferably with the player name) the position where the player where at the time of the hint and then remove the marker some time later (to keep the map clean). I have read that it would be bad to do "while loops" but if i want this script to check all players for a higher cbounty value than the set one from time to time i need some kind of loop right or using "near/nearest(something)" as you understand this is way over my head so any help is appreciated =). i found this thread http://forums.bistudio.com/showthread.php?186287-Select-a-random-player/page1 but that is not how i would like it to behave and i would like players to have a chance of staying away, ill probably make the bounty "bleed" off but thats another issue =). Thanks. Im slowly getting towards something that i think might work #define PUBLIC_AREAS call cityList if (isDedicated) exitWith {}; waitUntil {!isNull player}; player addEventHandler ["Fired", { if (player getvariable "cbounty" > 1000) then { if ({(_this select 0) distance getMarkerPos (_x select 0) < _x select 1} count PUBLIC_AREAS > 0) then { systemChat "A high value target was last seen near the area marked on the map"; createBountyMarker = { deleteMarker "bountyMarker"; _pos = getPos (vehicle player); _markerText = format["Bounty Target, %1",(name player)]; _bountyMarker = createMarker ["bountyMarker", _pos]; _bountyMarker setMarkerShape "ICON"; _bountyMarker setMarkerPos _pos; _bountyMarker setMarkerText _markerText; _bountyMarker setMarkerColor "ColorRed"; _bountyMarker setMarkerType "select"; sleep 300; deleteMarker _bountyMarker; }; [] spawn createBountyMarker; }; }; }]; This places the marker for me, but i would like to if possible to use all "NameCityCapital","NameCity","NameVillage","CityCenter" and maybe other places. Can i use that together with the code above? btw cityList is already in A3W [ // Marker Name, Diameter, City Name ["Town_1", 400, "Kavala"], ["Town_2", 300, "Agios Dionysios"], ["Town_3", 150, "Abdera"], etc. but it doesnt and shouldn't contain all towns. I could of create one separate with all towns if that's good practice? Is it possible to suppress the "systemChat" or make a (global) hint that only throws once in a while. Also can i add more eventhandlers ("fired" isnt really optimal for what i want) into this or is it better to put all the towns etc into an array and create triggers on top of those? not that i think i will figure that out by myself =). Or can one create an custom eventhandler that is something like "enteringTown"? (any town or something like that above) that would be really nice... Edited February 11, 2015 by Cael817 Progress Share this post Link to post Share on other sites
cael817 10 Posted February 12, 2015 Do i need to make the marker name unique? is this sufficient? _markerName = format["bt%1",(name player)]; _bountyMarker = createMarker ["_markerName", _pos]; Share this post Link to post Share on other sites
Schatten 268 Posted February 12, 2015 Try: player addEventHandler ["Fired", { if ((player getVariable "cbounty") > 1000) then { if (({(_this select 0) distance (getMarkerPos (_x select 0)) < (_x select 1)} count PUBLIC_AREAS) > 0) then { systemChat "A high value target was last seen near the area marked on the map"; if (!(isNil "deleteBountyMarkerScriptHandler")) then { terminate deleteBountyMarkerScriptHandler; deleteMarker "bountyMarker"; }; _bountyMarker = createMarker ["bountyMarker", getPos (vehicle player)]; _bountyMarker setMarkerColor "ColorRed"; _bountyMarker setMarkerShape "ICON"; _bountyMarker setMarkerText (format ["Bounty Target, %1", name player]); _bountyMarker setMarkerType "select"; deleteBountyMarkerScriptHandler = [] spawn { sleep 300; deleteMarker "bountyMarker"; }; }; }; } ]; Do i need to make the marker name unique? Yes, marker name should be unique. You can't create markers with same name. Share this post Link to post Share on other sites
cael817 10 Posted February 12, 2015 (edited) Thank you Schatten, I'm thinking that i may i need to take an alternative route to achieve what i want so i looked at KKs Trigger Tutorial here http://killzonekid.com/arma-scripting-tutorials-triggers-v3-1-basic-multiplayer-coding-v1-1/ but how do i get something like this _triggerPositions = nearestLocations [getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition"), ["NameVillage","NameCity","NameCityCapital"], 25000]; to output/reflect this ? _triggerPositions = [[0,0,0],[1,1,1],[2,2,2]]; Edited February 12, 2015 by Cael817 Share this post Link to post Share on other sites
Schatten 268 Posted February 12, 2015 I'm thinking that i may i need to take an alternative route to achieve what i want so i looked at KKsTrigger Tutorial I don't think that triggers appropriate here. You can do something like system of marking missions locations in Wasteland. but how do i get something like this _triggerPositions = nearestLocations [getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition"), ["NameVillage","NameCity","NameCityCapital"], 25000]; to output/reflect this ? _triggerPositions = [[0,0,0],[1,1,1],[2,2,2]]; Sorry, I can't say anything, because I didn't work with locations. Share this post Link to post Share on other sites
cael817 10 Posted February 12, 2015 Yes i could do that but i guess that would be to only mark a random player with a high enough value. That i can actually manage to do =). I would like it so the "bounty target" gets marked and hinted about when they approach certain places, like towns or villages, actually having the possibility for adding my own markers and triggers to them might be just what i want. If there where an eventhandler like "nearTown" that would probably be perfect. Share this post Link to post Share on other sites
Jesus0101 0 Posted April 9, 2016 Hello, So I am currently running a wasteland server and was looking for a script alonge these lines to use on the server, I was not 100% sure if this could work with wasteland or where i would have to put it. If anyone could point me in the right direction that would be great. Share this post Link to post Share on other sites
fn_Quiksilver 1633 Posted April 9, 2016 theres nothing wrong with while loops bang out something that works and then worry about performance :) [] spawn { _unit = player; _radius = 100; _refreshrate = 60; _marker = createMarker ['my_marker',[0,0,0]]; _marker setMarkerShape 'ellipse'; _marker setMarkerBrush 'border'; _marker setMarkerSize [_radius,_radius]; while {(alive _unit)} do { my_marker setMarkerPos [ (((getposworld _unit) select 0) + (_radius - (random (2 * _radius)))), (((getposworld _unit) select 1) + (_radius - (random (2 * _radius)))), 0 ]; sleep _refreshrate; }; deleteMarker _marker; }; Share this post Link to post Share on other sites