-
Content Count
4333 -
Joined
-
Last visited
-
Medals
Everything posted by Grumpy Old Man
-
Need help to complete a task when dropping an item on the ground in a trigger area
Grumpy Old Man replied to CoolSpy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Depends on how idiot proof you want to do this. Are there other backpacks of the same type in the mission? If yes, then you should keep track which player picked it up and keep track if the backpack has been passed to other players, could be tricky/impossible if the backpack ends up inside a vehicles cargo storage, together with other backpacks of the same type. A simple approach would be this: //initPlayerLocal.sqf player addEventHandler ["Put", { params ["_unit", "_container", "_item"]; if (_item isEqualTo "B_Messenger_Coyote_F" AND _unit distance dropPoint < 2) then {missionNamespace setVariable ["GOM_fnc_backpackDelivered",true,true]}; }]; And in the trigger that sets the task when the backpack has been dropped: time > 3 AND missionNamespace setVariable ["GOM_fnc_backpackDelivered",true] Also place an object where the backpack should be dropped, dropPoint in this example, task will only return true when the BP has been dropped within 2m of the droppoint. Only foolproof if this backpack is the only one of its type in the mission. Demo mission. Cheers -
Can't find missing semicolon
Grumpy Old Man replied to th3gingergamer's topic in ARMA 3 - MISSION EDITING & SCRIPTING
waitUntil {_playerCalling distance _type > 10}; Most likely this line. _type holds an array of strings, distance expects an object or location. Cheers -
Need help to create a task to pickup a particular enemy backpack?
Grumpy Old Man replied to CoolSpy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Set it up like this: //initPlayerLocal.sqf player addEventHandler ["Take", { params ["_unit", "_container", "_item"]; if (_container isEqualTo YourBackPackUnit AND _item isEqualTo "B_Messenger_Coyote_F") then {missionNamespace setVariable ["GOM_fnc_backpackTaken",true,true]}; }]; Trigger condition that changes task state: time > 3 AND missionNamespace getVariable ["GOM_fnc_backpackTaken",false] Demo mission. Cheers -
Need help to create a task to pickup a particular enemy backpack?
Grumpy Old Man replied to CoolSpy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
There's multiple ways. How are you handling your tasks? Via script or editor modules? Cheers -
Need help to create a task to pickup a particular enemy backpack?
Grumpy Old Man replied to CoolSpy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Try this: //init field of player or wherever you seem fit: this addEventHandler ["Take", { params ["_unit", "_container", "_item"]; if (_container isEqualTo YourBackPackUnit AND _item isEqualTo "B_Messenger_Coyote_F") then {systemchat "Backpack taken!"}; }]; Place a unit holding the respective backpack and name it YourBackPackUnit. Should do the trick. Adding the money pile as item isn't possible without a mod, as far as I know. Cheers -
How To Change Countermeasures
Grumpy Old Man replied to socs's topic in ARMA 3 - MISSION EDITING & SCRIPTING
No idea if it's even possible to attach a lightPoint to the flare projectile, since CMFlares returns objNull on a fired eventhandler, at least last time I checked. Made something similar for UGL or mortar/arty flares. Thread might still be worth a read. Only some ugly workaround like spawning a physx object like a small can, give it appropriate movement vectors and attach the spawned lightpoint to them could probably do the trick. Doubt it'll be performance friendly though. Cheers -
setHitPointDamage = local ??
Grumpy Old Man replied to xjoker_'s topic in ARMA 3 - MISSION EDITING & SCRIPTING
You're passing 3 parameters in wrong syntax to the setHitPointDamage command via remoteExec. Try this: [_x, ["hitFuel", 0.5]] remoteExec ["setHitPointDamage", _x]; Cheers -
Do you have a repro mission for that? Which tank/target? AI gunner not aiming straight at a target is usually caused by wrong weapon (selected machine gun when target is a tank) or there's no clear line of sight. Cheers
- 5180 replies
-
- branch
- development
-
(and 1 more)
Tagged with:
-
smallarms NIArms Release Thread
Grumpy Old Man replied to toadie2k's topic in ARMA 3 - ADDONS & MODS: COMPLETE
Depends, can you dual wield the Mk.17? Cheers -
Is the cannon the currently selected weapon of the gunner? Cheers
- 5180 replies
-
- branch
- development
-
(and 1 more)
Tagged with:
-
Player teleport outside Trigger
Grumpy Old Man replied to DerToXXic's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Probably not that important in a simple script like that, but defining a variable named _side that's holding a string data type will just open a can of worms in the long run. Variables should always give at least a hint to what they're holding. You're also not passing the _caller to the teleportUnit.sqf. It's also easier to use find and select in this case, since the amount of sides are finite, something like this is easy to read and adjust: //on Activation: null = [player] execVM "teleport\teleportUnit.sqf"; //teleportUnit.sqf params ["_caller"]; _markers = ["bluforspawn","opforspawn","indforspawn","civspawn"];//just some examples _sides = [west,east,resistance,civilian];//west will select "bluforspawn" and so on _index = _sides find side _caller; if (_index isEqualTo -1) exitWith {systemchat "Invalid side, no teleport chosen"};//exit just in case _marker = _markers select _index; _caller setPos getMarkerPos _marker; Cheers -
No errors but no result either
Grumpy Old Man replied to Knifedge's topic in ARMA 3 - MISSION EDITING & SCRIPTING
You're missing the second quotation mark for fnc_RadioMessage. Cheers -
Did you try asking the respective mod authors? The mission editing and scripting forum is barely the right place for discussing mods/mod issues. Cheers
- 1 reply
-
- 2
-
Player teleport outside Trigger
Grumpy Old Man replied to DerToXXic's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Check the syntax. getPos only works with objects or locations. If you need to get a markers position you need to use getMarkerPos together with a string. _caller setPos (getpos (bluforspawn));//won't work _caller setPos (getMarkerPos "bluforspawn");//should work Cheers -
So if Mozart composed a concerto for solo violin, the violin manufacturer becomes the owner? That's not how it works, heh. Cheers
-
General Discussion (dev branch)
Grumpy Old Man replied to DnA's topic in ARMA 3 - DEVELOPMENT BRANCH
New threat? SAM sites have been important and incredibly powerful since their introduction with jets DLC, if properly set up. With a wee bit of initial set up you can make AA missile platforms fire over 10km+. Transmitting information from a radar scouting vehicle to a dedicated SAM system or site (all seem to be limited to 16km receiving range) you can easily build a network to cover all airspace. Fortunately for all pilots no MP missions are utilizing this: Imagine having something like this on KotH. Cheers -
Player Proximity Scan
Grumpy Old Man replied to webbie.'s topic in ARMA 3 - MISSION EDITING & SCRIPTING
Well you went from wanting a simple hint over an addAction and now it should only run for n seconds. Best make up your mind regarding wanted functionality first. Doubt it's considered convenient having to activate an addAction every 5 seconds but here you go: GOM_fnc_scan = { params [["_scanObject",objNull],["_scanRadius",15],["_duration",5],["_debug",false]]; _scanObject setVariable ["GOM_fnc_scanActive",true,true]; if (_debug) then {systemChat "Starting to scan!"}; hint "Starting to scan!"; sleep 1; _stopTime = time + _duration; waitUntil { _nearPlayers = (_scanObject nearEntities _scanRadius) - [player] select {isPlayer _x}; hintsilent format ["Scan duration: %1\nPlayers detected: %2",[-(time - _stopTime),"HH:MM"] call BIS_fnc_timeToString,count _nearPlayers]; time > _stopTime }; if (_debug) then {systemChat "Stopped scanning!"}; _scanObject setVariable ["GOM_fnc_scanActive",false,true]; hint "Stopped scanning!"; }; //add scan action to object player addAction ["5s Scan for Players",{ params ["_object","_caller","_ID"]; _scan = [_object,15,5] spawn GOM_fnc_scan; },[],0,true,true,"","_this isEqualTo vehicle _this AND !(_this getVariable ['GOM_fnc_scanActive',false])",5]; Cheers -
Player Proximity Scan
Grumpy Old Man replied to webbie.'s topic in ARMA 3 - MISSION EDITING & SCRIPTING
If you want every player to have the addaction on all of the objects simply put the above example into initPlayerLocal.sqf, so every client connecting will receive the actions automatically. Cheers -
Player Proximity Scan
Grumpy Old Man replied to webbie.'s topic in ARMA 3 - MISSION EDITING & SCRIPTING
GOM_fnc_scan = { params [["_scanObject",objNull],["_scanRadius",15],["_debug",false]]; if (_debug) then {systemChat "Starting to scan!"}; hint "Starting to scan!"; sleep 1; waitUntil { _nearPlayers = _scanObject nearEntities _scanRadius select {isPlayer _x}; hintsilent format ["Players detected:\n%1",count _nearPlayers]; !(_scanObject getVariable ["GOM_fnc_scanActive",true]) }; if (_debug) then {systemChat "Stopped scanning!"}; hint "Stopped scanning!"; }; //add scan action to object test addAction ["Scan for Players",{ params ["_object","_caller","_ID"]; if (_object getVariable ["GOM_fnc_scanActive",false]) exitWith { _object setUserActionText [_ID,"Scan for Players"]; _object setVariable ["GOM_fnc_scanActive",false,true]; }; _object setUserActionText [_ID,"Stop scanning for Players"]; _object setVariable ["GOM_fnc_scanActive",true,true]; _scan = [_object,15] spawn GOM_fnc_scan; },[],0,true,true,"","_this isEqualTo vehicle _this",5]; You can activate/deactivate the scanning with a single action, should work fine. What do you mean? This will detect all players, or do you want to add the action for every player? Cheers -
Player Proximity Scan
Grumpy Old Man replied to webbie.'s topic in ARMA 3 - MISSION EDITING & SCRIPTING
Something like this could do the trick: //init.sqf or wherever you seem fit GOM_fnc_scan = { params [["_scanObject",objNull],["_scanRadius",15],["_debug",false]]; GOM_scanActive = true; if (_debug) then {systemChat "Starting to scan!"}; waitUntil { _nearPlayers = _scanObject nearEntities _scanRadius select {isPlayer _x}; hintsilent format ["Players detected:\n%1",count _nearPlayers]; !(_scanObject getVariable ["GOM_fnc_scanActive",true]) }; if (_debug) then {systemChat "Stopped scanning!"}; }; //call function in object init field _scan = [test,15] spawn GOM_fnc_scan; //to disable scanning sometime later, if needed: test setVariable ["GOM_fnc_scanActive",false,true]; Cheers -
Scripting Practice: Generic Error In Expression
Grumpy Old Man replied to Alpine_gremlin's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Well you can always add more randomness, or even weighted randomness. You could do something like this: _spawnParams = [["B_MRAP_01_F","startPos","NONE"], ["B_APC_Tracked_01_CRV_F","startPos","NONE"], ["B_MBT_01_cannon_F","startPos","NONE"], ["B_Heli_Light_01_armed_F","startPos","FLY"] ]; _rndSpawn = selectRandom _spawnParams; _rndSpawn params ["_type","_marker","_special"]; _veh = createVehicle [_type, getMarkerPos _marker, [], 0, _special]; _veh setVehicleVarName _vehicleVarName; _veh call compile format ["%1=_this;", _vehicleVarName]; Or use selectRandomWeighted to make certain types appear more often, with a number between 0 and 1 determining the chance of selection: _spawnParams = [["B_MRAP_01_F","startPos","NONE"],0.5, ["B_APC_Tracked_01_CRV_F","startPos","NONE"],0.35, ["B_MBT_01_cannon_F","startPos","NONE"],0.2, ["B_Heli_Light_01_armed_F","startPos","FLY"],0.1, ]; _rndSpawn = selectRandomWeighted _spawnParams; _rndSpawn params ["_type","_marker","_special"]; _veh = createVehicle [_type, getMarkerPos _marker, [], 0, _special]; _veh setVehicleVarName _vehicleVarName; _veh call compile format ["%1=_this;", _vehicleVarName]; This way you could even randomize markers for spawn position and other stuff. Cheers -
[SOLVED] setHitIndex not changing hitPartIndex damage
Grumpy Old Man replied to whiztler's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Works as intended, first one returns 0.5, second one 0.1. Cheers -
Name command not returning player name?
Grumpy Old Man replied to Knifedge's topic in ARMA 3 - MISSION EDITING & SCRIPTING
_playerName is not defined inside the onMapSingleClick command. Replace it with "name player". Cheers -
Scripting Practice: Generic Error In Expression
Grumpy Old Man replied to Alpine_gremlin's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Why use a switch statement for that? Or was it just for testing purposes? Take a look at scope and scope locality, since a variable is only local to the scope it was created in. As pointed out by @AZCoder you need to define _veh before the switch statement, so the variable exists outside of its scope. To give a vehicle a unique variable name you could use a global approach, not sure what you're trying to achieve with that while loop: if (!isServer) exitWith {}; params [["_veh",objNull],["_driver",objNull],["_group",grpNull],["_unitArray",[]]];//define variables as private and give them default values _myVar = floor random 4; _vehicleVarNameBase = "mts_RandomVic"; //alternative approach to unique var names: _vehicleVarNameNo = missionNamespace getVariable ["TAG_fnc_myVehCounter",1];//will return 1 for the first spawned vehicle and increase with every spawned one _vehicleVarName = _vehicleVarNameBase + str _vehicleVarNameNo; //remove this if my approach is working out for you /* _vehicleVarNameNo = 1; _vehicleVarName = _vehicleVarNameBase + str _vehicleVarNameNo; while {!(isNil _vehicleVarName)} do { _vehicleVarNameNo = _vehicleVarName + 1; _vehicleVarName = _vehicleVarNameBase + str _vehicleVarNameNo; }; */ switch (_myVar) do { case 0: { _veh = createVehicle ["B_MRAP_01_F", getMarkerPos "startPos", [], 0, "NONE"]; _veh setVehicleVarName _vehicleVarName; _veh call compile format ["%1=_this;", _vehicleVarName]; }; case 1: { _veh = createVehicle ["B_APC_Tracked_01_CRV_F", getMarkerPos "startPos", [], 0, "NONE"]; _veh setVehicleVarName _vehicleVarName; _veh call compile format ["%1=_this;", _vehicleVarName]; }; case 2: { _veh = createVehicle ["B_MBT_01_cannon_F", getMarkerPos "startPos", [], 0, "NONE"]; _veh setVehicleVarName _vehicleVarName; _veh call compile format ["%1=_this;", _vehicleVarName]; }; case 3: { _veh = createVehicle ["B_Heli_Light_01_armed_F", getMarkerPos "startPos", [], 0, "FLY"]; _veh flyInHeight 50; _veh setVehicleVarName _vehicleVarName; _veh call compile format ["%1=_this;", _vehicleVarName]; }; }; //increase the vehicle counter missionNamespace setVariable ["TAG_fnc_myVehCounter",_vehicleVarNameNo + 1,true]; _group = createGroup west; _driver = _group createUnit ["B_crew_F", getMarkerPos "startPos", [], 0, "FORM"];//you can also reference the driver using this _unitArray = units _group;//no need for more than this since units group returns an empty array if no units are in the group _driver assignAsDriver _veh; _driver moveInDriver _veh; _wp = _group addWaypoint [getMarkerPos "endPos",0]; [_group,0] setWaypointType "MOVE"; [_group,0] setWaypointCompletionRadius 50; [_group,0] setWaypointSpeed "LIMITED"; //_veh doesn't exist inside the scope as mentioned before, you can use "thisList" for an array of units in the group, or "this" for the group leader _wp setWayPointStatements ["true","deleteVehicle vehicle this;{deleteVehicle _x} forEach thisList"]; Also take a look at setWaypointStatements, this refers to the group leader, while thisList holds an array of units that are in the group. Cheers