xxanimusxx
Member-
Content Count
453 -
Joined
-
Last visited
-
Medals
-
Medals
Everything posted by xxanimusxx
-
Check animation in trigger?
xxanimusxx replied to FelixK44's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Well yeah I understood that part, but the code you posted in Post #5 is irritating me, like is this the code you actually wrote in your activation field of the trigger or is it the content of your ArrestCheck.sqf? Using that code in a seperate sqf-file won't work because thisList doesn't exist in that scope. Try to put the foreach-loop into the activation field of your trigger, it should work the way you want it. -
Running a script at an exact time. Server time?
xxanimusxx replied to marker's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
The last time I saw something similiar to your question was a custom schedular which executed a set of scripts every 15 minutes (in real time, not ingame time). They used an extension and called it regularely to synchronize the daytime with the real time. This is a rather clumsy way but hey, it worked great :D The corresponding commands: callExtension Extensions I hope there are other means to do this though ^^ -
Check animation in trigger?
xxanimusxx replied to FelixK44's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Now I'm confused once more xD Is this the activation field or the content of your ArrestCheck.sqf? Because if it is the latter, you can't use thisList as it just exists in the scope of the trigger, hence the forEach isn't even executed and the else is never reached ;) -
Check animation in trigger?
xxanimusxx replied to FelixK44's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
I'd say you have to get rid of the double quotes around Reward.sqf as they are only used in strings to escape the quotes :D Normally you'd get a corresponding error message either in your .rpt-file or ingame using the -showScriptErrors parameter. It really helps you figure out what's wrong in your code so you should consider starting your game with the parameter while in development. -
Spawning multiple triggers with variables in onAct statements
xxanimusxx replied to Harzach's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Ah yeah, the createVehicle you're using expects a position-array but you're providing a string (a random name you generated above). I think you have to change ieds set [_iedcount, _name]; into ieds set [_iedcount, _ied]; in the corresponding forEach-loop and further change bomb = ""Sh_105_HE"" createVehicle (ieds select %1); into bomb = ""Sh_105_HE"" createVehicle (getPos (ieds select %1)); Another useful fact: using createVehicle_array is up to 500x faster than using the createVehicle command :D -
Check animation in trigger?
xxanimusxx replied to FelixK44's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Please keep in mind that exec is for sqs-files whereas execVM is used to execute sqf-files. But somehow I'm confused, what do you want again? :D You already posted a solution to your question, so is this script somehow throwing errors? If it does, what does it say? -
MoveInCargo, possibly locality?
xxanimusxx replied to Coding_Camel's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
The MoveIn-Commands are global in effect, but local in arguments. So if _target isn't local to you, nothing will happen. If this is a MP mission and the target isn't an AI which is local to your client, you have to execute the code below on the computer of the player you want to get into the vehicle. I'm not used to other remote execution scripts but the RE-Command so I'll give you a snippet which should work: private ["_vcl","_target","_cop"]; _cop = _this select 0; _vcl = (nearestobjects [getpos _cop, ["Air", "Ship", "LandVehicle"], 3] select 0); _target = objNull; { if((_x distance _vcl < 10) && (animationstate _x == "civillying01")) then { _target = _x; }; } forEach civarray; if (isNull _target) then { _cop sideChat "No civilians close enough to your vehicle!"; } else { _cop sideChat "Civilian has been put in your vehicle!"; getTargetInCar = { _car = _this; player assignAsCargo _car; player moveInCargo _car; }; [nil, _target, "loc", rSpawn, _vcl, getTargetInCar] call RE; }; -
Spawning multiple triggers with variables in onAct statements
xxanimusxx replied to Harzach's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Okay the next thing is: a trigger is non-sheduled and asynchronus, which means the trigger can be used the way triggers are used: activated whenever the condition is met, it can be in some seconds or hours. So basically what your trigger does here is: "Oh, the condition is met, lets execute the code in my activation field. Oh, what's that? A global variable? No problems, just lemme grab the current value of it!". And there's your problem: Assigning the same global Variable in the parameters of your script leads to unwanted results, as in your script gets the same value every time any of these triggers are activated, namely the last element of _zones, _spawns and _ieds. Okay I edited your script from your first post: The first thing I noticed is: You could write all of your code into the while-loop in the top, because the forEach loops are also tied to the number of the elements in the zone-array, which is first determined in the while-loop. You could save a lot of cycles with that :) Okay, what I did here is I simply erased the underscore off of zones, ieds and spawns to make them global (global means global across scripts). Then I replaced the forEach-loop with a counting loop for the triggers. Doing this enables you to use format[] and enumarate through your arrays which are global. Again, I didn't test this so it could throw some errors :D -
Help needed with random spawnpoints
xxanimusxx replied to -TFP- Bridge.J's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
ExecVM is used to execute a SQF-File. You'd insert it like this into your init.sqf: execVM "setSpawnLocation.sqf"; But doing so would create new problems, because you actually want to delay the initialization of your game until a spawn point is chosen and relayed over network to the other clients. Further more I don't think this will really help solve the problem, but it's worth a shot nevertheless. In your shoes I'd try to copy the mission and strip out everything which is not vanilla to be able to discern the problem - if the problem subsides after you put out Invasion and/or CBA, you could slowly put them back and look when the problem is occuring again. -
Help needed with random spawnpoints
xxanimusxx replied to -TFP- Bridge.J's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Not that I know of, I'm not using any mod or anything else but the vanilla arma2. I just exported the mission with this init.sqf as a multiplayer mission, made a new multiplayer game and joined it - worked for me, I saw the text as well as beeing spawn to one of the three locations. So I guess it somehow has to do with your mission additions, maybe something is interfering with your init.sqf or you have to use another scriptfile to place this code? Well, to be honest, I don't know because I didnt ever use Invasion and the like ^^ -
Counter attack script stops after first loop
xxanimusxx replied to craptakular's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
for .... do { }: You are using a colon instead of a semicolon, hence the error. The next time you should look into your .rpt-file or set the startup parameter to see errors while ingame to spot these simple errors :D -
hideObjects help?
xxanimusxx replied to Rick1384's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
_pos = position player; // Could be a marker instead, like: getMarkerPos "hideCenter" _radius = 1000; // In meters _buildings = (_pos nearObjects ["building", _radius]); { _x hideObject true; } forEach _buildings; -
Set Player Scripting Command
xxanimusxx replied to rcmw's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
The command selectPlayer should help you in testing the effect you want. -
Spawning multiple triggers with variables in onAct statements
xxanimusxx replied to Harzach's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Afaik you can't use local variables in triggers as they aren't existent in there (global scope, trying to use local variables in triggers while in editor will get you an error message). You could try this assumptions in converting the local variables you use in your activation field to global ones (just remove the underscore of every variable you use in there and of course in your script above). -
Help needed with random spawnpoints
xxanimusxx replied to -TFP- Bridge.J's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Thats strange, I did test it now and it's working fine for me! I just did paste the code from my last post into my init.sqf and I got to see the text and everytime I joined the game I got another spawn location (which is okay because I'm the server and the only one in the server). You can use whatever name you want to give to your markers, there is no practical limitation (except of special characters I guess). So we have to figure out why this script isn't working for you when it's working for me :D -
addaction and trigger to objects (small) evidence 1(File)?
xxanimusxx replied to craptakular's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Here is an example for that: How to collect evidence If that isn't enough, you could use Trigger something via addAction and the experience you gained from the above link to combine it into a more custom script. -
Help needed with random spawnpoints
xxanimusxx replied to -TFP- Bridge.J's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Okay I think I know why you got placed there and no text appeared: I thought you were using a dedicated server, where the above code would have been executed just the way you wanted. But if you host the game and are the server, the above code would lead to blocking your init, hence no text. Try this init.sqf :D if (isServer) then { _spawns = ["SpawnA","SpawnB","SpawnC"]; // These are your markers. spawnLocation = _spawns select (floor(random(count _spawns))); // This selects the marker name (for example sake it'll equal 1, so "spawn2"). publicVariable "spawnLocation"; }; if (!isDedicated) then { waituntil {!isNil "spawnLocation"}; // Wait until the server did choose a spawnlocation and broadcasted it player setPos (getmarkerpos spawnLocation); titleCut ["", "BLACK FADED", 999]; [] Spawn { waitUntil{!(isNil "BIS_fnc_init")}; titleText ["On the run.","PLAIN DOWN"]; titleFadeOut 7; sleep 3; titleText ["Created by Omegaspectre & Cheeserdude.","PLAIN"]; titleFadeOut 7; sleep 3; titleText ["Your B17 has been shot down behind enemy lines,","PLAIN"]; titleFadeOut 9; sleep 5; titleText ["Now you must try and escape the Germans and get out of Chernarus. Good luck.","PLAIN"]; titleFadeOut 12; sleep 5; // Info text [str ("Behind enemy lines.."), str("30 minutes after crash.."), str(date select 1) + "." + str(date select 2) + "." + str(date select 0)] spawn BIS_fnc_infoText; sleep 3; "dynamicBlur" ppEffectEnable true; "dynamicBlur" ppEffectAdjust [6]; "dynamicBlur" ppEffectCommit 0; "dynamicBlur" ppEffectAdjust [0.0]; "dynamicBlur" ppEffectCommit 5; titleCut ["", "BLACK IN", 5]; }; }; This time the code for the text and setting the position of the player is only executed when the client is not a dedicated server, as it doesn't need to show (it can't even "see") the text and doesn't have a "player" to move :D If this doesn't work either, please report any error messages you encounter (if there were some). -
Arma 2 OA Constant Hint
xxanimusxx replied to speedshooter's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Put into your init.sqf or anywhere and execute it once before using the commands: hintOutputText = ""; hintOutputEnabled = false; hintOutputRefreshSpeed = 1; // in seconds hintOutputEnable = { if (!hintOutputEnabled) then { hintOutputEnabled = true; [] spawn { while {hintOutputEnabled} do { hintsilent hintOutputText; sleep hintOutputRefreshSpeed; }; }; }; }; hintOutputDisable = { hintOutputEnabled = false; hintsilent ""; }; changeHintOutputText = { hintOutputText = parseText _this; }; addHintOutputText = { hintOutputText = format["%1\n%2", hintOutputText, parseText _this ]; }; Now you can activate and deactivate the hints using: // To Activate, insert this anywhere in your scripts call hintOutputEnable; // To Disable call hintOutputDisable; And if you want to change the text: "<t size='1.25'>Welcome!</t>" call changeHintOutputText; // Or if you want to have some multiline text: "<t size='1.25'>Welcome!</t>\n\nAdded two newlines." call changeHintOutputText; If you want to add a new line of text, use this instead (has the same effect like the second example in "changeHintOutputText": "<t size='1.25'>Welcome!</t>" call changeHintOutputText; "Added a new line of Text" call addHintOutputText; I didn't test all of these commands as I typed it in here, so you have to look for errors and debug a bit if there are some :D -
Help needed with random spawnpoints
xxanimusxx replied to -TFP- Bridge.J's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
The problem here is that the init.sqf will be executed for every client AND the server, so naturally all of your players will be placed to a different location. What you need to do is to pick a random spawnlocation and send this to every player who joins (even JIT players). This is done rather easy so here's an example init.sqf: if (isServer) then { _spawns = ["SpawnA","SpawnB","SpawnC"]; // These are your markers. spawnLocation = _spawns select (floor(random(count _spawns))); // This selects the marker name (for example sake it'll equal 1, so "spawn2"). publicVariable "spawnLocation"; } else { waituntil {!isNil "spawnLocation"}; // Wait until the server did choose a spawnlocation and broadcasted it player setPos (getmarkerpos spawnLocation); titleCut ["", "BLACK FADED", 999]; [] Spawn { waitUntil{!(isNil "BIS_fnc_init")}; titleText ["On the run.","PLAIN DOWN"]; titleFadeOut 7; sleep 3; titleText ["Created by Omegaspectre & Cheeserdude.","PLAIN"]; titleFadeOut 7; sleep 3; titleText ["Your B17 has been shot down behind enemy lines,","PLAIN"]; titleFadeOut 9; sleep 5; titleText ["Now you must try and escape the Germans and get out of Chernarus. Good luck.","PLAIN"]; titleFadeOut 12; sleep 5; // Info text [str ("Behind enemy lines.."), str("30 minutes after crash.."), str(date select 1) + "." + str(date select 2) + "." + str(date select 0)] spawn BIS_fnc_infoText; sleep 3; "dynamicBlur" ppEffectEnable true; "dynamicBlur" ppEffectAdjust [6]; "dynamicBlur" ppEffectCommit 0; "dynamicBlur" ppEffectAdjust [0.0]; "dynamicBlur" ppEffectCommit 5; titleCut ["", "BLACK IN", 5]; }; }; -
Arma 2 OA Constant Hint
xxanimusxx replied to speedshooter's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
This effect is achieved using a silenthint and an infinite loop. // Example outputHints = true; outputText = "Welcome!"; while {outputHints} do { hintsilent outputText; sleep 1; }; Now you could easily alter the outputted text by altering the correspondent public variable. For newlines you'd use "\n". outputText = "Welcome!\n\nThis is an simple example."; After you execute the code above you'd get your text altered after a seconds wait. If you want the change to occur immediatly, you should consider to lower the sleep time (like 0.5, but every value under that is unnecessary). Now you know the trick and could do a lot more to get a more programmatic solution, like a format[] or calling a function or whatever, its up to you... -
spawning a group with a trigger
xxanimusxx replied to craptakular's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Look at the lower end of my post, as we are concordant with using the if-statement, it should be alright in MP :) -
AI Zone Restriction
xxanimusxx replied to Big Ben's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
It's as he wrote, we already have a forEach so we just have to check the _x. The resulting activation field for your trigger would look like this: { if (_x !(in zrgroup)) then {_x setDamage 1;}; } forEach thisList; Don't forget to define zrgroup in your init.sqf and initialize it with the variables holding the units you want to spare. -
spawning a group with a trigger
xxanimusxx replied to craptakular's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Well at least your second question is easy to answer: yes, it is possible. Using a finite array consisting of markernames will allow you to cycle through it with a forEach. // Example _markers = ["wp1a", "wp1b", "wp1c"]; // etc... _waypoints = []; _currWp = objNull; _TakGroup1 = [(getMarkerPos "spawnpoint1"), EAST, (ConfigFIle >> "CfgGroups" >> "EAST" >>"BIS_TK" >> "Infantry" >> "TK_InfantrySquad")] call BIS_fnc_spawnGroup; { _currWp = _TakGroup1 addWaypoint [(getmarkerpos _x), 0]; _currWp setwaypointtype "MOVE"; _currWp setwaypointstatements ["True", ""]; _waypoints set [count _waypoints, _currWp]; } forEach _markers; After the loop is done, all your waypoints references are stored in the _waypoints-array (_wp1 = _waypoints select 0, _wp2 = _waypoints select 1, etc). Okay the only problem I see here concerning MP is this script would be executed on all clients once the trigger gets activated, spawning several groups. So you would want to limit this i.e. using a if (isServer) then {execVM "spawnGroup.sqf";} in the activation field of your trigger. But it should suffice to wrap the if-statement around the content of the act.-field you already have. I didn't try it so I don't know if my hunches are correct, so you should test it with a MP mission :D -
call compile problem & preprocessor + add units to array
xxanimusxx replied to jts_2009's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
myBadassRemoteCode = { _name = _this select 0; _lbl = _this select 1; _amount = _this select 2; player groupChat format["%1 GAVE YOU - %2 (%3)", _name, _lbl, _amount]; item = item + _amount; // Other code to execute in here }; { if (_x == Becomer) then { [nil, _x, "loc", rSpawn, [name player, lbText [1, lbCurSel 1], _amount], myBadassRemoteCode] call RE; }; } forEach allUnits; Whatever is in myBadassRemoteCode will be executed in the client which is "Becomer" (has to be a valid unit, player or ai doesn't matter). For more information in using RE, refer to the BIKI-Article. -
call compile problem & preprocessor + add units to array
xxanimusxx replied to jts_2009's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
the variable _x is set within any forEach scope as it is a magical variable representing the current value in the array. I accidentally forgot to delete the line of code after the foreach loop which is now not needed anymore. Are you sure the error message has something to do with the foreach-loop? Like does it show the line number? Concerning the broadcast.sqf... I never saw an init field for a unit like yours. After looking at it for some seconds, I realized somethin which I should have realized sooner: Do you really create a new unit everytime you want to send a globalChat-Message to everyone? That's crazy dude, you don't go creating innocent gamelogics to execute some command on every client, you use the RE-command or CBA to do so. For the lucky lad you are, someone already wrote a thread about remote executing commands. I don't know if all of the ArmA2-Developers will back me up on this, but don't ever mix SQS and SQF Files, use the latter for all of your scripts.