revv
Member-
Content Count
92 -
Joined
-
Last visited
-
Medals
Everything posted by revv
-
[SOLVED] How to detect if player has killed enemy
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Topic title: How to detect if player has killed enemy In my first post I added and someone else posted: if ((isPlayer _killer) && (side _unit == EAST)) then That was the code I was looking for because all I found in older threads were not working for me, I kept getting an error. The NEXT part I need but was not asked in the title is how to add this to a dynamically spawned unit. JShock I have looked at that page and can't figure out what exactly I do with it I have tried this: init.sqf addMissionEventHandler ["EntityKilled", {nul = [_this select 0, _this select 1] execVM "scripts\killed.sqf"}]; and I keep getting the reward when an enemy kills me lol I checked the code and I have in one of the EOS scripts called setSkill.sqf if (EOS_DAMAGE_MULTIPLIER != 1) then {_unit removeAllEventHandlers "HandleDamage";_unit addEventHandler ["HandleDamage",{_damage = (_this select 2)*EOS_DAMAGE_MULTIPLIER;_damage}];}; if (EOS_KILLCOUNTER) then {_unit addEventHandler ["killed", "null=[] execVM ""eos\functions\EOS_KillCounter.sqf"""]}; // ADD CUSTOM SCRIPTS TO UNIT HERE if (EOS_KILLCOUNTER) then {_unit addEventHandler ["killed", "null=[] execVM ""scripts\killed.sqf"""]}; } forEach (units _grp); It's just the part of the script that refers to adding custom script and the only line I added was line 15 -
[SOLVED] How to detect if player has killed enemy
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
EOS is quite complex and I think I have found where to place custom code for spawned units, will post back if it's correct -
Need help, saving/loading to profileNamespace
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Because without sharing my entire mission folder it would make no sense to anyone reading it.All of the broken things were to do with my scripts interacting with Hover Guy's scripts AND the OO_PDW system. Aside from that all of the information on the wiki regarding the saving and loading profileNamespace is accurate, I just wasn't getting the locality stuff right. Having said that I will be publishing my mission when it's complete but if you want to see anything specific just PM me and I can send it to you :) -
Need help, saving/loading to profileNamespace
revv posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello all I am at the point of begging for help to solve this issue. I have been on the wiki, searched google and spent hours on youtube trying to find a solution and I just cant work it out. I have a shop system in place which is working fine, I have a currency system in place which also works fine...what I can't get to work is saving player's money variable so when they come back they have the same amount of money. Gear saves and loads fine using the OO_PDW script but it doesn't handle custom variables. I looked through the pdw script so see how it saves gear and no matter what I do every time a player leaves and reconnects they have 0 cash and right now I have a box set up with an addAction to add more cash for testing and it seems the very first player to connect gets everything working fine but as soon as someone leaves and comes back they can't even use the box to get money. In my init.sqf I have some code which determines if someone has been on the server or not which works fine and if they have not been on the server they run this: initPlayerFirstJoin.sqf //////Set Initial Loadout\\\\\\ if ((typeOf player) == "B_Soldier_F") then { private ["_unit"]; _unit = _this select 0; removeAllWeapons _unit; removeallassigneditems _unit; removeallcontainers _unit; removeuniform _unit; removevest _unit; removebackpack _unit; // "Add containers"; _unit forceAddUniform "TRYK_U_B_Denim_T_BG_WH"; _unit addItemToUniform "ACE_epinephrine"; _unit addItemToUniform "ACE_IR_Strobe_Item"; for "_i" from 1 to 5 do {_unit addItemToUniform "ACE_fieldDressing";}; _unit addItemToUniform "ACE_EarPlugs"; _unit addVest "V_TacVestIR_blk"; for "_i" from 1 to 5 do {_unit addItemToVest "CUP_15Rnd_9x19_M9";}; for "_i" from 1 to 6 do {_unit addItemToVest "CUP_30Rnd_556x45_Stanag";}; _unit addHeadgear "CUP_H_PMC_Cap_PRR_Grey"; _unit addGoggles "CUP_TK_NeckScarf"; // "Add weapons"; _unit addWeapon "CUP_arifle_M4A1_black"; _unit addPrimaryWeaponItem "CUP_acc_ANPEQ_2"; _unit addPrimaryWeaponItem "optic_Hamr"; _unit addWeapon "CUP_hgun_M9"; // "Add items"; _unit linkItem "ItemMap"; _unit linkItem "ItemCompass"; _unit linkItem "ItemWatch"; _unit linkItem "ItemRadio"; }; //////Money Stuff\\\\\\ //HG_myCash = 100000; player setVariable["HG_myCash", 100000]; private ["_oldVal"]; _oldVal = player getVariable "HG_myCash"; ["_oldVal"] call Bank_fnc_saveAccount; hint "First Time Setup Complete..."; I know they money stuff is wrong as it is not working, this is just how it ended up today after messing around with functions for the first time. Now the saveAccount is fn_saveAccount.sqf params ["_oldVal"]; private "_oldVal"; profileNamespace setVariable ["myMoney", (player getVariable "HG_myCash")]; saveProfileNamespace; player sideChat format ["Balance: %1", (player getVariable "HG_myCash")]; So if the player has already been on the server they load: fn_loadAccount.sqf player setVariable["HG_myCash",(profileNamespace getVariable "myMoney")]; So if someone can help me get this working I would appreciate it greatly as I have spent pretty much every waking moment on this for a week now and it's driving me nuts. Just to reiterate this is working perfect for the first person who joins, everything does as it's supposed to for them but anyone else who joins after it does not work and then if that first person leaves and comes back it no longer works for them either. Any help is appreciated BUT please dont just give me a link to the BIKI becasue I have been living on there for a week already lol, if you know what I need is on there then please point it out with some sort of description of what I'm looking for. Thanks! -
[SOLVED] How to detect if player has killed enemy
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Well technically the question in the title was answered but I still have to figure out how to attach it to a dynamically spawned unit, if you know how to do this then please share :) -
[SOLVED] How to detect if player has killed enemy
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
The topic itself was solved however I am going to start a new thread because the issue I am having now isn't exactly the topic question -
[SOLVED] How to detect if player has killed enemy
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Yeah its in the OP however it isn't quite fixed as I thought it was, after testing some more it has an undesired result. Still working on it and going to look into the link JShock posted -
[SOLVED] How to detect if player has killed enemy
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
That is interesting and I'm sure I will make use of it in the future however I just got it working and was coming back to label the thread solved lol. Thanks JS anyway your input is always welcome!! -
[SOLVED] How to detect if player has killed enemy
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Ok will do, however the error is in the init.sqf, last line -
Need help, saving/loading to profileNamespace
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
It says <null> -
Need help, saving/loading to profileNamespace
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
So on initPlayerLocal.sqf I have this: params["_player","_jip"]; /* ----- PDW ----- */ call compilefinal preprocessFileLineNumbers "oo_pdw.sqf"; pdw = ["new","profile"] call OO_PDW; /* ----- End PDW ----- */ HG_myCash = 10000; /* ----- If not first time join, restore gear else set initial loadout ----- */ if(!isNil {profileNamespace getVariable["DMP_FirstJoin",false]}) then { ["clearInventory",_player] call pdw; ["loadPlayer",_player] call pdw; ["loadInventory",[(name _player),_player]] call pdw; remoteExecCall ["Bank_fnc_loadAccount", -2, false]; } else { profileNamespace setVariable["DMP_FirstJoin",true]; saveProfileNamespace; removeAllWeapons _player; removeAllAssignedItems _player; removeAllContainers _player; removeUniform _player; removeVest _player; removeBackpack _player; _player forceAddUniform "TRYK_U_B_Denim_T_BG_WH"; _player addItemToUniform "ACE_epinephrine"; _player addItemToUniform "ACE_IR_Strobe_Item"; for "_i" from 1 to 5 do {_player addItemToUniform "ACE_fieldDressing";}; _player addItemToUniform "ACE_EarPlugs"; _player addVest "V_TacVestIR_blk"; for "_i" from 1 to 5 do {_player addItemToVest "CUP_15Rnd_9x19_M9";}; for "_i" from 1 to 6 do {_player addItemToVest "CUP_30Rnd_556x45_Stanag";}; _player addHeadgear "CUP_H_PMC_Cap_PRR_Grey"; _player addGoggles "CUP_TK_NeckScarf"; _player addWeapon "CUP_arifle_M4A1_black"; _player addPrimaryWeaponItem "CUP_acc_ANPEQ_2"; _player addPrimaryWeaponItem "optic_Hamr"; _player addWeapon "CUP_hgun_M9"; _player linkItem "ItemMap"; _player linkItem "ItemCompass"; _player linkItem "ItemWatch"; _player linkItem "ItemRadio"; [100000,0] remoteExecCall ["HG_fnc_addOrSubCash", -2, false]; remoteExecCall ["Bank_fnc_saveAccount", -2, false]; hint "First Time Setup Complete..."; }; /* ---------- */ _player addAction ["Check Balance", "scripts\myBalance.sqf"]; _player addAction["<t color='#ff9900'>Add Money (+100000)</t>", "scripts\addCash.sqf"]; /* ----- Briefing ----- */ player createDiaryRecord [ "Diary", [ "Welcome", "Welcome to Ronin!<br>Don't forget to equip earplugs before executing an operation, <br>safety first people!" ] ]; /* ---------- */ /* ----- Spawn a thread to give cash to player every 2 minutes ----- */ [] spawn { while {true} do { uiSleep 120; [1000,0] call HG_fnc_addOrSubCash; }; }; /* ---------- */ /* ----- Spawn a thread to save gear every 60 seconds ----- */ [] spawn { while {true} do { uiSleep 60; ["savePlayer",player] call pdw; ["saveInventory",[(name player),player]] call pdw; }; }; /* ---------- */ So HG_myCash is set to 0 which means nothing as it is either updated from Bank_fnc_loadAccount or 100000 is added to it if player has no DPM_FirstJoin. The [100000,0] remoteExecCall ["HG_fnc_addOrSubCash", -2, false]; is the code in post#8 -
Need help, saving/loading to profileNamespace
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Oh right, I have an addAction on players to check that variable. It returns nil and after the money variable is updated like when recieved money it also checks but that returns scalar NaN -
Need help, saving/loading to profileNamespace
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Okay, how can I do that exactly? thanks for the response :) -
Need help, saving/loading to profileNamespace
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
So I am still looking for help on this if anyone can have a look. Trying to figure out why this keeps giving an error. After some more investigation I found that the server must be trying to execute some code where it should not. Here is the file Im having trouble with and the error /* Author - HoverGuy Description - Used to add or substract money from the money variable © All Fucks Reserved To add cash [_amount,0] call HG_fnc_addOrSubCash; To sub cash [_amount,1] call HG_fnc_addOrSubCash; */ params["_amount","_mode"]; private "_oldVal"; _oldVal = player getVariable "HG_myCash"; switch(_mode) do { case 0: { player setVariable["HG_myCash",(_oldVal + _amount)]; }; case 1: { player setVariable["HG_myCash",(_oldVal - _amount)]; }; }; [] call Bank_fnc_saveAccount; The error is line 19 undefined variable _oldVal Any help appreciated -
Need help, saving/loading to profileNamespace
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Sorry where exactly do I put that? Near top after _oldVal = player getVariable "HG_myCash"; ? Or after where the error is on line 14? -
Need help, saving/loading to profileNamespace
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
That's what I thought and I tried that exactly but it gives the same error -
Need help, saving/loading to profileNamespace
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
A little more infor on this I have an error that comes up saying undefined variable #_oldVal line 14 in this file: fn_addOrSubCash.sqf /* Author - HoverGuy Description - Used to add or substract money from the money variable */ params["_amount","_mode"]; private "_oldVal"; switch(_mode) do { case 0: { _oldVal = player getVariable "HG_myCash"; player setVariable["HG_myCash",(_oldVal + _amount)]; }; case 1: { _oldVal = player getVariable "HG_myCash"; player setVariable["HG_myCash",(_oldVal - _amount)]; }; }; _oldVal = player getVariable "HG_myCash"; ["_oldVal"] call Bank_fnc_saveAccount; This is from Hover Guy's simple shop system and it's used for adding and subtracting money via it's function. -
[SOLVED] Trouble selecting element in array
revv posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello I am having trouble with part of my script, I am using a random roadside IED script found here: https://forums.bistudio.com/topic/161027-randomly-generated-roadside-ieds/ That is just for reference. here is the whole of my mission script I am having an issue with: mission_3.sqf // Set mission status for JIP missionStatus = 13; // Code that actually sends this out to other players. publicVariable "missionStatus"; publicVariable "iedX"; [WEST, ["tsk1"], ["Find & disarm the 3 IED's", "Find & Disarm", "Disarm"], [objNull], 1, 2, true] call BIS_fnc_taskCreate; sleep 1; if(!isServer) exitWith{}; //////Thanks Will for help on this one\\\\\\ _iedX = [["iedMkr_1", 3, 20, "West"]] call CREATE_IED_SECTION; _iedArray = _iedX select 0; _iedSelect = _iedArray select 1; sleep 1; // Create marker at the location _marker = createMarker ["iedTargetMkr", getmarkerpos "iedMkr_1"]; _marker setMarkerType "hd_objective"; _marker setMarkerColor "ColorYellow"; _marker setMarkerText "Search"; waitUntil {sleep 0.5; _iedSelect == 3; hint "IED's Remaining: 3"; }; waitUntil {sleep 0.5; _iedSelect == 2; hint "IED's Remaining: 2"; }; waitUntil {sleep 0.5; _iedSelect == 1; hint "IED's Remaining: 1"; }; waitUntil {sleep 0.5; _iedSelect == 0;}; ["tsk1", "SUCCEEDED",true] spawn BIS_fnc_taskSetState; _iedX call REMOVE_IED_SECTION; deleteMarker "iedTargetMkr"; sleep 1; ["tsk1", WEST] spawn BIS_fnc_deleteTask; sleep 3; "scripts\initMissions.sqf" remoteExec ["execVM",2]; From line 17 - 19 (the trouble part) _iedX = [["iedMkr_1", 3, 20, "West"]] call CREATE_IED_SECTION; _iedArray = _iedX select 0; _iedSelect = _iedArray select 1; I am trying to select the second element of the _iedX array (the number 3) so I can keep count how many IED's are left for the player but it keeps returning : generic error in expression at line 18 - "_iedX #select 0;" Any hints or ideas on how to do this correctly? -
[SOLVED] Trouble selecting element in array
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
It seems to be working now and you were on the right track there I used this in the end: waitUntil {sleep 0.5; ("iedSection" call GET_REMAINING_IED_COUNT == 0) && {"iedSection" call GET_IED_SECTION_INFORMATION select 0 == 0} }; It's not giving any errors and I'm in testing phase now. Assume it works unless I report back otherwise. Thanks for your help! -
[SOLVED] Trouble selecting element in array
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
So after some more research I do think it's to do with the functions (still learning ;)) So here is a question and it doesn't just relate to the IED scripts but I will use it as a reference since Im trying to get it working. If I use this: _iedCount = "iedSection" call GET_IED_SECTION_INFORMATION; it says on that particular script author's page that it's supposed to return [#IED'sExploded, #IED'sDisarmed] How exactly would I detect if both of those values have reached "0" inside of a waitUntil? -
[SOLVED] Trouble selecting element in array
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Oh and I know the public variable for iedX is not being used right now I forgot to remove it. -
[SOLVED] How to detect if player has joined
revv posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello I am having difficulty working out how to detect if a player has been on my server and if they have execute some script else execute other script. Anyone know the proper procedure for this? I know it has to do with getPlayerUID but I can't work it out -
[SOLVED] How to detect if player has joined
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thanks both of you for the reply, I finally got it working but sarogahtyp I said in my first post I didn't know the procedure which means I didn't know which commands to use our how to execute them. I eventually stumbled onto another post with some example code on methods for this sort of thing and after some tinkering I figured it out ;) -
[SOLVED] How to detect if player has joined
revv replied to revv's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'm sorry but I don't understand can you be a little more specific please? Which part of my scripts am I to put in there? -
Problems with my mission, help requested!
revv posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I have a random mission picker which picks a mission then spawns an ammobox at a random marker position. The task on all missions currently are all the same which is just to destroy the ammobox. This is all working as intended and I have a marker & task destination waypoint that are created on the ammobox BUT I need the marker and waypoint to be "near" the ammobox and not exactly on it. I have looked it up but can't figure out how to do this, also my tasks have an issue with JIP instead of syncing to current it issues new mission. Here is my mission layout if it helps. Some of you have already seen this code and I'm sorry if it's boring you ;) from now on any issues relating to my mission I will post here so I dont clog the forums with lots of threads. init.sqf // Tasks fnc_miss_array = []; fnc_miss_array pushBack (compileFinal preprocessFileLineNumbers "scripts\mission_1.sqf"); fnc_miss_array pushBack (compileFinal preprocessFileLineNumbers "scripts\mission_2.sqf"); fnc_miss_array pushBack (compileFinal preprocessFileLineNumbers "scripts\mission_3.sqf"); fnc_miss_array pushBack (compileFinal preprocessFileLineNumbers "scripts\mission_4.sqf"); // Check current task for JIP execVM "scripts\iniTask.sqf"; as you can see the in the init.sqf the 4 mission files are ready, all 4 are the same with different text so I know which one is actually running during testing mission_1.sqf "scripts\cache_A.sqf" remoteExec ["execVM",2]; // Set mission status for JIP missionStatus= 11; // Code that actually sends this out to other players. publicVariable "missionStatus"; task_1 = player createSimpleTask ["Mission 1"]; task_1 setSimpleTaskDescription ["Locate & destroy the weapon cache","Find Cache","Search"]; task_1 setTaskState "ASSIGNED"; ["TaskAssigned"] call BIS_fnc_showNotification; player setCurrentTask task_1; so the init.sqf has the 4 mission files set into an array, and are ready to be picked At mission start (or player joining) the init.sqf runs the iniTask.sqf which does some checks for what the current task is (if any) then sets the player on to either the current task or something else. iniTask.sqf if (isNil "missionStatus") then { execVM "scripts\prologueTask.sqf"; } else { execVM "scripts\JIPhandle.sqf"; hint "Welcome, Recieving Operation Data. Standby."; }; When a mission is selected the code on the first line of the mission_1.sqf runs a file called cache_A.sqf ammocrate1 = []; if (isServer) then { // Create weapon cache at random marker ammocrate1 = createVehicle ["B_supplyCrate_F",getMarkerPos "mrk_1",["mrk_2","mrk_3"], 50, "NONE"]; // Create marker at the location _marker1 = createMarker ["cache_A", getMarkerPos "mrk"]; _marker1 setMarkerType "hd_destroy"; _marker1 setMarkerColor "ColorRed"; _marker1 setMarkerText "Find Cache"; [] spawn { while { not isnull ammocrate1 } do { "cache_A" setMarkerPos getPos ammocrate1; sleep 0.5; }; }; }; "scripts\taskDest.sqf" remoteExec ["execVM",-2]; As you will see at the very end it runs taskDest.sqf if (!isNull currentTask player) then { task_1 setSimpleTaskDestination (getMarkerPos "cache_A"); }; sleep 5; (Now that I've had some sleep I am wondering if that exclamation needs to be where it is now or moved to before the bracket?) Anyway that is supposed to update the JIP with the current task destination, but a different problem I'm having is a JIP will actually get a new task and not the one currently running. For anyone interested here is my JIPhandle.sqf hint "Recieving Operation Files...."; sleep 3.0; switch (missionStatus) do { case 10: { execVM "scripts\prologueTask.sqf" }; case 11: { execVM "scripts\mission_1.sqf" }; case 12: { execVM "scripts\mission_2.sqf" }; case 13: { execVM "scripts\mission_3.sqf" }; case 14: { execVM "scripts\mission_4.sqf" }; default { hint "Something went horribly wrong. Please rejoin the server!"; }; }; prologueTask.sqf missionStatus= 10; publicVariable "missionStatus"; //creating the "prologue" mission tasks player createDiaryRecord ["Diary", ["Welcome", "Welcome to Soldiers Of Fortune! <br /><img image='btalogo.paa' /> <br>Don't forget to equip earplugs before executing an operation, safety first people! <br>"]]; M1 = player createSimpleTask ["Prologue"]; M1 setSimpleTaskDescription ["This is the initial mission for players who didn.t JIP.","Mission 1","Map Text Mission 1"]; M1 setSimpleTaskDestination (getPos trig_1); M1 setTaskState "Assigned"; player setCurrentTask M1; The last issue I'm having is an error with my loadout script, I'll post that if someone knows about loadout scripts.