Jump to content

vapour

Member
  • Content Count

    38
  • Joined

  • Last visited

  • Medals

Posts posted by vapour


  1. Hi good gents.

     

    I am sick of banging my head against a wall over a simple little script.

     

    This is for an MP PvP mission where there are two resistance players (E1 and E2) and a bunch of  player blufor hunters.

    I want a trigger to go off, which will essentially be the "win" trigger for blufor.

     

    The trigger needs to go off when all resistance players are captive (because of ACE handcuffs) and present in a holding cell (represented by an area trigger).

     

    A couple of things make this slightly tricky though. 

     

    1) Sometimes there may be only one person playing as resistance, not necessarily two. If only one resistance player, the other resistance character  will not be present in the mission as AI either.

    2) I don't want the trigger to go off if only one resistance guy is captured, as the other fella may be there to rescue him.

     

    Issues I've encountered so far is that when captured, the script command "side" will register E1 and E2 as being civilian, not resistance -  so I've found faction _x == "IND_F" may be a good work around.

     

    I have tried what feels like dozens of combinations to get this happening, but keep failing.

     

    My best effort was a "Whole group" present trigger with This && (captive E1) && (captive E2) in the condition - but I'm not sure what will happen if there's only E1 or E2 being played.

     

    I've tried lots of things like {captive _x && faction _x == "IND_F"} forEach player, but I usually get generic error messages and such.

     

    Thoughts and problem solves welcome.


  2. Hi dchan200,

     

    I just did an experiment with say, say2D and PlaySound.

    say, say2D and say3D all have the issue where the sound continues on an endless loop.

    playSound works properly, with just one shutter sound each time you click, but the sound is not as good quality.

     

    If you find a solve for the looping sound I would love to know, but if there isn't an answer to the issue, at least I can use playSound.

     

    Once again, thanks for solving the main issue for me. I really appreciate it. You made my day!

     

    Cheers


  3. Hi folks

     

    I've got an issue with trying to write a script that lets me keep doing an action until the point where I don't want to do the action any longer.

     

    A player has a camera in their gear. When they want to take a photo, the script fires up.

    The script makes them put away their current weapon, and an image of the back of a camera pops up on their screen.

     

    ARMA_Camera.jpgpicture sharing

     

    Now the bit that has me stumped. I want to be able to have the player take as many photos as they want before putting the camera away. The script snippet I have for 'clicking' the camera is this:

     

    Quote

    waitUntil {inputAction "Fire" > 0};
    CameraUnit Say3D "Shutter";

     

    (I intend to add some other stuff in here too that will detect what the player is pointing the camera towards at the time that the 'click').

     

    (The inputAction "Fire" is done by the player holding Left-Ctrl + Left mouse click). This works a treat in my script, but sadly can only be done once at the moment due to my lack of scripting know-how.

    I then have another script snippet which lets the rest of the script continue, thus closing the camera and letting the player get his weapon out again:

     

    Quote

    waitUntil {inputAction "toggleRaiseWeapon" > 0};

     

    (The inputAction "toggleRaiseWeapon" by default is a double tap of the Left-Ctrl key).

    The other problem here is that the player has to take a photo before the script continues on to the part where the player can put the camera away. What if the player opens the camera, but then decides to put it away without taking any shots. He/she can't in the script's current state.

     

    Here's the whole script currently:
     

    Quote

     

    CameraUnit action ["SwitchWeapon", CameraUnit, CameraUnit, 100];

    Sleep 1;

    _pic = "pics\CameraBack_ca.paa";
    [
        '<img align=''centre'' size=''8.5'' shadow=''0'' image='+(str(_pic))+' />',
        safeZoneX+0.825,
        safeZoneY+safeZoneH-1.32,
        99999,
        0,
        0,
        3090
    ] spawn bis_fnc_dynamicText;

     

     

    //I NEED HELP FROM HERE
    waitUntil {inputAction "Fire" > 0};
    CameraUnit Say3D "Shutter";


    waitUntil {inputAction "toggleRaiseWeapon" > 0};

     

    //TO HERE

     

     

    _pic = "";
    [
        '<img align=''centre'' size=''0'' shadow=''0'' image='+(str(_pic))+' />',
        safeZoneX,
        safeZoneY+safeZoneH,
        99999,
        0,
        0,
        3090
    ] spawn bis_fnc_dynamicText;

    CameraUnit action ["SwitchWeapon", CameraUnit, CameraUnit, 0];

     

     

    So in summery, I want the player to be able to point and 'click' the camera as many times and at as many objects as they want, then when they're ready, put the camera away.

    I hope that all makes sense.

    Any help with this is appreciated. Thanks heaps.

     

    Vapour


  4. Thanks heaps for the replies guys.

     

    Okay, this is what the issue was. Thanks to Pierre from Armaholic for spotting it. gridPos was a 'Global' variable, but only on the clients computer. That variable needs to be broadcast to all other clients (players) in the mission by using the command 'publicVariable'.

     

    Here's how it all should have looked:

     

     

    1. gridPos = mapGridPosition getPos unit1;
    2. publicVariable "gridPos";
    3. parseText format ["<t size='1.2' align='center' color='#113DDD'>Respawn moved to grid %1", gridPos] remoteExec ["hint"];
    • Like 1

  5. Hi fellow scripters

     

    I have 'Unit1' activating a script from an addAction. Part of the script fires a hint to tell all players on the server what the map grid reference is of the freshly moved respawn point. The unit who activated the script gets a nice "Respawn moved to grid 023865" or wherever the respawn point is, but all the other players get "Respawn moved to grid Any".

     

    Where have I gone wrong?

     

    Script snippet responsible:

    [[{gridPos = mapGridPosition getPos Unit1; Hint composeText [parsetext format ["<t size='1.2' align='center' color='#113DDD'>Respawn moved to grid %1", gridPos]]}],"BIS_fnc_Spawn",true] call BIS_fnc_MP;


  6. Hi fellow scripters

     

    In a MP mission, I have a radio trigger placed down that runs a script to shift a respawn_west marker to the location of the unit that activated the radio trigger.

    Normally, with an area trigger you would pass the 'unit' variable to the script by putting:

     

    nul = [thisList select 0] execVM "scriptname.sqf"

     

    in the 'ON ACTIVATION' box of the trigger, and then in the sqf file having something like:

     

    _unit = (_this select 0);

     

    What is occurring though with the radio trigger, is that it is obviously not receiving the unit's variable in the script. I get 'ERROR - UNDEFINED VARIABLE' when activating the trigger in mission.

     

    Are radio triggers a little different from area triggers in this respect?

    I'm assuming they either expect just one activator as opposed to many, thus may not use 'thisList', or are perhaps not recording any activator at all.

    I have tried nul = [this select 0] execVM "scriptname.sqf" and nul = [this] execVM "scriptname.sqf", but to no avail. Still the same error.

     

    Does any one have some bright ideas about where I may be going wrong?

    Any help is much appreciated.


  7. I'm assuming it's got something to do with:

    spawn rhs_fnc_vehPara

    Okay, I've worked it out. For others who want the AI to para drop a vehicle from the C130J, do the following.

     

    I've got an AI controlled C130J flying around the map named "C130J_1"

    To add a vehicle to the cargo I've put down a vehicle in the editor and put "This AttachTo [C130J_1,[0,1,3.02]];" in it's Init (This was for the open Humvee. Position may need to altered for other vehicles).

    To get the AI to perform the para drop, you'll need to do it via a script. My script simply reads "[C130J_1] spawn rhs_fnc_vehPara;"

     

    I get the C130J to follow a flight path, and as it passes through a trigger on the editor, the trigger executes an SQF file I've called "CargoDrop.sqf". The sqf file contains the "[C130J_1] spawn rhs_fnc_vehPara;" line and nothing more is needed.

    • Like 1

  8. With the C130's ability to do a cargo drop, is it possible to get the AI to somehow perform the "Cargo Drop"?

    I can get a vehicle in the plane with "AttachTo" no problem, and it's able to be cargo dropped manually (by the player being in the plane), but I would like the AI to be able to do it.

    Anyone know if there's a script command?

    I'm assuming it's got something to do with:

    spawn rhs_fnc_vehPara


  9. With the C130's ability to do a cargo drop, is it possible to get the AI to somehow perform the "Cargo Drop"?

    I can get a vehicle in the plane with "AttachTo" no problem, and it's able to be cargo dropped manually (by the player being in the plane), but I would like the AI to be able to do it.

    Anyone know if there's a script command?


  10. Hi guys. This is very cool and handy for missions. I have tried working it in to my current mission, but for some reason the intel doesn't pick up my variable.

    In the Intel's Init:

    if (isServer) then {[this,"RscAttributeDiaryRecord",["Disarm code", Format ["Reminder: The code's %1.", txtcode]]] call bis_fnc_setServerVariable; this setVariable ["recipients", west, true]};

    When it is picked up, it reads "Reminder: The code's any".

    So instead of the variable's text string, it's just returning the word "any".

    I use the variable - txtcode - in other parts of the mission and it works fine, reading back to players as a text string within a hint.

    Any deas???


  11. Thanks heaps for your help guys, but everything for me was a complete failure.

    Xeno, where you said "First of all, you execute a sqf script with exec instead of execVM" - I couldn't see where I was executing a script using execVM - All my scripts are executed using exec like you said.

    Using !Dedicated, things haven't changed at all. The addAction still comes up multiple times, and only the executor of the addAction sees the hints, successful objectives etc . . .

    Demonized, I'm afraid that the rHint thing stuffs up my formating of the hint and wont let me include adding in the killers name.

    This is all obviously above me so I'll try and work out some other way of doing this.


  12. Hi

    Is anyone up to a bit of a scripting challenge?

    This has got me beat, and I suspect it may have to involve public event handlers.

    Public event handlers confuse the crap out of me, no matter how much I try to read about them.

    In this PBO: http://www.mediafire.com/?b9n7e9xjc1tjbz6 I have five terrorists that will get shot.

    Once someone approaches the dead body, they can use the action menu to identify the terrorist that has been shot. On identification a hint appears naming the dead terrorist and the killer. In the task list the terrorist gets marked off as killed.

    So what is happening is that an 'MPEventHandler' sets off a script when the terrorist is killed.

    This is the MPEventHandler:

    this addMPEventHandler [""mpkilled"", {T1K = _this select 1; nul=[]exec ""T1Action.sqf""}]

    This is the script that gets run:

    if (!isServer) exitWith {};
    _a2=T1 addaction ["<t color = '#F7FE2E'>Identify body</t>", "T1.sqf"];

    The script does an 'AddAction' to the dead body so that "Identify body" turns up in the action menu when the body is approached.

    Running the action sets off a second script:

    if (!isServer) exitWith {};
    objT1 setTaskState "SUCCEEDED";
    hint format["Boris Zaitsev successfully eliminated by %1",T1K];
    T1K addRating 1000;
    T1 removeAction 0;

    Works great in testing with one player, but as soon as it's served up to more players, it all turns to custard.

    "Identify body" appears in the action menu multiple times.

    Only the person who executes the action sees the hint and gets the green task success.

    Any help would be greatly appreciated.


  13. Thanks heaps for your reply tacticalnuggets.

    I'm obviously as thick as two planks though, because I mainly get what you're saying about that it's only executing the actual script on the callers machine, but that addPublicVariableEventHandler has got me completely miffed.

    I don't know anything about Event Handlers, and trying to read through that link has completely twisted my head in.

    Are you able to (:o grovel 'please') add into my script the appropriate bits so that I can actually see what needs to be in there?


  14. Hi, I'm afraid this one of the questions about scripts that run fine until they are put in multiplayer, then it all turns to custard.

    I've tried to get my head around ? !(local server):exit and public, private varuables and such, but I guess I'm just too thick to understand it all.

    What I've got here is a couple of scripts that run off an addAction. One that I've placed on a radio in the mission, the other on an AI.

    With the radio script, one of the players walks up to the radio and uses it to call for extraction details.

    The talking can be heard via an ogg file and a new marker appears on the map showing the extraction point.

    sub2 = createMarker ["extract", getMarkerpos "SubMove"];
    "extract" setMarkerType "end";
    "extract" setMarkerText "Extraction";
    
    _caller = _this select 1;
    
    _caller say "Extract";
    
    Radio1 removeaction 0;

    The radio is variable Radio1

    The addAction command sends the player who used the radio as variable _caller

    Works great in single player testing, but when tested with other players, the ogg file is only getting heard by the person who activated the radio.

    Tried adding a Server gamelogic and putting the "if not server" stuff at the beginning of the script, but then it prevents any of the players from being able to execute the script at all.

    Similar problem with the second addAction script. Only the person who initialised the talk with the AI can hear or see the conversation happenning.

    PL say "A_Greet";
    
    PL removeaction 0;
    
    OBJ_LIAISE SetTaskState "SUCCEEDED";

    Also the removeaction is only happenning on the initialising players computer, as all the other players are still able to use the same addAction after the initial person has.

    So I assume that what is happenning is that the script is only getting executed by the players computer, and what I need is for it to execute on everyones computer?

    I think some of the script may need to be executed on the server as well, such as createMarker and OBJ_LIAISE SetTaskState "SUCCEEDED", but I'm not really sure.

    If someone can guide me in the right direction with this, I'd be very grateful.

×