Jump to content

complacent_lizard

Member
  • Content Count

    12
  • Joined

  • Last visited

  • Medals

Everything posted by complacent_lizard

  1. So here's a weird one: I have a custom function setup in my scenario which: Spawns in an IFV Spawns a group to crew it Spawns a group to ride in the back Tells both groups to drive to a marker and eject the infantry Tells both groups to attack an area with BIS_fnc_taskAttack It works as expected, in fact, quite well. There's just 1 problem - every 2nd time I spawn this function, the infantry in the back dismount as soon as they spawn in and hoof it all the way to the marker. I've tested multiple times and it's consistent. For example, if I spawn this function 8 times, the 1st, 3rd, 5th, and 7th time will work perfectly and the 2nd, 4th, 6th, and 8th will dismount the infantry as soon as they spawn. This occurs in both a singleplayer and multiplayer (LAN) environment. It's too consistent to be a random error - it's clearly something I've missed in how my function is set up but I've had no luck finding a lead for about 5 days now. Here's the function (it is defined within cfgfunctions.hpp and works without spitting out errors when I spawn it): if !(isServer) exitWith {}; _unitClass = "Unknown"; //DEFINE GROUPS _bIfvGroup = ["B_crew_F","B_crew_F"]; _bIfvInfGroup = ["B_soldier_F","B_soldier_F","B_Patrol_Soldier_MG_F","B_engineer_F","B_soldier_F","B_recon_F"]; //SPAWN IFV _bNewVehicleIfv = createVehicle ["B_APC_Wheeled_01_cannon_F", [27635,23853,0], [], 0, "NONE"]; _bNewVehicleIfv setDir 227; _bNewVehicleIfv lockturret [[0,0],true]; clearWeaponCargoGlobal _bNewVehicleIfv; clearMagazineCargoGlobal _bNewVehicleIfv; clearBackpackCargoGlobal _bNewVehicleIfv; clearItemCargoGlobal _bNewVehicleIfv; //SPAWN IFV CREW newBluforIfvCrew = createGroup [west,true]; { _newBluforCrewUnit = _x createUnit [getMarkerPos "bAiSpawn02",newBluforIfvCrew,"newBluforCrewUnit=this"]; { [newBluforCrewUnit] call LIZ_fnc_bCrewLoadout; if alive driver _bNewVehicleIfv then {newBluforCrewUnit moveInGunner _bNewVehicleIfv;} else {newBluforCrewUnit moveInDriver _bNewVehicleIfv;}; newBluforCrewUnit disableAI "FSM"; newBluforCrewUnit allowFleeing 0; newBluforIfvCrew setSpeedMode "FULL"; } foreach units (newBluforIfvCrew); } foreach _bIfvGroup; _bNewVehicleIfv lockDriver true; sleep 2; //SPAWN IFV INFANTRY newBluforIfvInfGroup = createGroup [west,true]; { _newBluforMechUnit = _x createUnit [getMarkerPos "bAiSpawn02",newBluforIfvInfGroup,"newBluforMechUnit=this"]; { if (typeOf newBluforMechUnit == "B_soldier_F") then {_unitClass = "Rifleman";}; if (typeOf newBluforMechUnit == "B_Patrol_Soldier_MG_F") then {_unitClass = "MG";}; if (typeOf newBluforMechUnit == "B_engineer_F") then {_unitClass = "AT";}; if (typeOf newBluforMechUnit == "B_recon_F") then {_unitClass = "Recon";}; switch (_unitClass) do { case "Rifleman": { [newBluforMechUnit] spawn LIZ_fnc_bRifleLoadout; }; case "MG": { [newBluforMechUnit] spawn LIZ_fnc_bMgLoadout; }; case "AT": { [newBluforMechUnit] spawn LIZ_fnc_bAtLoadout; }; case "Recon": { [newBluforMechUnit] spawn LIZ_fnc_bReconLoadout; }; }; newBluforMechUnit moveInCargo _bNewVehicleIfv; newBluforIfvInfGroup setSpeedMode "FULL"; } foreach units (newBluforIfvInfGroup); } foreach _bIfvInfGroup; sleep 1; //RANDOM OBJECTIVE MARKER _randomDismountMarker = ["dismountMarker01","dismountMarker02","dismountMarker03","dismountMarker04"] call BIS_fnc_selectRandom; _randomObjMarker = ["combatMarker01","combatMarker02","combatMarker03"] call BIS_fnc_selectRandom; //SEND ORDERS FOR IFV CREW _wp1 = newBluforIfvCrew addWaypoint [getMarkerPos _randomDismountMarker, 0]; _wp1 setWaypointType "TR UNLOAD"; _wp1 setWaypointSpeed "FULL"; //SEND ORDERS FOR INFANTRY GROUP _wp2 = newBluforIfvInfGroup addWaypoint [getMarkerPos _randomDismountMarker, 0]; _wp2 setWaypointType "GETOUT"; newBluforIfvInfGroup setBehaviourStrong "AWARE"; newBluforIfvInfGroup setSpeedMode "FULL"; [newBluforIfvCrew, 0] synchronizeWaypoint [ [newBluforIfvInfGroup, 0] ]; //IFV LEAVES INFANTRY ATTACKS waitUntil {({_x in _bNewVehicleIfv} count (units newBluforIfvInfGroup)) < 6}; [newBluforIfvInfGroup] spawn LIZ_fnc_eject; waitUntil {({_x in _bNewVehicleIfv} count (units newBluforIfvInfGroup)) < 1}; sleep 2; [newBluforIfvInfGroup, getMarkerPos _randomObjMarker] call BIS_fnc_taskAttack; [newBluforIfvCrew, getMarkerPos _randomObjMarker] call BIS_fnc_taskAttack; Currently this function is triggered by me using a Radio Trigger for testing - 0 = [] spawn LIZ_fnc_bIfvSpawn. I also considered that my other function LIZ_fnc_eject (which ejects the infantry from the IFV) might have something to do with it, so here it is: _infantry = _this select 0; { unassignVehicle (_x); (_x) action ["EJECT", vehicle _x]; sleep 0.2; } foreach units (_infantry); sleep 3; If you can see my error, or if I've unwittingly left out some key piece of information, please let me know. Help me BI forums, you're my only hope.
  2. complacent_lizard

    SP Money System

    Hi! I'll cut to the chase! I'm creating a single player sandbox scenario where I'd like to include a "money system" which allows the player to purchase certain weapons or clothing items after either having money added or subtracted as a result of completing / failing a task. I'd like not only to offer the Arma 3 community a cool scenario, but also a script framework for a SP money system, that other players can use in the future to save time! Trouble is, my scripting ability currently sits somewhere between novice and intermediate; seeing as this is a complex project requiring knowledge of dialogs (for GUIs) as well as scripting variables, I was hoping that you could share the best tutorials, tips and pointers relating to establishing variables for a scenario as well as interactive GUI menus called through an external script! (Also, I have read a number of other threads, and tried out some other player's scripts - believe me, reaching out like this is a last resort!) Thanks for reading, and I hope you can just quickly send some advice my way, and for future readers! Cheers :)
  3. Hello! Last time I had an issue the BI community came to my aid, and I know how useful these forums are for everyone else, so here goes... I'm displaying a money variable for the player by using an RscTitle in the top left of the screen - that's all good. The problem is I'm not sure how to go about displaying a variable in that RscTitle that updates so that the amount of "money" the player has is displayed at all times. Here's my description.ext: class RscTitles { class CashDisplayTitle { idd = -1; duration = 1e+1000; class controls { class CashDisplayControl { idc = -1; type = 0; style = 0; x = safeZoneXAbs; y = safeZoneY - 0.45; w = 1; h = 1; font = "EtelkaNarrowMediumPro"; sizeEx = 0.05; colorBackground[] = {0,0,0,0}; colorText[] = {0,0.6,0,1}; text = "$"; }; }; }; }; So I've got 2 minor obstacles - how can I display the cashVariable in my CashDisplayControl, and how can I set up a script which updates that value? If you've got any pointers / links, I'd very much appreciate it! (I have read around, but the examples I've found are very case specific and get a little convoluted) Thanks for reading and for being an outstanding community!
  4. complacent_lizard

    queue.sqf

    Well that escalated quickly!
  5. complacent_lizard

    queue.sqf

    This is going to be one odd request... Here's the situation - I want a line of units to form a queue. The idea is that every 10 seconds the unit at the front of the line moves to the back, and the unit behind him moves forward to take his place. The units are forming the line, and the player is supposed to wait in the line for the scenario. Here's the script I have so far: queue.sqf private ["_front","_back"]; _front = _this select 0; _back = _this select 1; while {true} do{ sleep 10; _back doMove (_front modelToWorld [0,-0.3,0]); }; _front refers to the unit in front of the _back unit in the line. Each unit in the queue executes this script with nul = [civ_1, civ_2] execVM "scripts\queue.sqf"; depending on who is in front of them. The problem with this script is that the units can only form a straight line (not such an issue), but when the unit at the front of the line moves to the back, the unit behind them doesn't move to the front of the line. In essence, the 2nd in line doesn't move and the queue slowly shifts backwards. Any pointers or obvious mistakes I've made? Thanks everyone!
  6. complacent_lizard

    queue.sqf

    This is a great little script @M1ke_SK! For the time being I've decided to change to a stationary line because I'm lining the units up in really close quarters (inside a building) and the path finding causes some messy problems! But I can see this script being useful especially when the the orange DLC comes out (maybe for a line of civilians waiting for aid?) Thanks so much! :D
  7. complacent_lizard

    queue.sqf

    Yeah! Something exactly like that! Are you using markers to achieve that @M1ke_SK? And how do you think it would handle 25 units lined up? :P
  8. complacent_lizard

    cutRsc and Updating Variables

    Nevermind! I'm a fool! I've replaced uiNamespace getVariable "cashVariable" displayCtrl 564382 ctrlSetText "$"+str(round time); with uiNamespace getVariable "cashVariable" displayCtrl 564382 ctrlSetText "$"+str(cashVariable); and it's all working! A huge thank you to Arkensor and pierremgi!! Couldn't have got it working without you and your advice! If anyone has any pointers for optimising / how much of an idiot I am, feel free to share :P
  9. complacent_lizard

    cutRsc and Updating Variables

    Absolute legend pierremgi! I've almost got it working. I've switched _myRSClayer cutRSC ["cashDisplayTitle",0,false]; for cutRSC ["CashDisplayTitle","PLAIN"]; The issue I've found is that uiNamespace getVariable "cashVariable" displayCtrl 564382 ctrlSetText "$"+str(round time); counts each second as it passes, instead of registering my cashVariable. Could this be because my cashIcon.sqf is called from my init.sqf? Thanks again!
  10. complacent_lizard

    cutRsc and Updating Variables

    Thanks again Arkensor! I've changed the idd for the CashDisplayTitle AND the idc for the CashDisplayControl to 101. init.sqf: cashVariable = 0; cutRsc ["CashDisplayTitle","PLAIN"]; description.ext: class RscTitles { class CashDisplayTitle { idd = 101; duration = 1e+1000; onLoad = _this execVM "cashIcon.sqf"; class controls { class CashDisplayControl { idc = 101; type = 0; style = 0; x = safeZoneXAbs + 1.25; y = safeZoneY - 0.2; w = 1; h = 1; font = "EtelkaNarrowMediumPro"; sizeEx = 0.05; colorBackground[] = {0,0,0,0}; colorText[] = {0,0.6,0,1}; text = "$"; }; }; }; }; cashIcon.sqf: [] spawn { while{true} do { ((findDisplay 101) displayCtrl 101) ctrlSetText "Mmmmmoney"; sleep 0.5; }; }; The "$" correctly displays because of the init.sqf, but nothing else (not even the "Mmmmmoney" part). I'm sure there's something really simple I've got wrong here, but I can't seem to figure it out :/ Is "cashIcon.sqf" a smart way of executing this?
  11. complacent_lizard

    cutRsc and Updating Variables

    Thanks for the advice Arkensor, much appreciated! I've been looking at crtlSetText, and had a feeling that was what I needed to learn. Just to clarify, if I use ((findDisplay) displayCtrl 101) ctrlSetText "Mmmmmoney"; in a separate script that loop/updates, do I need to change the idc to 101 for a particular reason? Or can I leave the rscTitle idc = -1 and use that in my update script? Also, what is the most efficient method for running a script that loops in SP, considering that this variable needs to be basically up to date all the time? I also noticed that "[...]control inside controls group having -1 IDC currently cannot be returned in any way." So it makes me wonder if using the generic "-1" for my idc was a stupid choice :/
  12. complacent_lizard

    SP Money System

    Cheers Grumpy Old Man! Thanks a lot for your help! I think I've got a grasp of the whole variables thing now, and I suppose you're right about the dialogs! I think I'll stick to hints for now ;)
×