xxanimusxx
Member-
Content Count
453 -
Joined
-
Last visited
-
Medals
-
Medals
Everything posted by xxanimusxx
-
Compiled mission read from external file
xxanimusxx replied to zodd's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
You mean read something within a pbo? Normally you don't have to do this because when you insert the pbo into your game (startup-parameter or mission-file) you can access the files within your sqf-scripts pretty easy. But if you really want to load some file within an external PBO which isn't loaded into your game, you have to write a DLL-File which enables you to partly decompile the pbo and get you the file's content. There is no other way I could think of atm. -
Get all units on the map
xxanimusxx replied to Raandom's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Taking this helpful post and extending it to get only the AI units: { if (!(isPlayer _x)) then { // _x is a reference to an AI unit }; } forEach allUnits; -
Spawn/Setobjtexture
xxanimusxx replied to derox's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Ah yes, didn't look up the setObjectTexture command, it's effect is local, so we have to broadcast the command to every client: changeVehicleTexture = { private ["_vehicle", "_textures", "_initCmmd", "_textureID"]; _vehicle = _this select 0; _textures = _this select 1; _initCmmd = ""; _textureID = 0; { _initCmmd = _initCmmd + format["this setObjectTexture [%1, ""%2""];", _textureID, _x]; _textureID = _textureID + 1; } forEach _textures; _vehicle setVehicleInit _initCmmd; processInitCommands; }; if (!isDedicated) then { waitUntil {player == player}; player addEventHandler ["Respawn", { _unit = _this select 0; removeAllWeapons _unit; _unit addWeapon "M16A2"; for "_i" from 1 to 6 do { _unit addMagazine "30Rnd_556x45_Stanag"; }; [_unit, ["texture\Camo4.paa","texture\Camo.paa","texture\Camo2.paa"]] call changeVehicleTexture; }]; }; And to show you the direction to vehicle-respawns: myCar addEventHandler ["killed", { // this will create the same type of vehicle at the same position where the former one was damaged _newVehicle = createVehicle [typeOf (_this select 0), position (_this select 0), [], 0, "NONE"]; deleteVehicle (_this select 0); [_newVehicle, ["texture\Camo4.paa","texture\Camo4.paa","texture\Camo4.paa","texture\Camo4.paa"]] call changeVehicleTexture; }]; This is highly experimental though, didn't test any of these and there are far better respawn-scripts out there! -
Spawn/Setobjtexture
xxanimusxx replied to derox's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Well if you describe your exact scenario with your vehicles, I could try to throw you some chunks of code :) -
Able to destroy intel?
xxanimusxx replied to connorwarman's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
If you want anyone to interact with the box, you have to put the addAction-command into the init-field of the box. Either do it within the editor if you pre-place your box or use the combination of setVehicleInit and processInitCommands to do it if you spawn the box dynamically ingame. -
Able to destroy intel?
xxanimusxx replied to connorwarman's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
addAction setDamage deleteVehicle titleText You can cook something together easily using these commands :D I'd use real evidence (objects) and put that into the box instead of adding some actions to an empty box :) -
Spawn/Setobjtexture
xxanimusxx replied to derox's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Car's cant "respawn" like players do, you have to keep track of the damage and create a new vehicle of the same type and then you can do the same. You could use the "killed" eventhandler. -
Spawn/Setobjtexture
xxanimusxx replied to derox's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
In your init.sqf: if (!isDedicated) then { waitUntil {player == player}; player addEventHandler ["Respawn", { _unit = _this select 0; _unit setObjectTexture [0, "texture\Camo4.paa"]; _unit setObjectTexture [1, "texture\Camo.paa"]; _unit setObjectTexture [2, "texture\Camo2.paa"]; removeAllWeapons _unit; _unit addWeapon "M16A2"; for "_i" from 1 to 6 do { _unit addMagazine "30Rnd_556x45_Stanag"; }; }]; }; -
Map and Shift+Left Click
xxanimusxx replied to deadactionman's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
No it isn't as you already noticed, it's something built into the game which doesn't count towards waypoints or markers. I assume its an image ctrl which gets placed in the map and activates some script to keep track of the distance to that point. Btw: typeOf _vehicle == "Air" will return false, use isKindOf instead. -
Map and Shift+Left Click
xxanimusxx replied to deadactionman's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
ADuke823 made something really similar to your request - he created a minimap for the pilot and copilot of a helicopter and made it possible to add waypoints whenever the (co-)pilot clicked at any point in the map. That could be a little bit overpowered for your "simple" request, and if it is, here's the basic routine to achieve that: Use onMapSingleClick to react whenever someone (with the correct privileges) clicks into the map Check if shift was pressed while clicking (see above link for more information) Use addWaypoint to, uhm, add a new waypoint :D -
typical locality problem scripting MP
xxanimusxx replied to Rick B.'s topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Hm, MP missions are hard to grasp at the very start but if you do some MP missions you'll get the hang of it. The most important thing is to clearly know on which machine you want to execute which script. You'll have to read the biki-article about the commands you use to know if they have some locality limitations! Just take moveInCargo/Driver for instance: these commands require the argument to be local. If drivet1/terror1/gunt1 aren't local to the client where you execute this command, nothing will happen. Vehicles change their locality/ownership to the drivers client. Also there are "local" variants of commands, like createVehicleLocal. These will just execute on the client which invoked them and the effects will stay local to that client as well. Using createUnit or createVehicle is the normal way of spawning stuff, but as you said, this has to be executed just one time because the effects are global. So wrapping this up with "isServer" is the only reliable way. For other purposes, you don't have to use isServer - if you want to change the position of a vehicle, mounting/unmounting or other scenarios where you don't have to be careful of executing it several times, you can just execute it on any client where the action is imminent. These are the basics. To be honest, I don't know what exactly your problem is with the script you posted. It's supposed to do something, but what exactly isn't working? At least repositioning the car should work, if it isn't, then the program flow isn't reaching the if-block. -
Random selection of units
xxanimusxx replied to TobiasRp's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
_randomSoldier = objNull; _units = units grp1; while {isNull _randomSoldier || (vehicle _randomSoldier) != _randomSoldier || isPlayer _randomSoldier} do { _randomSoldier = _units call BIS_fnc_selectRandom; }; Be advised that using this script will most likely create an infinite loop if you have no AI soldiers in your group. Make sure to have at least one AI in your group which isn't in a vehicle before executing this script. -
Send a player into the air from the backseat of the car
xxanimusxx replied to MaldorLevr's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
setVelocity requires the unit/vehicle to be local, maybe that's the problem here? If you're the driver and eject the player, you have to execute the velocity-command on the client which belongs to ejecter. -
Need help with setting up air extract\insertion
xxanimusxx replied to wawa's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
unitName could be misleading in case that you looked the command "vehicle" up in BIKI - it doesn't mean the string representation of the unit, but the reference to it. In you're case you don't even need to use vehicle because you already have a variable with a reference to your blackhawk: BH01. The name you assign your vehicles in the editor are actually global variables pointing to that vehicle (you even used that variable upon calling extract.sqf as a parameter). //Object = _this select 0; <-- ??? _start = getMarkerPos "BHWP1"; // Find the Marker, can be used for extraction\insertion _end = getMarkerPos "BHWP2"; // location of drop off. BH01 setBehaviour "CARELESS"; BH01 addWaypoint [_end, 0]; BH01 setwaypointtype "TR Unload"; This piece of code should instruct your blackhawk to fly to the marker BHWP2 and unload every passenger not in the same group as the pilot/copilot. What you tried to do was assigning a new waypoint to a string :D _BHWP1/2 are just strings, and you can't assign anything to strings. -
Random selection of units
xxanimusxx replied to TobiasRp's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Uhhhh, hmmm, sorry but I really have problems understanding your question right know :D -
add action and arrest script for pvp
xxanimusxx replied to duderide's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Oh wow, easy there dude, disableUserInput is the most evil command in arma2 :D If you forget to enable it again, the user will have to close the whole game (ALT+F4 or taskmanager) because all keyboard and mouse controls will be disabled. Okay, let's have a short lesson here. You've got yourself a command and you want to know why this isn't working, right? So let's check out the BIKI-article concerning disableUserInput. You'll notice the images under the command name in bold at the top of the page. One of them says "eL", which translates to "Effect: Local". This means the effect of the command will only be executed on the client which invoked this command. In our case, you were the one who invoked disableUserInput using the addAction, thus disabling your own input. You had luck because the script stopped running on the invocation because you used the wrong syntax. The BIKI-article states that this command doesn't have any parameters, thus your error. So what do we do about this? Well, it's simple but complicated at the same time. We have to invoke this command remotely on the enemies client you're currently arresting. As for any other scripting part in arma2, this can be achieved with several methods. I'll stick to the RE-command. _action = _this select 2; _gettingDetained = _this select 3; _enemy = objNull; if (_gettingDetained) then { _enemy = cursorTarget; _enemy setVariable ["detained", _gettingDetained]; _enemy addAction ["Arrest Player", "detainAndArrest.sqf", false, 8, true, true, "", "_target distance _this <= 3"]; _enemy playMove "boundCaptive_loop"; } else { // Enemy is being arrested _enemy = _this select 0; _enemy removeAction _action; _arrestPos = (getMarkerPos "arrestMarker"); _arrestPos set [2, 0]; _enemy setPosATL _arrestPos; }; [nil, _enemy, "loc", rSpawn, _gettingDetained, {disableUserInput _this;}] call RE; Didn't test this though :) -
Ejecting a player from a back seat in a car
xxanimusxx replied to MaldorLevr's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
the latter one, select gets you one element of the array, whereas foreach would return an error because you didn't supply an array :D -
exactly, if you want to wait for a specific script, you have to give it a specific name, if you use the same name altogether the triggers will just wait for one of the scripts to return.
-
Oh, okay, you took my example a bit too serious :D Change your blufor trigger's activation field to this: waitForChat = [] execVM "chat1.sqf"; And the condition of the other trigger to: this && scriptDone waitForChat You don't need to reroute using a script-file this way. I hope you made a typo with "chat1.sqs", because in this case you'd have to use "exec" and not "execVM". That and if you use a sqs-file you can't use scriptDone because "exec" doesn't return a script handle.
-
Ejecting a player from a back seat in a car
xxanimusxx replied to MaldorLevr's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Crew is an array, so its understandable that its not working :) { _x action ["eject", vehicle player]; } forEach (crew (vehicle player)); -
Adding map to vehicles
xxanimusxx replied to Highlander's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
The Map is a "weapon", so you have to use addWeaponCargo. Either do it in the init-line of the car: this addWeaponCargo ["ItemMap", 1]; Or in a script: myCar addWeaponCargoGlobal ["ItemMap", 1]; Just tested this and got the map into my SUV without any errors or problems. -
Check what kind of vehicle player is in
xxanimusxx replied to MaldorLevr's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
*cough* typeOf (vehicle player) *cough* -
Heli Land + check all players onboard + takeoff and get a new waypoint
xxanimusxx replied to Bastirip's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Name your heli (for this example I'm gonna use "rescueHeli") and use this as the condition: {_x in rescueHeli && alive _x && isPlayer _x} count playableUnits == {alive _x && isPlayer _x} count playableUnits This will check if the number of people in the heli is the same amount of people currently in your server (independant which side they're on). edit: Okay I just did test this, here's my test setup: I placed a waypoint (type: MOVE) near an (invisible H) and forced the heli to land there (into the act-field: "rescueHeli land 'GET IN';") The next waypoint is of type: HOLD and is synchronized with a trigger (type: Switch) in which I put the above condition. The last waypoint is a MOVE one which leds somewhere far away. The heli flies near the invisible H, lands there and waits until I'm in. I know, this won't qualify to assert the success of this test, but I'm pretty sure the condition will also work in MP :D -
Where you get the ID? The ID equals the script handle, which is contained in the return value of every execVM and spawn invocation. My first code-box shows how the return value of execVM is saved in a global variable named "myScriptID". It has to be global so you can use it in conjunction with triggers. Where you should put the code? How should I know? :D I don't even know for what purpose you need this kind of knowledge so I'm delivering you the basic knowledge you need to put something together on your own :) I just evaluated it for myself and yes, using "scriptDone myScriptID" in a triggers condition really works and triggers when the script you're waiting for is done.
-
add action and arrest script for pvp
xxanimusxx replied to duderide's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Oh, you needed to know WHERE to put it xD Sorry, I thought using the variblename "_gettingDetained" was enough to guide you to the right track :D Replace the comment "// DO some magic here if you want (like animations or setCaptive, its up to you) " with the animation command :D _action = _this select 2; _gettingDetained = _this select 3; _enemy = objNull; if (_gettingDetained) then { _enemy = cursorTarget; _enemy setVariable ["detained", _gettingDetained]; _enemy addAction ["Arrest Player", "detainAndArrest.sqf", false, 8, true, true, "", "_target distance _this <= 3"]; _enemy playMove "ANIMATION-STRING"; } else { // Enemy is being arrested _enemy = _this select 0; _enemy removeAction _action; _arrestPos = (getMarkerPos "arrestMarker"); _arrestPos set [2, 0]; _enemy setPosATL _arrestPos; };