Larrow 2821 Posted July 28, 2013 I've tried the 1st part of your 1st script.... lol BUT I haven't got a clue apparently. lolSorry for the confusion, the first lot of code is not a script it is just INFO ripped out off the sector module script to show all the variables stored on the module object.What if you have multiple sectors? You see what Ive got up there. I'd like to make it much easier for people with less scripting knowledge than me. Where they can just insert the name's of sectors and insert the script I am working on and goSomething like (untested) _mySectors = [Ambb, ambo]; Blwin = false; Opwin = false; while {!Blwin && !Opwin} do { _Hstring = "No one controls all areas"; if ({_x getVariable "owner" == west}count _mySectors == count _mySectors) then { _Hstring = "Blufor have captured all the areas"; Blwin = true; }; if ({_x getVariable "owner" == east}count _mySectors == count _mySectors) then { _Hstring = "Opfor have captured all the areas"; Opwin = true; }; hintSilent _Hstring; sleep 6; }; And if your making this a script for others to call just replace _mySectors = [Ambb, ambo]; with _mySectors = _this; and have them call it with _handle = [Ambb, ambo] spawn "mySectorChecking.sqf"; For MP youll likely want to make something similar as i done in my last post to display the hints to all clients, and leave this to be only run on the server? maybe Share this post Link to post Share on other sites
mikey74 169 Posted July 28, 2013 (edited) AHHHHHH coolness!!!!!!!! YEH that looks right. Gotta test it, but have few other ideas to spruce that up a bit for more than 2 if necessary. ;) I'll post what I have when its successful. lol Thanks :) edited: AHHH Replacing with _this. That will call up all sectors I place in the [] on the spawn function. Which I've tried this function on another script a while back. Didnt work got an error, but will try it. Thanks again. :) Tested this _handle = [Ambb, ambo] spawn "mySectorChecking.sqf"; through game logic init, and init.sqf . I get an error that says Erro spawn: Type String, expected code. Will execVM work for this? ExecVM seems to work with it. Is there a reason you would want to use spawn rather than exceVM? By the way it deffo works with 2 sectors... Now I have to implement other stuff. When its finished I'll share. :) Edited July 28, 2013 by Mikey74 Share this post Link to post Share on other sites
Larrow 2821 Posted July 28, 2013 I get an error that says Erro spawn: Type String, expected code. Will execVM work for this? ExecVM seems to work with it. Is there a reason you would want to use spawn rather than exceVM? No, just not thinking straight :DBy the way it deffo works with 2 sectorsIt will work with as many sectors that you pass in the array Share this post Link to post Share on other sites
mikey74 169 Posted July 28, 2013 (edited) No, just not thinking straight Your not the 1st person to talk about using the spawn call. ;) It will work with as many sectors that you pass in the array Yes It will. lol Working out the timing of how long they can hold all sectors before game ends now. I want to give enemy time to retake at last one. May go with a while statement for that.Something like this: _mySectors = _this; Blwin = false; Opwin = false; while {!Blwin && !Opwin} do { _Hstring = "No one controls all areas"; while {{_x getVariable "owner" == west}count _mySectors == count _mySectors} do {sleep 90; if ({_x getVariable "owner" == west}count _mySectors == count _mySectors) then { _Hstring = "Blufor have captured all the areas"; Blwin = true; }}; while {{_x getVariable "owner" == east}count _mySectors == count _mySectors} do {sleep 90; if ({_x getVariable "owner" == east}count _mySectors == count _mySectors) then { _Hstring = "Opfor have captured all the areas"; Opwin = true; }}; hintSilent _Hstring; sleep 35; } Edited July 28, 2013 by Mikey74 Share this post Link to post Share on other sites
Larrow 2821 Posted July 28, 2013 Spawn is actually better than execVM dependant on where you use it, as execVM compiles the script each time you use it. If for example a call via execVM is in a piece of code that is called many times then it is not really the best option as each time execVM is used the engine has to recompile the script. It would generally be better to (somewhere near the begining of your init to compile the code. myScript = compile preprocessFileLineNumbers "mySectorChecking.sqf"; then use spawn _handle = [Ambb, ambo] spawn myScript; . But as your only ever going to be calling this script once in your case it does not really matter. Share this post Link to post Share on other sites
comp_uter15776 1 Posted July 29, 2013 Noticed this sector issue where you lose them after leaving the area hasn't been resolved (or I'm doing something wrong)... Can anyone verify this via the repro mission attached? https://mega.co.nz/#!qB52lIwb!M0RnpHIy8G2llDxUj3xcXSbcLswbB57yneE5mdnz7mA Share this post Link to post Share on other sites
Larrow 2821 Posted July 29, 2013 (edited) Noticed this sector issue where you lose them after leaving the area hasn't been resolved (or I'm doing something wrong)...Can anyone verify this via the repro mission attached? https://mega.co.nz/#!qB52lIwb!M0RnpHIy8G2llDxUj3xcXSbcLswbB57yneE5mdnz7mA Set the Ownership limit to anything below 1. Its something like you have to keep that zones score for your side above the limit to be the owner. It seems that if set to 1 you always have to have someone present in the area. Remove your hints from your execution lines in your sectors and place this in the init.sqf to see whats happening. handle = [] spawn{ while {true} do {hstring = format ["Area: %1\nSides: %2\nFlags: %3\nTasks: %4\nDesign: %5\nSidesc: %6\nContest: %7\nOwner: %8\nOwnerT: %9\nOwnerCol: %10", a getvariable "areas" , a getvariable "sides" , a getvariable "flags" , a getvariable "tasks" , a getvariable "designation" , a getvariable "sideScore" , a getvariable "contested" , a getvariable "owner" , a getvariable "ownerTexture" , a getvariable "ownerColor"]; hint Hstring; sleep 1;};}; Set the limit to something like 0.8 and you will see that you do not own the area until your sides score > 0.8. _____________________________________ It could well be a mistake in the module script thought, related to this if (_xScore > _ownerLimit && _xScore > _ownerScore) then {_owner = _x; _ownerScore = _xScore}; _totalScore = _totalScore + _xScore; if (_foreachindex > 0) then {_maxScore = _maxScore max _xScore min 1;}; As the score has to be > than the limit rather than >=. It evalues ok straight after score evaluation but then the score is checked against a min of 1, if you then leave the area score is not greater than limit so ownership fails. Although it needs to looked through by Morickey or who ever wrote it, unless this is the intended action? Edited July 29, 2013 by Larrow Share this post Link to post Share on other sites
mikey74 169 Posted August 6, 2013 Spawn is actually better than execVM dependant on where you use it, as execVM compiles the script each time you use it.If for example a call via execVM is in a piece of code that is called many times then it is not really the best option as each time execVM is used the engine has to recompile the script. It would generally be better to (somewhere near the begining of your init to compile the code. myScript = compile preprocessFileLineNumbers "mySectorChecking.sqf"; then use spawn _handle = [Ambb, ambo] spawn myScript; . But as your only ever going to be calling this script once in your case it does not really matter. Thanks Larrow you and F2k sel has been a big help. :) Share this post Link to post Share on other sites
BEAKSBY 11 Posted May 2, 2014 Hi All, I'm re-duxing an old favorite of mine from the xbox360 "The Outfit" with an ArmaIII spin. I would like to use the sector module so that only the side that controls the area can unlock their side's vehicles and call them in via a addAction... With F2kSel's help he provided the following..but unfortunately it's not working: Setup your sectors and when you have them working in the sector module where it says expression put sector module expression missionnamespace setvariable ["sector",_this] That should contain the the current owner of the sector. Now if you add this addaction to all players players init boxes this addAction ["<t color='#FF0000'>M2A4 Slammer UP $1200</t>", "ArmorDrop.sqf",[],0,true,true Also, I read the threads from many others with slight alterations to their modules. I'm getting more familiar with them. Do you know if anyone has successful instructions for respawning a player at the captured these sector module? Share this post Link to post Share on other sites
f2k sel 164 Posted May 2, 2014 this addAction ["<t color='#FF0000'>M2A4 Slammer UP $1200</t>", "ArmorDrop.sqf",[],0,true,true,""," ( missionnamespace getVariable 'sector' select 1 ) == side _this"] Your missing some of the code Share this post Link to post Share on other sites
BEAKSBY 11 Posted May 2, 2014 this addAction ["<t color='#FF0000'>M2A4 Slammer UP $1200</t>", "ArmorDrop.sqf",[],0,true,true,""," ( missionnamespace getVariable 'sector' select 1 ) == side _this"] Your missing some of the code I did not copy and paste it properly to the post, but it's in both Blu and OP player init sections. But it still does not do anything. Perhaps it is an MP issue? ...scratching my head. Thanks anyhow. Share this post Link to post Share on other sites
f2k sel 164 Posted May 2, 2014 See if this works http://www.sendspace.com/file/nhyftb I modified it to make it easier to read based on Larrows use of variables. You should try it SP first so you know how it should work before testing MP. If you walk into the trigger after a few seconds you will take control of the sector and have the action. The only issue is that on leaving the area the action remains until another unit from the other side takes control of the sector. The action could be removed using triggers but there should be a way to reset the scetor back to unknown if there are no units present,that would cancel the action. Share this post Link to post Share on other sites
BEAKSBY 11 Posted May 2, 2014 It does exactly what I want in SP, THANKS!!! But, when I install it into my MP game the addaction command does not activate. I tried incorporating the player init into the respawn template thinking that was the problem, but it still did not work. My long term plan is to have a player respawn from controlled sector areas and thought I could do this by unlocking them through the repawn template. I also noticed the MP versions in the previous posts had "iserver" and "dedicated server" commands, but I`m not sure if this is at all needed or how to incorporate them if that's the case? I've experimented by changing some things in my mission and description files but not sure where the problem lies... I synced it to a sector control, no luck. I`ll try experimenting with a script in the "Expression" field that does the same as the addaction of the player init. If you have an thoughts on the problem, I've added a link to my entire mission folder below. http://www.sendspace.com/file/c6js9f Thanks for all the help so far! Share this post Link to post Share on other sites
BEAKSBY 11 Posted May 3, 2014 I tested in MP and it works!!! Except using respawnTemplates[] = {"MenuInventory","MenuPosition"}; and when this is enabled it no longer reads the init with the addaction command. I've tried placing the init with the addaction command add various parts inside the description.ext file but it still does not read it when I capture the sector area. Do I remove the following from the mission.sqf... class Item0 { side="WEST"; class Vehicles { items=1; class Item0 { position[]={1719.6091,5.5,5698.1357}; azimut=17.3664; id=0; side="WEST"; vehicle="B_Soldier_F"; player="PLAYER COMMANDER"; leader=1; skill=0.60000002; init=" this addAction [""<t color='#FF0000'>M2A4 Slammer UP $1200</t>"", ""ArmorDrop.sqf"",[],0,true,true,"""",""sector1 getVariable 'owner' == side _this and _this distance _target <1""]"; syncId=0; synchronizations[]={20,16,18}; }; }; }; class Item1 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={1714.5222,5.5,5721.8413}; azimut=17.889299; id=1; side="EAST"; vehicle="O_Soldier_F"; player="PLAY CDG"; leader=1; skill=0.60000002; ammo=0; init=" this addAction [""<t color='#FF0000'>T-100 Varsuk $1200</t>"", ""O_ArmorDrop.sqf"",[],0,true,true,"""",""sector1 getVariable 'owner' == side _this and _this distance _target <1""]"; }; }; }; ...and place it inside the description.ext with the repawn template, if so where? description.ext respawn = "BASE"; respawnDelay = 5; respawnTemplates[] = {"MenuInventory","MenuPosition"}; class Header { gameType = Hold; minPlayers = 1; maxPlayers = 6; }; class CfgRespawnInventory { class WEST1 { displayName = "Deuce"; // Name visible in the menu icon = "\A3\Ui_f\data\GUI\Cfg\Ranks\colonel_gs.paa"; // Icon displayed next to the name // Loadout definition, uses same entries as CfgVehicles classes vehicle[] = { "B_soldier_AT_F" }; weapons[] = { "launch_B_Titan_short_F", "Titan_AT", "hgun_P07_F " }; magazines[] = { "16Rnd_9x21_Mag", "16Rnd_9x21_Mag", "16Rnd_9x21_Mag", "Titan_AT", "Titan_AT", "Titan_AT", "Titan_AT", "Titan_AT", "SmokeShell" }; items[] = { "FirstAidKit", "Laserdesignator" }; linkedItems[] = { "V_Chestrig_khk", "H_Watchcap_blk", "optic_Aco", "acc_flashlight", "ItemMap", "ItemCompass", "ItemWatch", "ItemRadio" }; // uniformClass = "U_B_CombatUniform_mcam_tshirt"; uniformClass = "U_NikosAgedBody"; backpack = "B_Carryall_cbr"; // B_AssaultPack_mcamo B_AssaultPack_rgr_LAT null = execVM "RespawnSquad.sqf"; init=" this addAction [""<t color='#FF0000'>M2A4 Slammer UP $1200</t>"", ""ArmorDrop.sqf"",[],0,true,true,"""",""sector1 getVariable 'owner' == side _this and _this distance _target <1""]"; player="PLAYER COMMANDER"; }; class WEST2 { // Alternative configuration pointing to a CfgVehicles class. Loadout will be copied from it. vehicle = "B_soldier_AR_F"; init=" this addAction [""<t color='#FF0000'>M2A4 Slammer UP $1200</t>"", ""ArmorDrop.sqf"",[],0,true,true,"""",""sector1 getVariable 'owner' == side _this and _this distance _target <1""]"; // _handle = player execVM "CreateGroup.sqf"; // waitUntil {scriptDone _handle}; items[] = { "Item_Medikit" }; }; class WEST3 { // Alternative configuration pointing to a CfgVehicles class. Loadout will be copied from it. vehicle = "B_soldier_M_F"; init=" this addAction [""<t color='#FF0000'>M2A4 Slammer UP $1200</t>"", ""ArmorDrop.sqf"",[],0,true,true,"""",""sector1 getVariable 'owner' == side _this and _this distance _target <1""]"; // _handle = player execVM "CreateGroup.sqf"; // waitUntil {scriptDone _handle}; uniformClass = "U_B_GhillieSuit"; }; class EAST1 { // Alternative configuration pointing to a CfgVehicles class. Loadout will be copied from it. vehicle = "O_Soldier_AT_F"; init=" this addAction [""<t color='#FF0000'>T-100 Varsuk $1200</t>"", ""O_ArmorDrop.sqf"",[],0,true,true,"""",""sector1 getVariable 'owner' == side _this and _this distance _target <1""]"; // _handle = player execVM "CreateGroup.sqf"; // waitUntil {scriptDone _handle}; }; class EAST2 { // Alternative configuration pointing to a CfgVehicles class. Loadout will be copied from it. vehicle = "O_soldier_AR_F"; init=" this addAction [""<t color='#FF0000'>T-100 Varsuk $1200</t>"", ""O_ArmorDrop.sqf"",[],0,true,true,"""",""sector1 getVariable 'owner' == side _this and _this distance _target <1""]"; // _handle = player execVM "CreateGroup.sqf"; // waitUntil {scriptDone _handle}; }; class EAST3 { // Alternative configuration pointing to a CfgVehicles class. Loadout will be copied from it. vehicle = "O_soldier_M_F"; init=" this addAction [""<t color='#FF0000'>T-100 Varsuk $1200</t>"", ""O_ArmorDrop.sqf"",[],0,true,true,"""",""sector1 getVariable 'owner' == side _this and _this distance _target <1""]"; // _handle = player execVM "CreateGroup.sqf"; // waitUntil {scriptDone _handle}; }; }; Share this post Link to post Share on other sites
f2k sel 164 Posted May 3, 2014 I would suggest a separate thread, Along the lines of How to respawn with current addactions. You might try just adding this to the player, in theory it might add the action back on respawn, but with MP I'm only guessing player addEventHandler ["RESPAWN",{ _id = (_this select 0) addAction ["<t color='#FF0000'>M2A4 Slammer UP $1200</t>", "ArmorDrop.sqf",[],0,true,true,"","( missionnamespace getVariable 'sector' select 1 ) == side _this"] } ]; Share this post Link to post Share on other sites
BEAKSBY 11 Posted May 4, 2014 As you suggested I started a new thread here. I will test using MPRespawn...thanks for the on-going support. Share this post Link to post Share on other sites