Jump to content

Valfunction

Member
  • Content Count

    51
  • Joined

  • Last visited

  • Medals

Everything posted by Valfunction

  1. Valfunction

    Getting unit out of vehicle

    It's definitely not the switchMove. I tried leaving it out and it still did it. I tried to assignAsCargo on the "Getin.sqf" (which places the unit in the vehicle) and then orderGetIn false in this script but that didn't do it. I've managed to create a workaround for this. The "Putdown" event (which is also used elsewhere) runs a disableAI "MOVE" and forces the unit to just sit there. However as soon as the unit is released (AI enabled and not forced sit) they run straight back for the vehicle. The script now looks like this: ["Getout", { { if (alive _x) then { _x disableAI "MOVE"; [_x] orderGetIn flase; unassignVehicle _x; _x leaveVehicle (nearestObject [_x, "Landvehicle"]); moveOut _x; ["Putdown", [_x]] call CBA_fnc_globalEvent; }; } forEach (crew cursorTarget); //(nearestObject [player, "Landvehicle"]) removeAction getout1; }] call CBA_fnc_addEventHandler; The Getin script looks like this just for reference: //GETIN SCRIPT ["Getin", { _unit = _this select 0; _vehicle = _this select 1; _unit switchMove ""; _unit removeAction release1; _unit removeAction getin1; _unit removeAction escort1; _unit disableAI "MOVE"; _unit assignAsCargo _vehicle; [_unit] orderGetIn true; //this seems to do a whole lot of nothing the guy just stands there _unit moveInCargo _vehicle; _getoutact = _vehicle getVariable ["Getout_id", false]; if _getoutact exitWith {}; getout1 = _vehicle addAction ["Disembark", "CIS\getout.sqf"]; _vehicle setVariable ["Getout_id", true]; }] call CBA_fnc_addEventHandler;
  2. Valfunction

    cursorTarget help

    The addactions are executed globally thanks to the CBA_fnc_globalEvent and they work on a dedicated server. It's the disableAI which is the issue.
  3. Valfunction

    cursorTarget help

    I have tried to do this with both globalExecute as well as creating event handlers. At the moment I am trying with event handlers. My two scripts are as such: _land = nearestObject [player, "LandVehicle"]; _air = nearestObject [player, "Air"]; _ship = nearestObject [player, "Ship"]; while {alive player} do { if ( ((side cursorTarget) == civilian) AND (cursorTarget != _land) AND (cursorTarget != _air) AND (cursorTarget != _ship)) then { _trg = cursorTarget; ["Stop", [_trg]] call CBA_fnc_globalEvent; } }; This calls the event in the following script: ["Stop", { _unit = _this select 0; sleep 0.1; _unit disableAI "MOVE"; escort1 = _unit addAction ["Escort", "CIS\escort.sqf"]; check1 = _unit addAction ["Check ID", "CIS\id.sqf"]; sleep 5; _unit removeAction escort1; _unit removeAction check1; _unit enableAI "MOVE"; }] call CBA_fnc_addEventHandler; The addactions work so I know that the event handlers is working but the disableAI does not work at all. The guy just keeps walking around. I've also tried doing it with globalExecute but same thing the guy keeps walking around but I get the addactions.
  4. Valfunction

    Getting unit out of vehicle

    I've got that in there. The guy even does the switchMove and is actually sitting in the front seat of the car in the switchMove pose.
  5. Valfunction

    globalExecute help

    Thanks guys this was most helpful. Seeing as this event might happen many times per mission I reckon I'll use event handlers (and they are better for bandwidth). I have a better understanding of event handlers now and will keep on learning about them as they seem the way to go.
  6. I am trying to make a script where you can arrest someone and them move them to a location. When you arrest them they should put their hands on their heads. I'm having problems conveying this part in MP. I tried using globalExecute and everything up to the globalExecute runs fine but then nothing happens within the globalExecute. What am I doing wrong? _thisunit = _this select 0; release1 = _thisunit addAction ["Release", "CIS\release.sqf"]; _thisunit attachTO [player,[.5,.5,0]]; [-2, { _thisunit switchMove ""; _thisunit setUnitPos "UP"; _thisunit playActionNow "Surrender"; _thisunit disableAI "MOVE"; _thisunit disableAI "ANIM"; }] call CBA_fnc_globalExecute;
  7. Valfunction

    globalExecute help

    Yeah the idea would be to set them up in a events.sqf and then reference them from there. The above was just a quick syntax check to see if I had the right understanding of the syntax for setting them up and then calling them. So thanks for your reply it sorts that out and I wasn't quite sure how to pass a variable with them so thanks again. I don't have a deep understanding of event handlers. Which method would be best? Using globalExecute or creating and then calling events and why?
  8. Valfunction

    globalExecute help

    Thanks heaps man. Took me a couple of reads of your script but I got where I was going wrong. Just curious is there a way to do this using CBA eventHandlers? Something like: _thisunit = _this select 0; release1 = _thisunit addAction ["Release", "CIS\release.sqf"]; _thisunit attachTO [player,[.5,.5,0]]; ["Arrest", {_this switchMove "";_this playActionNow "Surrender";_this disableAI "MOVE";_this disableAI "ANIM"}, _thisunit] call CBA_fnc_addEventHandler; ["Arrest"] call CBA_fnc_globalEvent;
  9. Should have explained that a bit better but that's what I meant. Typing when half asleep isn't the best.
  10. To run the addAction for everyone use CBA_fnc_globalExecute lets you control where the script is executed. You will probably also have to use this for the Miles Execution scene at the camp because playMove is local as well.
  11. Valfunction

    Error Missing )

    Gotta use == instead of just = Script thinks you are defining a variable. This is how it should look: if (_vehtype == 1) then {[_veh] execVm "scripts\wheel_check.sqf";}; //notice the double = sign
  12. Valfunction

    Test <null> ?

    I don't really understand what you are trying to do but to test if a variable is null: if (_variable == null) then //alternatively if (_variable == 0) then { //magic }
  13. Random is different on each client so run it serverside. EDIT: Ninja'd
  14. Valfunction

    cursorTarget help

    cursorTarget is always for player so "player cursorTarget" would be incorrect syntax for it. Also it works fine for my so "side cursorTarget" seems to work fine the problem is it works only on the server (in this case me). Ah ok. I didn't notice disableAI was local - oops. So I would need to run it through something like CBA_fnc_globalExecute.
  15. I am trying to create a script where I can load/unload "captured" units into vehicles and then unload them when I want to. I don't want them to join my group. So far I have a script for putting them in a vehicle getin.sqf _thisunit = _this select 0; detach _thisunit; _thisunit switchMove ""; _thisunit removeAction move2; _thisunit removeAction getin1; _thisunit enableAI "MOVE"; _thisunit moveInCargo (nearestObject [_thisunit, "LandVehicle"]); Question is how do I get them out? I have tried the following which is not ideal as it removes all civilians from vehicles but the guys get out and then run back and board the vehicle again: getout.sqf { if ((side _x) == civilian) then { doGetout _x; }; } forEach allUnits; Does anyone have any ideas or a better way to do this?
  16. I have an addAction script which may be executed multiple times on an object. This script places an additional addAction on the object as well. *does someting* _actionid = _object1 addAction ["Stuff", "stuff.sqf"]; Is there a way to check if _actionid has already been added to _object1 so that I don't get multiple instances of "Stuff" on my scroll wheel?
  17. Thanks guys that was very useful.
  18. on an addaction: select 0 = the person the action is being done on select 1 = the person doing the action select 2 = the ID of the action so using _activator = _this select 1 you are saying the activator will be the player. So on the last line when you go _activator addAction [...] you are actually putting the action on you. I would have written it like this question.sqf _activator = _this select 0; //this makes the cop _activator cop removeAction question; //see the end of my post regarding this hint "None of your fucking Business white boy..."; sleep 5; hint "Do you have something for me?"; bribe = _activator addAction ["Will this work?", "bribe.sqf"]; //question is now the ID of the addAction. Is a global variable so that we can use it in bribe.sqf bribe.sqf _activator = _this select 0; //it is to select the cop //player refers to the playable unit if (player hasWeapon "EvMoney") then { _activator RemoveAction bribe; //removes the bribe option as "bribe" is the ID of the bribe hint "Thank you, you may pass."; BG_1 animate ["bargate",0]; player RemoveWeapon "EvMoney"; sleep 45; BG_1 animate ["bargate",1]; } else { hint "You cannot pass unless you give me something. Give me money...white boy."; }; Also to initiate question.sqf I assume you have something like this in the init field of the cop: this addAction ["Question", "question.sqf"]; Change that to: question = this addAction ["Question", "question.sqf"]; This makes the ID of the addAction "question" and you then use it in question.sqf to remove the ability to ask the question as I've done above.
  19. Valfunction

    NV on Helmet(s) Animation

    I get that people want immersion and the such but I've got to agree with BI when they say "priorities". I'd rather BI spends time on the important things so that we have a game that plays well when it's released (remember what Arma2 was like on launch?) than have animations for all the little things.
  20. Just watched the video and had a look at the script - cool concept. Quick suggestion - put the addAction on the cop rather than the player. In the video when you run back to the car you still have the option "for will this work" which looks a bit weird.
  21. Haven't looked at the script but for the getting the AI to open fire if you drive around the gate you could do the following: 1. Name the Police group something 2. Place triggers either side of the gate - if BLUEFOR present trigger (or opfor or whatever your units are) 3. In the activation field use the name of the police group and doTarget and doFire alternatively if you are bluefor and the Police are resistance (green) then put in the activation field of the trigger: WEST setFriend [RESISTANCE, 0]; RESISTANCE setFriend [WEST, 0];
  22. This is not tested but rather an example to point you in the rough general direction: //x is the increment you want. so for 360/8 x = 45. a = 1; _point = 1; while a = 1 do { if _point > 360 then {_point = _point - 360}; while _point < 361 { _point = _point + 180; _point = _point + x; _point = _point + 180; _point = _point + x; _point = _point + 180; etc } }
  23. Valfunction

    Side Foreach

    See my comments within the code { If (Side _x == West) Then { //you have specified that if _x == west PlaySound "Captured"; //but here you have not alluded to _x at all so it will play the sound forEach PlayableUnits[sUB][/sUB] } } ForEach PlayableUnits; What you would need is something like _x playSound "Captured"; (this is not a correct syntax but hopefully you get the idea of what I'm getting at) Perhaps this might work better (not tested) or something along those lines. { If (Side _x == West) Then { _soundSource = createSoundSource ["Captured", position _x, [], 0]; } } ForEach PlayableUnits;
  24. I see how it works now. Was reading it wrong. The reason for them not to join the group is so that anyone can use these actions in MP rather than just the squad leader ordering the civy around.
  25. That is a really clever bit of script. Only a couple of problems: The vehicle can be any vehicle on the map and I don't know which one the player will use so I can't use a specific vehicle name. Also the moving in and out needs to be able to be done on the fly by the player so addActions would have to be used. I've managed to get it done so far using this: getin.sqf _veh = nearestObject [_thisunit, "Landvehicle"]; _thisunit = _this select 0; if ((_thisunit distance _veh) < 10) then { //so it only runs when close to vehicles detach _thisunit; _thisunit switchMove ""; _thisunit removeAction move2; _thisunit removeAction getin1; _thisunit disableAI "MOVE"; _thisunit action ["getInCargo", (nearestObject [_thisunit, "Landvehicle"])]; getout1 = (nearestObject [_thisunit, "Landvehicle"]) addAction ["Get out", "getout.sqf"]; }; getout.sqf { if ((side _x) == civilian) then { moveOut _x; _x switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Sykes"; _x addAction ["Move", "test.sqf"]; _x removeAction putdown1; }; } forEach (crew cursorTarget); (nearestObject [player, "Landvehicle"]) removeAction getout1; The disableAI "move" stops them getting back into the vehicle. I didn't know about cursorTarget before so that came in handy being able to order units out of whatever vehicle the player is looking at.
×