Jump to content

Grumpy Old Man

Member
  • Content Count

    4313
  • Joined

  • Last visited

  • Medals

Posts posted by Grumpy Old Man


  1. 40 minutes ago, target_practice said:

    Is there any kind of guide that explains how to create and implement a custom GUI element?

    I have looked at the BIKI pages on dialogue control and the GUI editor, but they don't do much to explain the entire process involved.

    All in there.

    Not sure what else you'd need.

    Maybe a 25 minute youtube video explaining how to copy paste from GUI editor to description.ext is better suited, heh.

    Spoiler

    :yay:

     

    Cheers

    • Like 1
    • Confused 1

  2. Errors (except compilation related errors like wrong syntax etc.) won't stop loops/scripts. If an error occurs, the script continues and most likely will spit out more errors.

     

    Dividing through zero returns 0 (probably programming practice, at least it doesn't return positive or negative infinity, heh), so the _tes variable actually holds 0, the error message tells you you're a bad boy but won't put you to sleep, at least you got the syntax right and life (the script) goes on.

    If you use player setPos [] the snippet will also continue (syntax is ok, but parameters are not).

    Same goes for putting in data types without doing anything with them (string without assigning it to a variable etc.).

    Up to you to handle errors, heh.

     

    If you want to terminate a script you need to use try, catch and throw.

     

    Also using systemchat for debugging is a bit tedious, since it can only display 6 or so lines, better push all messages to an array and hint that, or use diag_log.

     

    Cheers

     

    • Like 4

  3. 16 minutes ago, Meat2432 said:

    I've made an sqf where it will create an object and let you pick it up and put it down, my problem is in the putting down of the object, I have to reattach the object to a lower position to the ground before detaching to prevent fall damage to the object,

     

    the problem is I used the object variable name in attaching it to player ( AMMOBOX attachto [player,[0,0.6,0.2]];) when multiple objects are created with the same variable name I will drop one object and then a second will attach itself to me, I've tried changing the variable name to something used in local but I get an error undefined variable in expression, I'm new to this and don't know what to do.

     

    I would be grateful for any help.

     

    Check out the wiki, read every single line.

    Addaction comes with an arguments parameter, which lets you input all kinds of stuff, in your case using the variable holder of the ammobox object would be practical:

     

    if (!isDedicated) then {
    
    _ammobox = createVehicle ["Box_Syndicate_Ammo_F",position Spawnboxs, [],0,"NONE"];//only local variable is needed in this case
    _ammobox addAction ["Pick up",{_this call Pick_up;}, nil, 1.5, true, true, "", "_this distance _target < 1"];
    player addAction ["Put Down",{_this call Put_down;}, [_ammobox], 1.5, true, true, "", "_this distance _target < 1 AND !(_this getVariable ['TAG_fnc_carryingObject',false])"];
    
    
     Pick_up = { 
    	params ["_object","_caller","_id"];
    	_caller setVariable ['TAG_fnc_carryingObject',true];//mark the unit carrying an object
        _object attachto [_caller,[0,0.5,0.9]];
        _caller switchMove "AcinPercMstpSnonWnonDnon";
     };
    
     Put_down = { 
    params ["_object","_caller","_id","_arguments"];//notice the arguments parameter
    _arguments params ["_ammobox"];
            _caller removeAction _id;
    		_caller setVariable ['TAG_fnc_carryingObject',false];//mark the unit no longer carrying an object
            _caller switchMove "AidlPercMstpSlowWrflDnon_AI";
            _ammobox attachto [_caller,[0,0.6,0.2]];
            detach _ammobox; 
     };
    
    sleep 1200 ,deleteVehicle _ammobox;
    };

    Most likely can be done more elegant, quickly stitched this one together from your example.

     

    Cheers

    • Like 1

  4. 5 hours ago, Far East Lieutenant said:

    Hey guys,

     

    Straight to the point, the questions are:

     

    1. Does in-game radio voices like Kerry, HQ, etc. support script reading?(ex. If I type Hello in editor, the voice reads hello in game)

    2. If 1 is available, how do I implement in to the mission editor?

    3. If 1 is unavailable, how do I add a radio voice into the game through voice recording or other methods?

     

    I've been designing a mission, and there is a part where the mission gets compromised and the team should move on to the next objective.

    In that particular scene I would like to add some radio chat between operators and the HQ.

    As we all know there are in-game voices like Kerry and such.

     

    Thanks.

    v/r,

    Far East LT

     

    1: There's no text to speech or similar, you can dig through the config (either CfgRadio or CfgSentences), there are already pre recorded sentences and words to be used.

    For your example of moving towards another objective or cancel the current task I believe there are already similar recorded samples in the game files, either through kbTell system or a simple sidechat with say/playsound could do what you want.

    For MP you'd need to remoteExec sidechat and say/playSound commands so every player can see/hear them.

     

    Cheers

    • Like 1

  5. 20 minutes ago, target_practice said:

    Is it possible to alter the name of a variable using a different variable?

    For instance, if I had a script that returned some data to a variable, what would I need to do so said variable's name could be suffixed by a string passed to the script?

     

    You can't rename variables, only create new variables with a name depending on the input data, which doesn't make sense in any case I can think of.

    Wouldn't it be better to use a variable holding a string and adjust the string depending on input data?

     

    What are you trying to do?

     

    Cheers


  6. 1 hour ago, HazJ said:

    Oh dear... :rofl:

    @Grumpy Old Man

    You could add vehicle customisation parts like SLAT armour, camo net, etc...

     

    Didn't check since they added camo and backpack parts but the package should automatically detect all available animation sources (I believe it's currently set to detect cars only).

     

    22 hours ago, pikunov said:

     

    I want to add to the ALTIS LIFE server. everyone could pump cars for money in terms of engine, brakes ...

    (Add cost functionality)

     

    You can add the script to only one player and have him set the prices (preferred method) or you can modify the script itself to only allow changes if the requesting player has sufficient money, knock yourself out.

    :yay:

     

    Cheers


  7. It's not obvious at first, but you need individual render targets, in your case "piprendertg":

    _pipcam1 cameraEffect ["Internal", "Back", "piprendertg1"];
     _screen1 setObjectTexture [0, "#(argb,512,512,1)r2t(piprendertg1,1)"]; 
    
    _pipcam2 cameraEffect ["Internal", "Back", "piprendertg2"];
     _screen1 setObjectTexture [1, "#(argb,512,512,1)r2t(piprendertg2,1)"]; 
    //etc.

    Cheers

    • Like 1

  8. 36 minutes ago, target_practice said:

    For a script I'm making, I want mission makers to be able to place any number of markers that can be recognised by said script by part of the variable name.

    For example vehicleDepot_1, vehicleDepot_2 etc.

     

    How can I create an array which automatically contains markers placed in the mission with variable names starting with 'vehicleDepot'?

    Pretty simple:

     

    _vehicleDepotMarkers = allMapMarkers select {toUpper _x find "VEHICLEDEPOT" >= 0};

     

    Cheers

    • Like 2
    • Thanks 1

  9. 31 minutes ago, gc8 said:

    Hi

    I have a little tricky question about setVariable command which I hope the BIS developers can answer if no one else does. The question is what if I set the third parameter of the command to true so that the value is sent to all machines and keep setting the same value to the variable let's say 1. Will it keep sending that 1 over and over again as long as I call setVariable or does the command understand that value is already set and there's no need to update it over net? I think this is the way it should be to save bandwidth but I see there maybe point to send the updates too even the value remains the same.

     

    thx

    Why would you even want to broadcast a variable update all the time?

    Besides that, this seems to be nonsensical since the getVariable command can already return a default value if the variable currently does not exist on the data type (if that's what you're trying to do).

    Of course using the third parameter as true will force a broadcast, since that's what the intended use of the third parameter is, broadcasting it to all machines.

    What are you trying to do, exactly?

     

    You could probably select all clients where the value differs from your preferred value and only broadcast to those:

     

    _allTrucks = [truck1,truck2,truck3];
    _allTrucksFiltered = (_allTrucks select {_x getVariable ["TAG_fnc_someValue",1] != 1}) apply {owner _x};//will return owner ID array of all trucks with value != 1
    
    _myTruck setVariable ["myLocalVariable", ["321", _var], _allTrucksFiltered];

    Not tested, but could build from there.

     

    Cheers


  10. 13 minutes ago, Play3r said:

    It works great but the Civilian does not follow the Wp i have set up for him to follow, but he does react to BluFor.

    He just stand still and waits for me to walk up to him, It is my plan to have him walk around in the Village so he wont be in the same spot every time..

     

    Cheers

    This is the first post in this thread where you mention waypoints.

     

    Waypoints are stored per group, so upon joining the civ group all waypoints are gone, since it's a new group.

    You can use copyWaypoint to carry waypoints from one group over to another one.

     

    Cheers


  11. 13 hours ago, Play3r said:

     

     

    Sorry for the late reply G O M

     

    i have here to night tried your idea.

    My scenario is this to be exactly  

    You as BluFor enters a village with Civilians (made with CivilianModule) it is Working

    When you enter the Village ONLY One Civilian will be hostile against BluFor,

     

    I have tried to make it happen in VR but it does not seem to work for me,


    Placed a OpFor and put inside his INIT :[CivileChef] join createGroup civilian;      // CivileChef is the OpFor unit

    i have put down a trigger 150+150 to be actived by BluFor 

    Trigger is repeatable.

    in ACT i have : 

    Hint"insideTrigger";

     ShotCivile reveal [_x,4];                                        // ShotCivile is the Civilian you has to kill
    }forEach (ShotCivile nearEntities 200);

     

    In Dea:

    [ShotCivile] joinSilent grpNull;hint"outsideTrigger";


    But the Civilian does not engage me he just runs around

    Do i have to make the ShotCivilian join the OpFor Group Civilian ?

    or am i just doing it wrong?  apparently c",)

     

    Well you make your hostile unit join grpNull, doesn't really do what you wanted initially, so why not use my example and go from there?

    If you want the unit to go hostile as soon as he detects blufor units it could be as simple as:

    //unit init field:
    
    [this] join createGroup civilian;
    
    waiting = this spawn {
    	_targets = [];
    	waitUntil {
    		_targets = _this nearTargets 500 select {_x#2 isEqualTo west};
    		_this globalChat format ["Spotted %1 blufor",count _targets];
    		count _targets > 0
    	};
    	[_this] join createGroup east;
    	{
    		_this reveal [_x#4,4];
    	}forEach _targets;
    };

    Play with unit skills, spotting skill etc., lots of stuff to tweak in a case like this.

     

    Cheers


  12. Well a few things:

    BIS_fnc_selectRandom has long been replaced with a dedicated script command.

    To make loot more interesting you could use a weighted randomization. So certain (more powerful) weapons will be chosen less likely, giving some sort of accomplishment to the player.

     

    if ! ( isServer ) exitWith {};

    It's never needed in this case, since the script is yours and you know where it's executed. Just execute it on the server through remoteExec or, for stuff that needs to run only once use initServer.sqf.

     

    You can use helper objects like arrows, markers, or predefined positions if you want to retrieve multiple positions on the game map, like this:

     

    //initServer.sqf or wherever you seem fit
    
    //place objects on the map, like battery or similar, put this in each objects init field:
    this setVariable ["TAG_fnc_lootSpawn",true];
    
    //this marks each object as reference of where to spawn loot, to retrieve all loot positions and get rid of the no longer needed objects:
    _lootMarkerObjects = vehicles select {_x getVariable ["TAG_fnc_lootSpawn",false]};
    TAG_fnc_lootSpawnPositions = _lootMarkerObjects apply {getPosATL _x};
    {deletevehicle _x} forEach _lootMarkerObjects;
    
    //now TAG_fnc_lootSpawnPositions holds all positions needed to spawn the loot and the objects have been deleted
    //to spawn your loot on every position:
    
    
    
    {
    _weap = selectRandom ["hgun_Pistol_heavy_01_F", "hgun_P07_F", "hgun_Pistol_heavy_02_Yorris_F", "hgun_Rook40_F"];
    _qtd1 = random 3;
    _qtd2 = random 1;
    
    
    _Loot1 = "groundweaponholder" createVehicle _x; // Creates "groundweaponholder
    
    _magazines = getArray (configFile / "CfgWeapons" / _weap / "magazines");
    _magazineClass = selectRandom _magazines; 
    
    _Loot1 addWeaponCargoGlobal [_weap, 1]; // creater weapon
    _Loot1 addMagazineCargoGlobal [_magazineClass, _qtd1]; // creates magazine
    _Loot1 addItemCargoGlobal ["optic_Arco_blk_F", _qtd2]; // creates optics
    _Loot1 addBackpackCargoGlobal ["B_AssaultPack_blk", _qtd2]; // creates backpacks
    } forEach TAG_fnc_lootSpawnPositions;

    Also no need to define _this, since it's a magic variable and reserved to be used in special cases, so don't make it a habit, heh.

     

    You could use multiple tiers of loot using the above way, having certain positions spawn rifles or sniper rifles depending on the value returned by TAG_fnc_lootSpawn, easy to adapt and build upon.

     

    Cheers

    • Like 2
    • Thanks 1

  13. Most reliable way would be to have an opfor unit join the civilian side, then when needed let him join opfor side again.

    Editor placed (and spawned) civilians use a different FSM than east/west/ind units and aren't as capable in combat.

    Something like this:

     

    //opfor unit init field:
    [this] join createGroup civilian;
    
    
    //when you need to make the unit fire:
    [yourUnit] join createGroup east;
    {
    	yourUnit reveal [_x,4];
    }forEach (yourUnit nearEntities 500);//reveal everything to the unit within 500m to force an immediate reaction

    Cheers

    • Like 4
×