addicted 1 Posted April 4, 2013 (edited) Hello I'm new one in creating missions and especially in scripting. I read many tutorials and instructions how to create a mission and how to make scripts. I never saw thread about tutorial to MP game - sector control type. Because there was similar problems and there was no full answer i decided to set this thread. To the point. In editor I created multiplayer mission, that’s mean I created few east and west soldiers, few empty vehicles and two spawn markers, and three sectors. This sectors consist of: one marker named sector1 (ellipse 35,35) and three triggers (elipse 35,35) with instruction to set marker color when west or east soldiers captured it. for example tiger with condition ({side _x == opfor} count thisList > {side _x == blufor} count thisList) on act "sector1" setMarkerColor "ColorRed" Everythink works good. I don't know is it good method to make SC mission. If there is better way I'm interested in learn "how to". Now I want to create points system, but after few tries I don’t know how to make it. I edited few missions with points system but I don't understand or just partially understand how it works. I need for example to turn on table points for both sides - west points : east points and add points like this: in "sector1" add 3 points every 4 seconds sector is red or blue, in "sector2" 5 points every 6 seconds sector is blue or red, and similar numbers for last "secor3". Also I need to get points to side every enemy killed soldier - 3points and every enemy killed vehicle - 4 points and every enemy killed plane or heli - 6 points. Sorry for my English. I think most of tutorials from A2 are fully useful in A3. Help me please. Please could someone write a script or give some advice which functions should I use. If there is more info needed I will attache. Edited April 8, 2013 by addIcted Share this post Link to post Share on other sites
addicted 1 Posted April 5, 2013 Can somebody help me? Share this post Link to post Share on other sites
addicted 1 Posted April 6, 2013 Is it so hard that noone can help me? Share this post Link to post Share on other sites
Alo Keen 7 Posted April 7, 2013 I'd go for creating a script that executes when a trigger is fired (use 1 trigger per zone). Have the script analyze the number of players from both sides in the zone, and adjust marker size, color, score, whatever... accordingly. Have it loop until the zone is capped (number of enemy = 0, capture progress = 100% ... ). Have the script activate again if there are enemy players in the zone. You can use custom functions both for condition of trigger activation (check who owns the zone, check if there are players not from that side in the zone), and for subsequent handling (calculate as above). Just one approach, I guess... Someone else might do it some other way. Share this post Link to post Share on other sites
addicted 1 Posted April 7, 2013 (edited) Thanks for answer. In sectors which I have created everything works fine, markers changing his colors when they should. I can add to "on act" for example "sector1" setMarkerColor "ColorRed"; [b]"sector1" setSide west;[/b] then zones will belong to one of sides. I don’t need progress of capturing (maybe later when i will learn more about scripting :) ) The question is how to create script which adding points when some marker is in some color or some side. I wanted to add action to soldiers or flags showscore which will start script showscore.sqf - _str = format ["POINTS:\nBLUFOR : %1 - OPFOR %2",westScore,eastScore]; hint _str; and implement some points system for example something like this: if (getMarkerColor "sector1" == "BlueColor") then {westscore = westscore + 1}; publicVariable "westScore"; but it doesn’t work for me. Other way I don't know how to make correctly a loop. Like i sad I'm beginner in this hell called scripting. Edited April 8, 2013 by addIcted Share this post Link to post Share on other sites
Alo Keen 7 Posted April 7, 2013 First of all, try using code tags for code (available in the advanced editor when you reply), much easier to read. Well, if you set up the points tally in a loop, it will add a point for each side on each pass through the loop. _condition = true; while (_condition) do { [color=#3E3E3E]if (getMarkerColor "sector1" == "BlueColor") then { westScore = westScore + 1 }; publicVariable "westScore"; [/color] sleep 4; }; The sleep instruction is important - it will pause the loop, giving the game engine time to do other stuff. if you set this too low, all the "computing power" of the server will go to that script, and your mission will freeze or otherwise suck. Experiment with values. Keep this handy - you can learn A LOT from there when you are at the beginning and know very little. Are you aware of the server/client scopes and inherent limitations? Share this post Link to post Share on other sites
addicted 1 Posted April 8, 2013 Thanks for answer. Yesturday I was away frome home. I corrected all to code :) . When i come back from work i will try use your code. That handy very usefull thing - thanks. I was reading about server/client scopes and inherent limitations but its hard to understand how it works. I think with few tries and help I will understand this :). I think in this example I should make adding points on server and showing points on client, and only show points on the end of missions by sever. Till now i made it this way - in init.sqf I added westscore = 0 eastscore = 0 [] exec "points.sqf" And in points.sqf I will write your script. If it will work i will try implement it to all situations (mean colors) and all sectors. Share this post Link to post Share on other sites
Alo Keen 7 Posted April 8, 2013 Remember to set condition to false if you don't need the loop anymore Share this post Link to post Share on other sites
addicted 1 Posted April 8, 2013 (edited) I have:init.sqf waituntil {!(isnil "bis_fnc_init")}; enableSaving [false,false]; setViewDistance 1000; setTerrainGrid 25; player addEventHandler ["Respawn", { (_this select 1) spawn { sleep 10; hidebody _this; sleep 10; deleteVehicle _this; }; }]; player AddAction ["Show Score", "showscore.sqf"]; westscore = 0; eastscore = 0; [] exec "points.sqf" points.sqf _condition = true; while (_condition) do { if (getMarkerColor "sector1" == "BlueColor") then { westScore = westScore + 1 }; publicVariable "westScore"; sleep 4; }; and showscore.sqf _ str = format ["POINTS:\nBLUFOR : %1 - OPFOR %2",westScore,eastScore]; hint _str; I have a trigger with condition ({side _x == blufor} count thisList > {side _x == opfor} count thisList) on act "sector1" setMarkerColor "ColorBlue" and its doesn't work :( I tried few combinations and it still doesn't work. It only adds one point on start to west. by the way there is a message EDIT 'l#l sleep 4;' error generic error in expression Edited April 9, 2013 by addIcted Share this post Link to post Share on other sites
mikie boy 18 Posted April 8, 2013 westscore = 0; eastscore = 0; change to... if (isnil "westscore") then {westscore = 0}; if (isnil "eastscore") then {eastscore = 0}; otherwise when the players join the westside score and east side score gets set to 0 for them regardless of what the score is. [] exec "points.sqf" - change to if (isserver) then { execVM "points.sqf"; }; you only need this running on the server since it will be controlling the points system. Not everyone needs to run this script. change the following - you always want this running so no need to have a condition that will ever change. _condition = true; while (_condition) do { if (getMarkerColor "sector1" == "BlueColor") then { westScore = westScore + 1 }; publicVariable "westScore"; sleep 4; }; change to while {true} do { if (getMarkerColor "sector1" == "BlueColor") then { westScore = westScore + 1; publicVariable "westScore"; }; sleep 4; }; speep 4 error looks like you have just incorrectly spelt sleep. not sure about your trigger conditions since i hate trigger - lol - which one actives on which computer - and throw AI into the mix and youve got a shit storm - hope this helps somewhat Share this post Link to post Share on other sites
addicted 1 Posted April 8, 2013 (edited) Thanks Mikie Boy for answear and advices. No more error shown, but it still doesn't add points :( , or points are adding and i don't see it. It could be somethink bad with score show. About "speep" that was my mistake copying message. I corrected it. Edit. I think it's not a problem with showing score - it shows score without refreshing it. Edited April 9, 2013 by addIcted Share this post Link to post Share on other sites
addicted 1 Posted April 9, 2013 YYEEEE. Everythink works. I mistake on comand BlueColor - it should be ColorBlue. Share this post Link to post Share on other sites
mikie boy 18 Posted April 9, 2013 Awesome. Nice work glad you got it working Share this post Link to post Share on other sites