-
Content Count
719 -
Joined
-
Last visited
-
Medals
Everything posted by opusfmspol
-
When would command "forceEnd" be required?
opusfmspol posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Can anyone explain when the use of forceEnd command would be required? Does it have a use in A3 or has it become deprecated with BIS_fnc_endMission, BIS_fnc_endMissionServer and BIS_fnc_forceEnd (which oddly enough, doesn't use forceEnd command at all)? The wiki description is rather fuzzy, saying it "sets the flag which tells engine that the mission end was forced", but no explanation of how the flag impacts mission ending. Wiki shows it has local effect, but seems to do nothing in editor. Placed in an "END#x" or "LOSE" trigger, it's the trigger type that seems to force the ending, not the command. Remove the forceEnd command and mission still ends when condition is met. I'd like to understand its proper use, if it has one. Searching has not been enlightening this time around.-
- commands
- end mission
-
(and 1 more)
Tagged with:
-
synchronizeObjectsAdd
opusfmspol replied to gmangnall's topic in ARMA 3 - MISSION EDITING & SCRIPTING
The High Command module doesn't monitor for changes in synchronizations. Some modules do I suspect, but it's one that doesn't. You could reinitialize by running its "hc.sqf" script again, but then it creates a new instance of the "hc_local.sqf" running on each connected machine. Each would end up with multiple instances of the same script running. You'd want to terminate each one's old instance for the new instance, or better yet not have a new instance run if their old instance still works proper following HC reinit. The HC module initializes by an eventhandler rather than function. The eventhandler execVM's the HC script. What I've done in the past (A2) was copied the HC module scripts to mission folder, and changed the scripts in mission folder to suit the need. Then placed a regular Game Logic on map and have it run revised HC eventhandler code, running the mission scripts instead of the core scripts. Basically the game logic acts as a surrogate HC, to run the scripts from mission folder instead of core. In that way I could get HC's Radio Waypoints and F5 "assign missions" menu to work in Warfare. Just tested, and this method does still work with A3, syncing HC Subordinate modules to the Game Logic. If you should choose that route, look for where the BIS_fnc_MP call is made to execVM hc_local.sqf on each machine. - Not running a new instance on clients: You'd want to control the call, only having it occur on first initialization, not on subsequent ones. - Or, running a new instance on clients: You'd have to work out a way to terminate the old instance on clients. Somehow find a way to capture and store each script handle, and issue them a terminate command when the new instance is going to run. But running a game logic as surrogate with mission scripts, you'll have much freedom to make the different HC scripts work as you intend. -
Setting and reading variables in triggers
opusfmspol replied to ernave's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Yes, but since isPlayer could occasionally give a bad false return, (_x In allPlayers) might be better. -
Spawning Missile midair to hit a helicopter
opusfmspol replied to seriousxD's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
"BIS_fnc_Init" is still true in A3 after functions compile, so yeah should work, but classnames would have to be changed to whatever the A3 proxies are. -
"ArmaModeClass" - where can I find it?
opusfmspol replied to SwissArmy1984's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Agreed. The OFP and Arma labels were apparently intended to help clarify, but in fact make it have to be somewhat deciphered: ModeClass: class Mode. Must be declared (or inherited) for each class. MuzzleClass: class Muzzle. Must be declared (or inherited) for each class. OFPModeClass: class Mode. Must be declared (or inherited) for each class. Generally moved to Arma's cfgMagazines Class and often renamed, else simply renamed. ArmaModeClass: class Mode. Must be declared (or inherited) for each class. Introduced from OFP:E and beyond. -
Setting and reading variables in triggers
opusfmspol replied to ernave's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Yes. And 0 is returned if setVariable hasn't been done. -
"ArmaModeClass" - where can I find it?
opusfmspol replied to SwissArmy1984's topic in ARMA 3 - MISSION EDITING & SCRIPTING
-
Setting and reading variables in triggers
opusfmspol replied to ernave's topic in ARMA 3 - MISSION EDITING & SCRIPTING
thisTrigger is refence to the trigger itself in triggerStatements. No need to give the trigger a name unless needed for reference elsewhere. If you want the set variable unique to one trigger, give one trigger a name and there use thisTrigger setVariable [ ] and thisTrigger getVariable [ ]. In all the other triggers put <trigger name> getVariable [ ], using reference to that one trigger's name. Or, if you need the set variable unique to each trigger individually, no need to name the triggers. in each trigger use thisTrigger setVariable [ ] and thisTrigger getVariable [ ]. -
Custom module and synced vehicles
opusfmspol replied to pierremgi's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Have encountered the same before. The colon : causes the issue (insert puns here). Using setVehicleVarName resolved it for me. With colon : , preprocessor mad, but with vehicleVarName, preprocessor happy. -
6thSense.eu - Locality Helped me much with understanding locality, but it was just a start. There's so much more, and I can't hit it all, others might chime in to help. But here's my experience. When scripting for MP you must always, with every script, keep in mind which machines will be running that particular script. Server? Client? Both? or maybe even a Headless Client? You have to keep your head wrapped around that. Argument local: When reviewing script commands and you find the argument is an object, and the command is "Argument Local" (e.g. setFuel), it means is that the object (in this case a vehicle) has to be local to the machine issuing the command, whether server or client. With AI, they might be local to the server or not. AI are usually local to the server, right?... one might think. But with a driver who is AI subordinate to a player leader, the vehicle is local to the player leader machine. This is where one would use local command: "if (local vehicle1) then {vehicle1 setFuel fuelAmount};" Effect Local: The local command is "argument global", and what that means is the object must exist on all machines. There is a command createVehicleLocal which has only local effect, i.e the vehicle would exist only on the machine that runs the command. Hint and addAction are also local effect. It means the hint only occurs on, or the action only exists on, the machine running the command. If you want it to occur on all player machines, the command has to be run on those machines. That would mean the script is spawned, called or execVM'd by the target machines, or Public Variable Event Handler is used, or remoteExec (allows suspension) or remoteExecCall (does not allow suspension) are used to target them. Headless and Dedicated: But AI can also belong to a headless client, which is a player and yet not a player. It's a machine run to offload AI functions, so the server can run faster doing basic processes while the headless handles its AI functions. In essence it's like having another proxy server, yet the headless client AI leader is registered as a player and it's AI subordinates are local to the headless client machine. Headless client has no user interface (UI), neither does a dedicated server. So to exclude those two and only target real player client machines, one can use "if (hasInterface) then { . . . };" Dedicated server has no player. Player is objNull on a dedicated server. This is why when scripting for MP you should avoid using player command in any server or common scripts. Using it in client or headless scripts is fine. But if a dedicated server runs a server or common script which issues a player command expecting a return, it could error and maybe even terminate the script. Effect Global and Editor Triggers/Waypoints: When you see a command that has "effect global" (e.g. createVehicle), it means you will usually only want that command to run on only one machine. Because the result will propagate over to all machines. This is important to keep in mind with Editor triggers and waypoints. They will exist on all machines that load the mission. Many times people post "Why am I getting (_x number of vehicles) created when a (trigger/waypoint) goes off?" First response: "Is it an editor (trigger/waypoint)?" - - "yes." (been there, done that). Usual fix is to localize the condition so only the server runs the global effect command, or a specific client machine if that's what is better for the mission. Instead of just "this", condition would be "this && isServer", or "this && local TeamLeader1". In MP you'll have problems with synced LOAD and GETIN waypoints when the vehicle and troops are not local to the same machines. I suspect (not confirmed) it might be that the two waypoints use the unitReady command on each other. My tests with unitReady command have shown that the command is "local argument". It only returns a correct true/false on the machine where the unit is local. On any other machine, where the unit is not local, it always returns "true". And that causes unexpected results when a mission event, like deployment or extraction, relies on it. Finally, with waypoints, I had an MP problem and ran a test one time, which found that only the machine where the group leader was local did the condition check, but the waypoint expression was run on all machines when the condition returned true. It had the standard placement condition. However I can't say whether that was a local mission issue or not, I don't believe it was. I've kept that in mind ever since. I would invite others to test whether it's true or not. So this final observation, take with a grain of salt. --- Edit: Reviewed that particular mission again, and recalled the waypoint had not used standard placement condition as first thought. Extraneous code was run in a waypoint condition field ahead of the returned waypoint condition "true". But the extraneous code only occurred on one machine, where it was expected to occur on all. To find out why not, diag_log's were added. The WP condition diag_log only logged on the machine where the leader was local. The WP expression diag_log was logged on all. That's when I figured that waypoint conditions are only checked on the machine where the group leader is local.
-
Local Variable in Global Space
opusfmspol replied to anaximandross's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thanks very much Larrow, I've been unaware of that. Got some uses for it too, now that I know. -
Local Variable in Global Space
opusfmspol replied to anaximandross's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I just remembered, with addAction the passed in params are (_this select 3). (_this select 3) params ["_marker","_foodCost"]; bas_num = (_this select 3) select 2; -
Local Variable in Global Space
opusfmspol replied to anaximandross's topic in ARMA 3 - MISSION EDITING & SCRIPTING
No, it broadcasts the global variable so others get synched as to its value. But you have to broadcast it as a string: GLOBALFOOD = _foodRemaining; publicVariable "GLOBALFOOD"; -
Local Variable in Global Space
opusfmspol replied to anaximandross's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Check the flagpole addaction, make sure base_4 is string "base_4". -
Local Variable in Global Space
opusfmspol replied to anaximandross's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Error >: Type Object, expected Number,Not a Number _globalFood is defined from GLOBALFOOD, so the error indicates that somewhere GLOBALFOOD is somehow being redefined as an object. -
Local Variable in Global Space
opusfmspol replied to anaximandross's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Incorrect structure of the params: params [ ["_marker","_foodCost"] ]; Test with this: params ["_marker","_foodCost"]; If unaware, this page lists all the commands as links to instructions on how each command can be structured and used. -
Local Variable in Global Space
opusfmspol replied to anaximandross's topic in ARMA 3 - MISSION EDITING & SCRIPTING
getVariable cannot get number from namespace. Since it's missionNamespace, just use _globalFood = GLOBALFOOD; -
Local Variable in Global Space
opusfmspol replied to anaximandross's topic in ARMA 3 - MISSION EDITING & SCRIPTING
This is where the debug lines come in handy. As the flagpole addaction params, put this: [base_4,10,-1]. The -1 will cause .rpt log of the passed in params, so you can see what was passed in. Locate the cause of the bad param, fix it, change -1 back to 4 and test. -
Local Variable in Global Space
opusfmspol replied to anaximandross's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Test with this: if(!isServer) exitWith{}; //add a new parameter for array of markers being passed into createBasePlots params [ ["_marker","",[""]], ["_foodCost",99999,[0]] ]; base_num = Param [2,-1,[0]]; if (_marker == "") exitWith {diag_log format ["Debug Error (BaseClaim.sqf): Invalid marker passed in params (%1)",_this];}; if (_foodCost == 99999) exitWith {diag_log format ["Debug Error (BaseClaim.sqf): Invalid food cost passed in params (%1)",_this];}; if (base_num < 0) exitWith {diag_log format ["Debug Error (BaseClaim.sqf): Invalid base number passed in params (%1)",_this];}; //Counts number of enemies around the desired marker _units = []; {if (side _x == east && {_marker distance2D _x < 100}) then {_units pushBack _x};} forEach allUnits; _cnt = count _units; hint format["Count: %1",_cnt]; comment "rest of script follows here . . . ." -
Local Variable in Global Space
opusfmspol replied to anaximandross's topic in ARMA 3 - MISSION EDITING & SCRIPTING
if(isServer) exitWith{}; //params ["_marker", "_foodCost"]; if(!isServer) exitWith{}; Correct. It's exiting script whether server or not server. -
Local Variable in Global Space
opusfmspol replied to anaximandross's topic in ARMA 3 - MISSION EDITING & SCRIPTING
params ["_facilityPositon","_facilityType"] _storPosit = getMarkerPos "_facilityPositon"; Should be: params ["_facilityPositon","_facilityType"] _storPosit = getMarkerPos _facilityPositon; . . . and param "_facilityPositon" should be a string passed in, specifically, the marker name. this addAction["Claim Base (10 Food)","BaseFunctions\ClaimBase.sqf",[base_4,10]]; You removed the "base_num" value (was [base_4,10,4] previously). The prior post with base_num = _this select 2 was intended to catch and define it being passed in. -
Local Variable in Global Space
opusfmspol replied to anaximandross's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Seems fine, so the question becomes whether there is an error in the calling script. I presume this is a return, i.e. another script calls and this gets returned back to the call. Review the calling script, particularly the call itself. The error is saying that for some reason an " ] " is expected, but it's encountering " [ " instead (first line of the return). Edit -- oops, we cross-posted at the same time -
Local Variable in Global Space
opusfmspol replied to anaximandross's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Warning Message: File C:\Users\chase\Documents\Arma 3 - Other Profiles\Harbor\missions\State%20of%20Disorder.Malden\Compositions\foodstor_s.sqf, line 1: Config: .: '[' encountered instead of ']' This keeps repeating. Check your coding in file "foodstor_s.sqf". -
Local Variable in Global Space
opusfmspol replied to anaximandross's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Clear the .rpt log and run the mission once. What does .rpt log report as the issue? Also might try expanding the params and adding debug lines to catch bad values that pass in. if(!isServer) exitWith{}; params [ ["_marker","",[""]], ["_foodCost",99999,[0]] ]; if (_marker == "") exitWith {diag_log format ["Debug Error (BaseClaim.sqf): Invalid marker passed in params (%1)",_this];}; if (_foodCost == 99999) exitWith {diag_log format ["Debug Error (BaseClaim.sqf): Invalid food cost passed in params (%1)",_this];}; -
Local Variable in Global Space
opusfmspol replied to anaximandross's topic in ARMA 3 - MISSION EDITING & SCRIPTING
//Counts number of enemies around the desired marker _units = allUnits select {side _x == east && _marker distance2D _x < 100}; _cnt = count _units; This line appears in error. Select doesn't use the magic variable "_x", count and forEach do. Try this: //Counts number of enemies around the desired marker _units = []; {if (side _x == east && {_marker distance2D _x < 100}) then {_units pushBack _x};} forEach allUnits; _cnt = count _units; --- Edit: Larrow corrects in post #41, that Select command does use magic "_x" variable in alternative syntax. Much appreciated.