Search the Community
Showing results for tags 'setVariable'.
Found 10 results
-
Hi everyone! I am making a dynamic AI vs AI king of the hill mission and I can't get the AI to capture the sector after it has been moved with setPos. I have programmed parameters to choose the size and location of the target area "sectorModule_F (TA_1)" . Everything is working as intended , script side. However, the spawned groups from the spawn AI modules don't move towards TA_1's new pos. They instead move towards TA_1's original editor placed position. I use setPos and setVariable "pos" to change TA_1's location. this is what I add to the sector modules init filed. This changes the zone size and location to one of 3 test positions. These test positions are logic markers placed in the editor. The zone changes size and location as intended. Players can cap the zone as normal. I need help with understanding the init order of the modules. It seems to me that the sectors location data is stored as a variable in one or more of the 4 sector control modules, as the mission initializes. However, I can't identify the specific variable outside the sectorModule_F that stores the area position so that I can change it with setVariable and make the spawned AI move towards the new sector Pos. Please help me. I used "allVariables" command on the 4 module types that are present in the editor: ModuleMPTypeSectorControl_F, SectorModule_F, ModuleSpawnAI_F, & ModuleSpawnAISectorTactic_F. Please, If anyone who is familiar with these modules and their variables could give me some advice and maybe even a solution I would really appreciate it. Thank you.
- 2 replies
-
- setpos
- sectormodule_f
-
(and 4 more)
Tagged with:
-
setvariable SetVariable for Client only
Vandeanson posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
hiho fellow late night scripters, i am working on a script that adds a deadly infection to the player when damaged ("dammaged" EH) in a MP/COOP scenario. once infected, the player takes damage until cured. for the cure addaction, i need a boolean non local variable per connected client ("global" to the client so i can use it in various scripts, but it can not be public to all clients!) called Infection_Cured. at start, Infection_Cured will be true, and once the player is infected, its set to false until the medication is taken. then it is set back to true and the infection damage loop is stopped (exitwith). i can not test MP and am currently only on my handheld mainly i am very unsure if i understand setvariable correctly. for example, i do not understand why "_var = true;" is needed (copied from bi wiki) hence i would appreciate some opinions on my draft script and possible corrections regarding my attempt to create a variable that is available in all scripts but isolated per player thanks in advance for any help or clarifications! vd -
[MP] How to setVariable to inventory's item?
God of Monkeys posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi, I want to add some variable on my custom item, the variable main purpose is log how many times this item use by any player.(multiplayer) So when this item used times is up to like 10 time, this item will disable and never can be use again. So if there is anyway can get the object in item, then I can setVariable on it and let anyone to take this item, and he will know the use limit. Can this possible? Thx -
Need to setVariable for spawned AI and vehicles
DeadCossack posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi guys, I am developing a pretty ambitious mission for ARMA3 singleplayer. I made a lot of spawns of enemy units to decrease CPU loading on my mission. But I have a serious issue, I can't find a way to give these groups and vehicles a variable names for my triggers to work in case of their elimination and so on. Here is an example of my spawn script: _crewNE = []; _offroad1 = []; _mygroupNE = []; if (isServer) then { _crewNE = creategroup EAST; _OFFROAD1 = [getMarkerPos "vehicleNE", 140, "I_G_Offroad_01_F", _crewNE] call BIS_fnc_spawnVehicle; _wp1 = _crewNE addWaypoint [(getmarkerpos "vNE"), 0]; _wp1 setWaypointType "TR UNLOAD"; _wp1 setWaypointSpeed "FULL"; _wp2 = _crewNE addWaypoint [(getmarkerpos "vNE1"), 0]; _wp2 setWaypointType "SAD"; _wp2 setWaypointSpeed "FULL"; _mygroupNE = [getmarkerpos "vehicleNE", RESISTANCE, ["I_C_Soldier_Bandit_5_F","I_C_Soldier_Bandit_1_F","I_C_Soldier_Para_8_F"," I_C_Soldier_Para_4_F","I_C_Soldier_Para_3_F","I_C_Soldier_Bandit_4_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; _wp1a = _mygroupNE addWaypoint [getmarkerpos "vNE1", 0]; { _x setUnitPos "UP"; } forEach (units _mygroupNE); sleep .5; _mygroupNE1 = _mygroupNE; { _x assignAsCargo (_OFFROAD1 select 0); _x moveIncargo (_OFFROAD1 select 0);} foreach units _mygroupNE; }; -
Who is the person that got the remoteExec ?
JeyR posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Alright. Welcome everyone. I have a very interesting problem, and I couldn't find a solution for it. I have been really trying to get past this but I can't solve this riddle. I have this small code snippet inside the initPlayerLocal.sqf: if (didJIP) then { [getPlayerUID player] remoteExecCall ["CHAB_fnc_jipcam",[-2,-(clientOwner)],false]; }; And here is the CHAB_fnc_jipcam: _uid = _this select 0; private "_player"; private "_local"; private "_localID"; { if ((getPlayerUID _x) isEqualTo _uid) then{_player = _x;}; } forEach allPlayers; _local = ???; _localID = ???; As you can see, I clearly have no clue who is the owner of machine ? In my mind's eye remoteExec sends a message to every player that they have to run this script with the given parameters. Here is what I tried so far: Create a global variable (not public) for each player and give it the playerUID -> Result is that inside the jipcam the returned value is "any" on each PC. Create a missionnamespace variable (global but not public) and give it the playerUID -> same results as before I have completely run out of ideas, I tried mostly everything I could think of. Is there anyone who has more tricks up his sleeve?- 24 replies
-
- remoteexec
- global variables
-
(and 4 more)
Tagged with:
-
Hey guys, I've just registered so, many greets to you all:D Allright, here's the idea: Last night I was bored and played some Tropico, then I thought: How about implementing some small economy to the different locations like the lumberjack camps or banana plantations on Tanoa to hire some guys to work for your Team and earn some money with it. It could lead to a persistent rebell mission where you have to buy new weapons and stuff and defend your economy against the local government or something, don't know exactly, just been playing around, but here is my point: I have set up a first dialog that opens at a laptop at the plantation office like this: If you klick on the different inactive buttons (in fact these are pictures, but I will call them buttons from here on), the script will hire some workers, pay them as you want and you will need some trucks to move the stuff your guys harvestet. Example: If no budget button is active, they all have transparency 0.2. If you just hover over it, transparency is set to 1 to indicate to the player that he can click something. In the case of no active buttons, if player for example clicks on budget button #3, all buttons left from #3 including #3 will switch to active, color transparency changes from 0.2 to 1, colorActive transparency switches from 1 to 0.2. Now you are paying some money, right;D If player now clicks on maybe button #2, buttons #2 and #3 will "deactivate" and change transparency back again. Everything is working fine so far, you get the idea, right? So here are the problems, finally: I need a method that allows me to create just one class (inside controls in dialog.hpp) for the "budget buttons", one for the "worker buttons" and just one for "trucks buttons", wich I can access dynamically via some script to set their position and transparency. Right now, every single button has its own class, so just for this dialog i needed to write 17 classes RscActiveText. I did this because I needed to change the transparency of "color[] = ...." and "colorActive[]=..." every time you click on a button and for this I declared three unique variables for every button, makes 51 global variables in total just to change transparency. First one to let the script know if the button is already clicked, and the two other ones to change the transparency of color and colorActive back and forth, depending on the state of the button. Heres a little summary of a part of the dialog.hpp and the script activated by clicking the buttons. The 51 global variables (and more) ar predefined after init. dialog.hpp: class budg_bttn1: RscActiveText { idc = 1601; text = "pics\moneyPile.paa"; x = 0.840312 * safezoneW + safezoneX; y = 0.258 * safezoneH + safezoneY; w = 0.0154688 * safezoneW; h = 0.022 * safezoneH; color[] = {1, 1, 1, missionNamespace getVariable "bttn_col1"}; //global variable#1 for transparency colorActive[] = {1, 1, 1, missionNamespace getVariable "bttn_actCol1"}; //global variable#2 for transparency onMouseButtonClick = "[_this] execVM 'oumere_plantations\moneyBttns.sqf';"; }; class budg_bttn2: RscActiveText { idc = 1602; text = "pics\moneyPile.paa"; x = 0.87125 * safezoneW + safezoneX; y = 0.258 * safezoneH + safezoneY; w = 0.0154688 * safezoneW; h = 0.022 * safezoneH; color[] = {1, 1, 1, missionNamespace getVariable 'bttn_Col2'}; colorActive[] = {1, 1, 1, missionNamespace getVariable 'bttn_actCol2'}; onMouseButtonClick = "[_this] execVM 'oumere_plantations\moneyBttns.sqf';"; }; class budg_bttn3: RscActiveText { idc = 1603; text = "pics\moneyPile.paa"; x = 0.902187 * safezoneW + safezoneX; y = 0.258 * safezoneH + safezoneY; w = 0.0154688 * safezoneW; h = 0.022 * safezoneH; color[] = {1, 1, 1, missionNamespace getVariable 'bttn_Col3'}; colorActive[] = {1, 1, 1, missionNamespace getVariable 'bttn_actCol3'}; onMouseButtonClick = "[_this] execVM 'oumere_plantations\moneyBttns.sqf';"; //..........etc. etc. moneyBttns.sqf: disableSerialization; _display = findDisplay 5000; _control = (_this select 0) select 0; _controls = [_display displayCtrl 1601, _display displayCtrl 1602, _display displayCtrl 1603, _display displayCtrl 1604, _display displayCtrl 1605]; //_activeButtons = []; //_inacitveButtons = []; switch (ctrlIDC _control) do { case 1601: //checks wich button is clicked on { switch (bttn_active1) do //checks, if button is already active. bttn_active1 switches between 0 and 1 { case 0: { missionNamespace setVariable ["plantationIndex", 1, true]; //plantationIndex tells how many buttons are active in total missionNamespace setVariable [format ["bttn_active%1", 1], 1, true];//sets the buttons active state missionNamespace setVariable [format ["bttn_Col%1", 1], 1, true];//changing of transparency, in this case, button will.. missionNamespace setVariable [format ["bttn_actCol%1", 1], 0.2, true];//...appear with transp. if you hover over it (_controls select 0) ctrlSetTextColor [1,1,1, bttn_Col1];//sending transparency state to class (_controls select 0) ctrlSetActiveColor [1,1,1, bttn_actCol1]; if (debug) then {systemChat format ["PlantationIndex = %1", plantationIndex];}; }; case 1: { plantationIndex = 0; missionNamespace setVariable [format ["bttn_active%1", 1], 0, true]; missionNamespace setVariable [format ["bttn_Col%1", 1], 0.2, true]; missionNamespace setVariable [format ["bttn_actCol%1", 1],1, true]; (_controls select 0) ctrlSetTextColor [1,1,1, bttn_Col1]; (_controls select 0) ctrlSetActiveColor [1,1,1, bttn_actCol1]; for "_i" from 1 to 5 do { missionNamespace setVariable [format ["bttn_active%1", _i], 0, true]; missionNamespace setVariable [format ["bttn_Col%1", _i], 0.2, true]; missionNamespace setVariable [format ["bttn_actCol%1", _i], 1, true]; (_controls select (_i-1)) ctrlSetActiveColor [1,1,1, call compile format ["bttn_actCol%1", _i]]; (_controls select (_i-1)) ctrlSetTextColor [1,1,1, call compile format ["bttn_Col%1", _i]]; }; if (debug) then {systemChat format ["PlantationIndex = %1", plantationIndex];}; }; }; }; case 1602: { switch (bttn_active2) do { case 0: { plantationIndex = 2; for "_i" from 1 to 2 do { missionNamespace setVariable [format ["bttn_active%1", _i], 1, true]; missionNamespace setVariable [format ["bttn_Col%1", _i], 1, true]; missionNamespace setVariable [format ["bttn_actCol%1", _i], 0.2, true]; (_controls select (_i-1)) ctrlSetActiveColor [1,1,1, call compile format ["bttn_actCol%1", _i]]; (_controls select (_i-1)) ctrlSetTextColor [1,1,1, call compile format ["bttn_Col%1", _i]]; }; if (debug) then {systemChat format ["PlantationIndex = %1", plantationIndex];}; }; case 1: { plantationIndex = 1; for "_i" from 2 to 5 do { missionNamespace setVariable [format ["bttn_active%1", _i], 0, true]; missionNamespace setVariable [format ["bttn_Col%1", _i], 0.2, true]; missionNamespace setVariable [format ["bttn_actCol%1", _i], 1, true]; (_controls select (_i-1)) ctrlSetActiveColor [1,1,1, call compile format ["bttn_actCol%1", _i]]; (_controls select (_i-1)) ctrlSetTextColor [1,1,1, call compile format ["bttn_Col%1", _i]]; }; if (debug) then {systemChat format ["PlantationIndex = %1", plantationIndex];}; }; }; }; case 1603: { switch (bttn_active3) do { case 0: { plantationIndex = 3; for "_i" from 1 to 3 do { missionNamespace setVariable [format ["bttn_active%1", _i], 1, true]; missionNamespace setVariable [format ["bttn_Col%1", _i], 1, true]; missionNamespace setVariable [format ["bttn_actCol%1", _i], 0.2, true]; (_controls select (_i-1)) ctrlSetActiveColor [1,1,1, call compile format ["bttn_actCol%1", _i]]; (_controls select (_i-1)) ctrlSetTextColor [1,1,1, call compile format ["bttn_Col%1", _i]]; }; if (debug) then {systemChat format ["PlantationIndex = %1", plantationIndex];}; }; case 1: { plantationIndex = 2; for "_i" from 3 to 5 do { missionNamespace setVariable [format ["bttn_active%1", _i], 0, true]; missionNamespace setVariable [format ["bttn_Col%1", _i], 0.2, true]; missionNamespace setVariable [format ["bttn_actCol%1", _i], 1, true]; (_controls select (_i-1)) ctrlSetActiveColor [1,1,1, call compile format ["bttn_actCol%1", _i]]; (_controls select (_i-1)) ctrlSetTextColor [1,1,1, call compile format ["bttn_Col%1", _i]]; }; if (debug) then {systemChat format ["PlantationIndex = %1", plantationIndex];}; }; }; };//....etc.etc. So, can someone imagine a better practice to solve this idea? As you can imagine, if I want to create more businesses on the island, I need to write a huge amount of classes and variables for every location. The problem is, that If I just use one class using the same global vars for the budget buttons, all buttons change transparency even when I just click a single one. I don't really unserstand how to refer between classes and variables using uiNamespace, maybe there's a solution in there? I hope I explained this one well enough and any help is highly appreciatet. Greets from Germany;D
- 2 replies
-
- dialog
- dialog.hpp
- (and 11 more)
-
Change a vehicle's variable when it's empty
ColonelKernel posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi. How can I change a vehicle's variable when it's empty? (dynamically through the mission) -
Hi all, First off, I am sorry if this is a known issue or if I am just plain wrong: I am new to scripting. I looked on the web but couldn't find anything about this topic... For context, I am trying to create a permanent smoke grenade from script. From the editor, it is straightforward: place a "smoke grenade" module and enable "permanent effect". This -if I am not mistaking- changes the variable "repeat" from 0 to 1. Makes sense. To make sure, I created a smoke grenade module and put "this setVariable ["repeat",1];" in its "init" module. Became permanent. The weird part now is that when I try to set this variable in a script, even though it changes the variable, the grenade pops out of existence after it's normal duration... So I guess this has to be set in the object's "init". But how do you access this init field since setVehicleInit has been disabled? Or do I get the problem wrong? To create the grenade from script and try to make it permanent: smoke_grenade = "SmokeShellGreen" createVehicle _atPosition; smoke_grenade setVariable ["repeat", 1]; As a disclaimer, I am aware that there are workarounds involving while loops, I am not interested in a workaround for this problem; I am trying to understand how Arma3 works.
- 4 replies
-
- setvariable
- script
-
(and 3 more)
Tagged with:
-
Hey. I have a sector module with its costInfantry variable being set to 0.5 on mission start. I have placed triggers that use the setVariable command to change this mid-game and can confirm that the variables change using: hint format ["%1", SECTORNAME getVariable 'costInfantry']; afterwards. However the module doesn't update its variables. By changing this variable to 0, the module should become un-cappable by infantry but as I've found out, this is not the case. Q: Is there a function to force a module to update and use the variables set upon it after initialisation of that module? Thanks.
-
- module
- costinfantry
-
(and 3 more)
Tagged with:
-
[SOLVED] broadcast of variable in variable space of object
sarogahtyp posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I ve some vehicles with variables in their variable space and I want to have them broadcasted betwenn headless client (HC) and server. _squad setVariable["respawtime", 300]; I know that i could set the parameter public to true to broadcast it to all. _squad setVariable["respawnable", 300, true]; But thats more network traffic than I need. Is there a way to use publicVariableServer and publicVariableClient to broadcast that variable? Or is the variable also transferred if I use setOwner to transfer the ownership between server and HC? Thanks a lot for any advice.- 5 replies
-
- broadcast
- setVariable
- (and 6 more)