Jump to content

Grumpy Old Man

Member
  • Content Count

    4313
  • Joined

  • Last visited

  • Medals

Posts posted by Grumpy Old Man


  1. 6 hours ago, Devastator_cm said:

    Now it looks like the problem is, any other mod can overwrite the code which I have only for my own vehicle.. So it is not that reliable solution in this case or am I mistaken?

    A quick glance at the wiki, as linked by @pierremgi, is always worth it:

    If EH function returns true, performed action is overridden.

    Even nowadays I still stumble upon interesting alternate syntax options.

    Also don't apply logic/your own conclusions on how a script command should work regarding its name, won't end well (*cough* playerViewChanged *cough* setWeaponReloadingTime).

     

    Cheers

    • Like 1
    • Haha 1

  2. I  swear that back in the alpha, rifles were holstered on the back for AI in safe mode, sometime before beta this got changed for some reason without any way to conveniently do this other than brute forcing the animation, which comes with its own downsides obviously.

    Glad you found a workaround, video looks pretty fluid as well.

    You could probably use an animation eventhandler to override all animations, might be a bit more elegant.

     

    Cheers


  3. A simple solution would be to introduce some kind of setSkillFinal command that overrides all that mumbo jumbo going on and simply sets the final value.

    According to oukej that's not likely to happen:

    This post also has a conversion table from old to new system (of sorts):

    AI's aimingAccuracy 	0.1 	0.2 	0.3 	0.4 	0.5 	0.6 	0.7 	0.8 	0.9 	1
    resulting coef. (old) 	23.5 	11 	6.8 	4.75 	3.5 	2.67 	2.07 	1.63 	1.28 	1
    resulting coef. (new) 	9.1 	8.2 	7.3 	6.4 	5.5 	4.6 	3.7 	2.8 	1.9 	1

    Note that this is just about AI, you probably need to tweak weapon config as well since it also affects accuracy, AI with 0 skill will still be lethal and extremely accurate in vehicle weapons (even non scoped variants like M2 static etc.).

     

    Cheers


  4. 6 hours ago, JohnKalo said:

    @Grumpy Old Man Just to post the results:

     

    I used the mission of yours and a few wiki Arma pages and I managed to make all tasks via a script called through the initPlayerLocal.sqf. The results were that tasks' lag still existed. Before it was about a minute. Now it is 1-2 seconds!!! The tasks location does not lag at all. Only the screen showing task assigned or task succeeded and such lags. On my end and I am on a laptop so it might not lag at all when on a computer. Now if it is MP compatible? Well where it said player I used west as stated in the wiki so it should be.

     

    As for the text, using the bis text functions meant no lag!!! And here is the weird thing. The bis function showing the letters to appear one by one lags like it does in the script while the other text functions do not lag. Whatevs. Issue overridden :thumbsup: 

    What exactly does lag? The animation that pops up mid screen? That's nothing you can avoid except not using the animation, seems to be odd that there's some kind of internal delay in the animation, I usually tend to add 5 seconds sleep before adding another task to make sure the current task hint animation is completed. Otherwise the animation of the new task gets played, followed by the animation of the previously completed task, pretty odd if you ask me.

     

    Still sounds like there's something odd going on, since slowed down info text functions can be the result of something clogging up the scheduler.

     

    Cheers

    • Like 1

  5. 21 hours ago, Jun Xiao said:

    Hi, I have an idea.
    When the RHS L39C trainer has finished launching the s-5 rocket, or the remaining s-5 rocket in the L39C, the pilot returns to a target point.
    But I don't know how to write code the trigger condition, I only know rhs_weap_s5m1 is S - 5 rocket.
    Who can help me? Thank you!

     

    A few ways to go on about this, most straightforward one:

    //vehicle init
    this addEventHandler ["Fired",{
    
    	params ["_veh"];
    	//grab all magazines containing "s5" and check if empty, if all of them are empty set flag to true
    	_toCheck = "S5";
    	_magsToCheck = magazinesAllTurrets _veh select {(toUpper (_x#0)) find _toCheck >= 0};
    	_emptyMagsAmount = count (_magsToCheck select {(_x#2) isEqualTo 0});
    	missionNamespace setVariable ["TAG_fnc_lastS5shot",count _magsToCheck isEqualTo _emptyMagsAmount,true];
    
    }];

    This will set the TAG_fnc_lastS5shot variable to true, once the last magazine containing S5 in the name is empty, in the trigger condition field simply put:

    missionNamespace getVariable ["TAG_fnc_lastS5shot",false];

    This will return false and only return true if the plane fired the last S5 rocket.

     

    Cheers


  6. 44 minutes ago, Alert23 said:

    Hi  guys,

     

    there is this command setDriveOnPath  which allows you to set the path for an AI driver via Markers

     

    but is it somehow possible to record the path of a vehicle-player (none AI) and then play that path on an AI?

    AI will not exactly drive on the path, but it will try to move as exact as possible, had some decent results with the cart doing slalom through tanoan main airport, also works flawlessly moving through the hangars (all possible entrances, heh).

    No longer got the snippet I used, was just a simple loop recording my position every 5m or 5 seconds, whatever came first.

    Worked pretty good.

     

    Something like this, with a unit named "test" sitting inside a vehicle:

    
    
    GOM_fnc_path = [];
    
    
    GOM_fnc_recordPath = {
    
    	_duration = 30;//record path for 30 seconds after activation
    	_interval = 3;//record path at least once every 3 seconds
    	_distance = 5;//record path at least every 5m
    	_record = [];
    	_timeOut = time + _duration;
    	_lastPos = getPosATL player;
    	_lastTime = time;
    	while {time < _timeOut} do {
    		waitUntil {getPosATL player distance2D _lastPos >= _distance OR time > _lastTime + _interval};
    
    		_lastPos = getposATL player;
    		_lastTime = time;
    		GOM_fnc_path pushBack _lastPos;
    
    	};
    
    	copyToClipboard str GOM_fnc_path;
    	test switchCamera "EXTERNAL";
    	test setDriveOnPath GOM_fnc_path;
    
    
    };
    
    [] spawn GOM_fnc_recordPath;

    Be aware that it's still the AI who's driving...

     

    Cheers

    • Like 3
    • Haha 1

  7. 6 hours ago, SSgt I. Ramos said:

    I haven't seen this issue posted here, but after using the MOD script and saving a preset, I am no longer able to access bombs through the cycle menu. The only way I have been able to resolve this is by reinstalling ArmA 3. Any thoughts?

     

    Edit: I should also say that I am not using mods and I have never had this issue before.

    What exactly do you mean by cycle menu?

    Can you post step by step what you're doing so I can reproduce?

    Does this happen all the time?

     

    Cheers


  8. 36 minutes ago, JohnKalo said:

    @Grumpy Old Man Ok thanks! Just one question for now. Since it is an MP mission, I will place the code in the init.sqf and call it via a trigger (_runTasks = [] spawn GOM_fnc_linearTasks;) but what will I type in this param:

     

    
    _taskOwner = player;

    like blue0, blue1, blue2; or [blue0, blue1, blue2]; or something like players;?

    init.sqf is executed for the server and for every player that joins, so that would be a bad idea.

    You can use named units, or handle adding players to tasks via initPlayerLocal.sqf, probably worth its own thread to not further derail this one.

     

    Cheers

    • Thanks 1

  9. 39 minutes ago, JohnKalo said:

    Maybe I should try using script generated tasks and not modules to see if those lag. Hard since the mission is all set but it would be nice to see if the script tasks lag. And most online tutorials are for using modules. I found an example but the thread is all in german. I do not know so many german so can you please send me an MP example in scripting tasks?

     

    I already posted some basic examples on how to tackle simple task scripting in these forums:

     

     

     

    Check the demo mission in the second one.

     

    Cheers

    • Thanks 1

  10. Would be easier to do using a simple function instead of a trigger:

    //inside a spawned function:
    
    playSound "YourSound";
    
    _duration = 21;
    _timeOut = time + _duration;
    TAG_fnc_puzzleSolved = false;
    
    waitUntil {time > _timeOut OR TAG_fnc_puzzleSolved};
    if (time < _timeOut AND TAG_fnc_puzzleSolved) exitWith {hint "Puzzle solved!"};
    hint "Puzzle failed";//will only show if the time is up without the puzzle solved

    Cheers

    • Like 2

  11. 2 minutes ago, redburn said:

     

    that is, a random amount, not less than 0.3

     

    I'm sorry not to explain myself correctly.

    Kidding aside, you want a variable to turn true once a vehicle is damaged more than 0.3?

    Why not just:
     

    RBN_granDamage = false; 
    waitUntil {damage dispo1 >= 0.3};
    RBN_granDamage = true; 
    //do stuff

    Cheers


  12. 8 minutes ago, redburn said:

    Hi all,
    I have a problem that does not allow me to live in peace, I try to make an event that when a vehicle receives an amount of damage a variable is TRUE and I mark a specific action, but every time I enter the map to try the script something It goes wrong and I do not know what it would be.

    Someone help me? here the script that I have made.

     

    
    //initDamageVeh.sqf
    
    _granDamage = false;
    
    dispo1 addEventHandler ["Hit", 
    {
    	params ["_unit", "_source", "_damage", "_instigator"];
    	
    	dispo1 setdamage 0.10;
    	veh = getDammage dispo1;
    
    	if (veh => 0.30) then {
    		_granDamage = true;
    	};
    
    }];

     

     

    That entire snippet doesn't make sense.

    At all.

     

    At first you don't need global variables, when you could simply use the _unit parameter that's being passed inside the EHs code.

    Then you manually set the damage of the vehicle to 0.1, yet check with an if statement if the damage is (what I presume) bigger than 0.3, which will only be true if the vehicle gets destroyed with one hit (big explosive charge or tank hit might do that).

    The check of the damage isn't proper syntax, you're using =>, which might pass as a smily face, but not as bool comparison, you might want to use >= instead.

    Then inside the if statement you set a local variable to true, which can't be accessed anywhere outside the scope where it has been defined, namely the if statement inside that EH.

     

    To top it off the variable names are all over the place, you'd want them named in a way that makes it obvious what they contain and as best practice add a tag to them to prevent conflicts with other scripts/addOns.

    The vehicle could be called RBN_obj_dispo1 (whith RBN being short for redburn), the global variable to handle the damage check could be called RBN_flag_dispo1Damaged or similar.

     

    I suggest taking a look at some basic scripting guides first before attempting something like that, heh.

     

    What exactly do you want to accomplish? In your post you state that you want to check for damage, but in the snippet you manually set the damage of the object.

     

    Cheers

    • Like 2

  13. 4 minutes ago, gc8 said:

    Hi

    I'm trying to refill the ammo of vehicle (namely A164 wipeout) but don't seem to find the right commands. I tried setAmmo but that only gives one AA missile back to the plane when it should have two of them.

    Any one knows how to do this properly?

     

    Edit: allTurrets command also returns empty array and I cant find alternative.

     

    thx!

    Try setVehicleAmmoDef.

    Also try to improve your search game, since you can easily stumble upon this command by using ctrl+f on the scripting command wiki page and searching for either "ammo" or "vehicle".

     

    Cheers

    • Like 1
    • Thanks 1

  14. 9 hours ago, Alpine_gremlin said:

    Hey guys, so I`m trying to set up a scenario where the player gets betrayed by a specific group. One way I`m thinking of triggering the event is to have him get shot (not killed though) by one of the group members.

     

    I have this:

    
    player addEventHandler 
    ["Hit",{
    	params ["_unit", "_source", "_damage", "_instigator"];
    	if (_this select 3 in traitorGrp) then 
    		{betray = true};}
    ];

    When I try to use this however, I get "Error in: type group, expected array, object, location"

     

    As you can see I am trying to check if the shooter is in the specified group, and if so, set the variable. Is a group not an array however? Additionally I`m quite sure that "_instigator" is most certainly a unit.  I`m not quite sure how to approach this. Using the side command did not seem to work either.

    Group is its own data type, similar to object, location or array.

    The "in" command needs either a vehicle, to find if a unit is inside it, or an array, to check if an element exists inside an array.

    Group is of data type group, so the "in" command doesn't work, hence why you need "units group".

     

    Cheers

    • Like 2
×