Jump to content

Recommended Posts

Hello everyone.

This question is somewhat open-ended, because I am not sure what is possible with the engine and its mission scripting limitations. 

Aim:
To create humanitarian player roles in a coop mission (think Red Cross or OPCW personnel). They would have a specific skill, and would be ignored by enemy AI. They would have the *option* of picking up a weapon, but with penalties and loss of neutrality.

What I know:
Setting the unit neutral ( setCaptive ). Checking for weapons ( hasWeapon ).

What I am not sure about:
Restricting the inventory and actions. One method would be checking and removing items from inventory in a loop. This seems wasteful and frustrating for players who pick things up and find items disappearing. A better method would be to remove the option of picking up certain items in the first place. However, as I found out with googling, removeAction only removes previously added actions, not game default ones (such as picking up weapons).

I am also unsure how to restrict the carry capacity of certain players. The following page seems to address it, but I don't understand what the class CfgInventoryGlobalVariable is and where it is defined for individual players: https://community.bistudio.com/wiki/Arma_3_Stamina . It seems setUnitTrait is also an option, but I am not sure how it works.

Third, it would probably be immersive to prevent humanitarian players from aiming down sights/zoom in order to further discourage shooting. Can this key or command be disabled in any way?

Many thanks for suggestions!

 

Share this post


Link to post
Share on other sites
8 hours ago, Melody_Mike said:

Restricting the inventory and actions. One method would be checking and removing items from inventory in a loop. This seems wasteful and frustrating for players who pick things up and find items disappearing. A better method would be to remove the option of picking up certain items in the first place. However, as I found out with googling, removeAction only removes previously added actions, not game default ones (such as picking up weapons).

Rather than preventing players from picking up weapons, why not make them suffer the consequences of their choices?   So if they pick up weapons, they are no longer considered neutral (so you set setCaptive false).  You can even be more nuanced, and sense when they have a weapon, and have enemy then first challenge the player (enemy targets player and orders him to drop weapon, and if he does not comply, then you setcaptive false, and player is shot).  This feels more "real" to me than not allowing taking of weapons.   If player wants to complete the mission without being killed, he will learn not to pick up weapons.

 

In my first Last Tango in Tanoa mission, I did something similar.  When the player approached the farm where there were friendly soldiers and a civilian.  My code detected if player (a policeman) had his weapon raised.  If the weapon was raised, the friendly army units would raise their weapons, target player, and say "Sir, lower your weapon!".  The player was given 2 warnings, and if he did not comply, he was then setcaptive false, and killed by the army units.  (Its always bothered me that you can point your weapon at friendly AI they will not react).  If player lowered weapon, he was allowed to proceed.

  • Like 1

Share this post


Link to post
Share on other sites

Fair enough :]. I should have made explicit that the idea of combining hasWeapon and setCaptive in the initPlayerLocal.sqf had already occurred to me. 

Would you take offense if I de-PBO'd your mission and took a look at how you scripted those warnings?

In my intended mission, "regular" soldier players will have to cooperate with humanitarian players to complete objectives. I am afraid that the humanitarian players would get bored if they were completely ignored by the enemy. But perhaps I just need to create appropriate hazards, such as mines or using LAMBS AI script for RPG's to allow more explosives, so as to make it dangerous for non-combatants. 

Do you have any experience in customizing stamina for each player?

Share this post


Link to post
Share on other sites
25 minutes ago, Melody_Mike said:

Would you take offense if I de-PBO'd your mission and took a look at how you scripted those warnings?

My scripts are always free to all my friend!  I will save you some time digging for it.  Here you go:

Spoiler

playerChallenged = false;

_dmy1 = [] spawn 
{
    waituntil {sleep 1; valdez distance mpFedAR < 30 and vehicle valdez == valdez};
    sleep 3;
    if (!weaponLowered valdez) then 
    {
        playerChallenged = true;
        //mpFedAR customRadio [JBOY_Channel,"mpLowerWeapon"];
        mpFedAR say3d "mpLowerWeapon";
        //mpFedAR globalchat "Sir, Lower your Weapon...";
        {_x setBehaviour "COMBAT"; _x doTarget valdez; _x disableAI "AUTOCOMBAT";} foreach ((units mpFedGroup) + (units group cojonNemesis));
        sleep 8;
        if (!weaponLowered valdez) then 
        {
            //mpFedAR customRadio [JBOY_Channel,"mpLowerWeaponNow"];
            mpFedAR say3d "mpLowerWeaponNow";
            //mpFedAR globalchat "Lower your Weapon NOW!";
            sleep 6;
            if (!weaponLowered valdez) then 
            {
                sleep 2;    
                valdez addrating -9999999;  //set player renegade so he is hosed.
                booger addrating -9999999;
            } else
            {
                {_x setBehaviour "CARELESS"; _x doTarget objnull;} foreach ((units mpFedGroup) + (units group cojonNemesis));
                valdez customRadio [JBOY_Channel,"mpSorryMyBad"];
                playerChallenged = false;
                //valdez globalchat "Sorry...my bad.";
            };
        } else
        {
            {_x setBehaviour "CARELESS"; _x doTarget objnull;} foreach ((units mpFedGroup) + (units group cojonNemesis));
            valdez customRadio [JBOY_Channel,"mpSorryMyBad"];
            playerChallenged = false;
            //valdez globalchat "Sorry...";
        };
    };
};    

 

Note that my script is specific to one encounter with a particular army group leader named mpFedAR.  To generalize this, you would have to monitor the humanitarian player's distance to any army units on the map that need to react to them.  The code in the above snippet could be generalized to use JBOY_Speak and vanilla voice files if you like.  You would replace my custom say3d for "Lower your weapon" to be a call to JBOY_Speak for "DropThatWeapon" for example.  Feel free to unpbo my mission to get voice files or anything else.

34 minutes ago, Melody_Mike said:

I am afraid that the humanitarian players would get bored if they were completely ignored by the enemy. But perhaps I just need to create appropriate hazards, such as mines or using LAMBS AI script for RPG's to allow more explosives, so as to make it dangerous for non-combatants. 

This sounds interesting, and i agree you need to get creative to keep it fun for non-combatants.  Maybe they have to run thru obstacles while armed players cover them, deactivate mines, maybe some CRBN suit stuff where they deal with chemical weapons and other hazards (see Alias's scripts for pipe leaks and coughing).  Maybe some way they can prepare a trap, or delaying trick to help the player shooters.

 

37 minutes ago, Melody_Mike said:

Do you have any experience in customizing stamina for each player?

No but I think remember topics on that you can find with google.

 

Sounds like a fun project Mike.  Good luck!

  • Like 1

Share this post


Link to post
Share on other sites

This is just a rough idea.

Nothing has been tested.

 

dude refers to a single unit, but can be changed to run on multiple units.

 

Performing weapon check should be simple enough for the sober ones! 🤤

 

//	AI won't treat like enemy - Can still be killed in crossfire.
dude setCaptive true;

//	Increase weapon sway - More difficult to shoot accurately.
dude setCustomAimCoef 5;

//	Increase weapon recoil.
dude setUnitRecoilCoefficient 5;


dude addEventHandler
[
	"InventoryClosed",
	{
		params ["_unit", "_container"];

		COMMENT
		"
			Perform hasWeapon check.

			setCaptive false if has weapon / visible weapon.
			Check if a weapon is in hands or concealed.
		";
	}
];

 

  • Like 2

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×