Jump to content


  • Content Count

  • Joined

  • Last visited

  • Medals

  • Medals

Everything posted by SpaydCBR

  1. Yeah I didn't think that would make a difference. Like I said, the Revive template just doesn't exist anymore. If you go to the config file and check under CfgRespawnTemplates you'll see that Revive is gone! Wasn't the new Revive stuff supposed to be one of the highlights of this update? Did they forget to add it? Haha :p
  2. I tried those exact settings and still didn't work. Like I said, it appears the Revive template just doesn't exist anymore, or it's somewhere else? I get the message "[bIS_fnc_selectRespawnTemplate] Respawn template 'Revive' not found."
  3. Modified from davidoss suggestion: //Call from initServer.sqf this disableAI "MOVE"; if (isServer) then { { _x spawn { params ["_unit"]; while {alive _unit} do { if ((behaviour _unit) == "COMBAT") then {_unit enableAI "MOVE"} else {_unit disableAI "MOVE"}; sleep 5; }; }; } forEach allUnits; }; Untested, but something like that should work.
  4. Will this be applied to ALL units of a particular side? If so you could just make one script that will run your code for all units, instead of typing it into each units init field, then call that script from init.sqf or something.
  5. Could you elaborate on what it is you want exactly? So it starts off with no marker, then when a unit fires a marker appears at his location? Then what? It follows him around forever?
  6. Don't the sectors need triggers to work? Maybe you could disable the triggers until the previous sector was captured.
  7. That worked! Everything seems to be working fine now. Thanks mrcurry! I guess I just assumed that if an object already had a name then BIS_fnc_objectVar and vehicleVarName did essentially the same thing.
  8. Please, for the love of all that is holy, somebody help with this. I've been racking my brain for days trying to figure this out. Basically I have a bit of code that works perfectly in one mission, but not in another, even though it was copy and pasted from the one that worked! :391: This is what I have. I have 2 groups of infantry squads, and 2 pairs of hunters. I want to assign each pair of hunters to one group, so that only members of that group can spawn at or drive that pair of hunters. Each pair of hunters is synced to a logic module, and both of those logic modules (one for each pair of hunters) are synced to one main logic module that has the following in it's init: [this, west] remoteExec ["CBR_fnc_assignVehicle",2] In CBR_fnc_assignVehicle I have the following, and as far as I can tell, it works fine but maybe the problem is here somewhere: //CBR_fnc_assignVehicle params ["_logic","_side"]; _logics = synchronizedObjects _logic; //Get all groups for side _groups = []; { if (side _x isEqualTo _side) then { _groups pushBack _x; } } forEach allGroups; //array for tracking in the debugger watch vehs = []; //Assign each group to a group of vehicles for "_i" from 0 to (count _groups) - 1 do { { if (typeOf _x isKindOf "AllVehicles") then { //set up respawn position _displayName = getText(configFile >> "CfgVehicles" >> typeOf _x >> "displayName"); _group = _groups select _i; [_group, _x, format["%1 - %2", _displayName, _group]] call BIS_fnc_addRespawnPosition; //save vehicle group in missionNamespace _name = format ["%1_grp", _x call BIS_fnc_objectVar]; //shouldn't objectVar create a unique variable name that always stays with the vehicle? missionNamespace setVariable [_name, _group]; publicVariable _name; vehs pushBack _name; //just for debugging, and returns a valid list of variable names //set up vehicle respawn [_x,5,0,-1, { params ["_newVeh", "_oldVeh"]; //attach marker to new vehicle _newVeh remoteExec ["CBR_fnc_marker", 0, true]; } ,0,2,1,true,true,0,false] call BIS_fnc_moduleRespawnVehicle; }; } forEach synchronizedObjects (_logics select _i); }; As far as I can tell, there's nothing wrong with this part. Now I also have some code in onPlayerRespawn.sqf //Start Arsenal on spawn ["Open",[nil, AmmoBox, player]] call BIS_fnc_Arsenal; //run crewCheck [] spawn CBR_fnc_crewCheck; So everytime the respawns I want him to run my crewcheck function, which I think is where I'm having the trouble //CBR_fnc_crewCheck //called from onPlayerRespawn //another array for debugging crewCheckVehs = []; while {alive player} do { //Check if player is the driver of a vehicle waitUntil {sleep 0.5; vehicle player != player && driver vehicle player == player}; //Eject player if not helicopter pilot if (vehicle player isKindOf "Helicopter") then { if (typeOf player != "B_Helipilot_F" && typeOf player != "O_Helipilot_F") then { player action ["GetOut", vehicle player]; waitUntil {sleep 0.5; vehicle player == player}; hint "You are not a helicopter pilot"; }; }; //Eject driver from car if wrong group if (vehicle player isKindOf "Car") then { //should be same one as created from the objectVar call in assignVehicle, but it's something else //also displaying in the form "B Alpha1-1:1 (SpaydCBR)(bis_o2_xxxx)" where bis_o2_xxxx is not in the vehs array ​ //should be in the form "bis_o2_xxxx" . Without the player info in the beginning and be in the vehs array _name = format ["%1_grp", vehicleVarName vehicle player]; crewCheckVehs pushBack _name; //says "_grp". WHY??? _group = missionNamespace getVariable [_name, grpNull]; //so this returns grpNull if (group player != _group) then { player action ["GetOut", vehicle player]; //vehicle player is returning waitUntil {sleep 0.5; vehicle player == player}; hint format ["Only members of %1 are allowed to drive this vehicle", _group]; }; }; }; I see where it's going wrong, but I don't know why? As I said, this same exact code works perfectly fine in my test mission, but not the main mission that I copied it to. I thought variable names generated by BIS_fnc_objectVar stay with the vehicle always, but it looks like it's changing (again only in the main mission. Works fine in my test mission). The only thing I can think of is that it's running these scripts at a different order than in the other mission, but it really shouldn't. Any ideas?
  9. Thanks mrcurry :) I'm at work right now, but last night I did some dedicated environment tests. I used system chat to display the variable names of the vehicles at the start of the mission and they did in fact have valid names, but when I got IN them 'vehicleVarName vehicle player' returned an empty string, but ONLY when they're attached to the vehicle respawn module. If I remove the line that adds the vehicle respawn module, then everything seems to work fine. (Maybe not with posted code, the code has been slightly changed). I'll update the OP when I get home, as it can be much shorter now that I've narrowed down the problem. I will try your solution when I get home and let you know what happens. If it doesn't work I will upload the small test mission I'm using to demonstrate this problem. I realize that I could simply give all the vehicles names in the editor and that would probably fix my problem, but I would like to learn what's going on here :)
  10. SpaydCBR

    Fire Can't Hurt Player?

    I'm not sure but maybe you can use the "Hit" event handler and see what the second parameter is (causedBy object). If fire is actually a thing then maybe you could manipulate that somehow
  11. So I grabbed my mission that worked and tested it in a dedicated environment. It's giving me the same wrong result as in the OP. The vehicles have no variable names, even though they did in the non-dedicated environment. So what's going wrong? :(
  12. I would change your cach_A.sqf to a function and have it return the crate it creates (ammocrate1) to mission_1.sqf, then get the returned crates' position for the setsimpleTaskDestination. Is this multiplayer, and will there only be one side?
  13. Hmm, well in your triggerStatements, I think you need to replace the inner double quotes (like at "SUCCEEDED") with single quotes, otherwise you keep closing and reopening the whole string! But I don't think that would stop the crate from spawning :(
  14. I'm no scripting wizard, but I think you can use the "Fired" event handler and check if the thing that fired was an explosive. Then maybe you could check if the explosive is within an acceptable distance to markers you've placed on either end of the bridge. Not sure if there's a way to detect that the explosives actually exploded, and I don't think bridges are destructible. That's all I got, sorry :)
  15. From the Wiki, BIS_fnc_objectVar: "Return an unique object variable. The variable is preserved after unit respawn." By test mission I simply mean that while I am making a mission, I usually have 1 or 2 other missions where I test individual features before copying them into my main mission. These other test missions are under the same environment, or at least I assume so. Right now the problem is from _name = format["%1_grp", vehicleVarName vehicle player]; That statement is simply returning nothing, whereas in my test mission, it returns the correct name, which is the one set by the objectVar function call earlier. What I've been doing now is I've started a new clean mission, and one by one I'm copying features into it until I get the same problem and hopefully that'll give me a clue as to what's causing it. I'm at work right now, but so far everything is still working fine, including the part that this topic is about, so I'm guessing there's something with my other code that's messing things up.
  16. I just checked the .rpt and found nothing useful :(
  17. how do I check it? I tried looking for it before. Never found it and soon just gave up haha
  18. @barbolani I'm not sure. I don't use the .rpt I don't even know where it is haha. I just use the debug console :) @Bnae I'm not sure what it is I'm looking for in that link. I think I'm using getVariable fine. I think the problem is 'vehicleVarName vehicle player' is returning a different name than was set by 'BIS_fnc_objectVar', and again, it's working fine in my test mission :(
  19. I want my players to pick their loadout before they spawn into the game to limit the number of restricted items there are in the world (e.g. There should be no more Rocket Launchers than there are AT soldiers) for balancing reasons. I've looked into MenuInventory, but it seems that I'd have to choose the loadouts for them and I don't want to do that. I was wondering if there's a way to replace it with the Virtual Arsenal, where when you're in the Respawn menu, you click on the right arrow to go to the change loadout screen (as you normally would for MenuInventory), but you're taken to the Virtual Arsenal instead, where you can build your loadout from a predefined set of items. Would this be possible? I have no clue how to do this, as I have absolutely no idea how the respawn templates actually work (perhaps there are guides I can read). I'm also open to other suggestions on how to do this, but I think this way would be the ideal User Experience, since players would not be bothered by the Arsenal when they're respawning (and spawn with their last loadout) unless they want to change their loadouts.
  20. Hmm, that actually did work Nikander. Thanks! My only problem with it is that my OCD is annoyed that I have to see it every time I respawn haha. I was hoping it could be hidden like the MenuInventory so that I only see it when I WANT to change my loadout! Makes for a better user experience I think.
  21. Well I don't really want to restrict a non-AT guy from picking up and using a launcher (that kind of limitation would be silly), I just want to limit how many launchers (or sniper rifles too) are allowed in the world, for balancing reasons.
  22. Thanks for the responses guys, but I already have a working Arsenal with whitelisted items that's attached to an ammobox in the world. My problem is that an AT guy could simply 'drop' his launcher for a non AT guy to pick up, then the AT guy can get another one for himself thus bringing in more launchers than allowed into the world. My question was how do I start the Virtual Arsenal BEFORE they respawn, like maybe in the respawn menu. Just like in Battlefield where you can only select your loadout before you spawn. The MenuInventory template let's you do this, but I don't like it. I was hoping there was a way I could replace it with the Virtual Arsenal where it's accessible from the respawn position menu.
  23. I'm not too familiar with event handlers, but couldn't you just put 'player'? Or does 'this' have to refer to the actual soldier object?
  24. I think you could also just put it in the initPlayerLocal.sqf right?
  25. I'm not sure if this would work since I'm at work :( and would need to test it, but could you check the count of the group? You could name the squad leader Dave _group = group Dave; if (count _group isEqualTo 0) then {...};