Jump to content
Sign in to follow this  
stephen271276

FireFight with no casualties???

Recommended Posts

As part of a MPmission I am making one of the tasks the players must do is go and help a SF group that is pinned in a small building by advancing enemy groups.

What I need is to have all the units placed in the editor and to fire at eachother so that when the players arrive to firefight is already taking place..... Now the problem with this is that depending on how long the players tkae to find the site either the SF group or the opfor will probably all be dead so I need something that will let the firefight take place but take no casualties untill a trigger is fired when the players enter the area then everything can go back to normal....

Any ideas>?

Share this post


Link to post
Share on other sites

this allowDamage false in the init line of a unit will make him not be able to die if you wan't that

Share this post


Link to post
Share on other sites

yeah put an area trigger down and group it to the player, and put in the on activation

unit allowDamage false; unit2 allowDamage false; unit3 allowDamage false

And repeat for every soldier that has "this allowDamage true" in their init box.

Share this post


Link to post
Share on other sites

You could then run into another problem. If the player(s) take too long to get there, the AI units may have run out of ammunition. (Firing at invincible enemies).

Check out the addMagazine command if this is the case.

Share this post


Link to post
Share on other sites
You could then run into another problem. If the player(s) take too long to get there, the AI units may have run out of ammunition. (Firing at invincible enemies).

Check out the addMagazine command if this is the case.

This is not a problem :) Here is script for unlimited ammo :)

Works fine on rifles, pistols, AT-launchers for any soldiers.

UNLIMITEDAMMO.sqf

_unit = [color="Blue"]_this[/color] [color="Red"]select[/color] 0;
[color="Blue"]While[/color] {[color="Red"]alive[/color] _unit} do {
[color="Red"]waitUntil [/color]{(_unit [color="Red"]ammo[/color] (currentWeapon _unit))==0};
_weapon = [color="Red"]currentWeapon[/color] _unit;
_magazines = [color="Red"]getArray[/color] (configFile >> "CfgWeapons" >> _weapon >> "magazines");
_magazine = (_magazines [color="Red"]select[/color] 0);
_unit [color="Red"]addMagazine[/color] _magazine;
[color="Red"]waitUntil[/color] {(_unit ammo ([color="Red"]currentWeapon[/color] _unit))>0};
};

Share this post


Link to post
Share on other sites

easiest way is

set trigger to anybody present

{_x allowdamage false} foreach thislist

Share this post


Link to post
Share on other sites
this addeventhandler ["fired", {(_this select 0) setvehicleammo 1}]

that is a simple eventhandler way to give unlimited ammo, but AI won't reaload or anything they will be constantly topped up.

Also make sure you set the allowDamage false trigger at the right area, because if a player could sit just outside the trigger and see the Opfor AI then that would cause a problem, start shooting and they wouldn't die.

Share this post


Link to post
Share on other sites
that is a simple eventhandler way to give unlimited ammo, but AI won't reaload or anything they will be constantly topped up.

Also make sure you set the allowDamage false trigger at the right area, because if a player could sit just outside the trigger and see the Opfor AI then that would cause a problem, start shooting and they wouldn't die.

Is it possible to use this command, and making the soldier reaload?

Share this post


Link to post
Share on other sites

probably, if there is a way to detect when someone reloads you could just use setVehicleAmmo 1, otherwise check out DAP's script.

Share this post


Link to post
Share on other sites

add a magazine everytime it is 0 bullets left:

// execute with this in unit init line:
// _null = [this,"start"] execVM "addmag.sqf";

_unit = _this select 0;

if ("start" in _this) then {
_unit addEventHandler ["Fired", {_this execVM "addmag.sqf"}];
} else {
_weapon = _this select 1;
_magazine = _this select 5;
if((_unit ammo _weapon) == 0) then {
       waitUntil {(_unit ammo _weapon) != 0};
	_unit addMagazine _magazine;
};
};

changed it to wait until reloaded, but if unit only has 1 magazine it will not get more.

this if unit uses AT / AA weapons and only has 1 round, remove waituntil line to make it work with only 1 magazine in inventory, but this may cause issues with full inventory, but i think it will work fine, since you can "overload" inventory as much as you want.

Edited by Demonized
added waitUntil to counter full inventory

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
Sign in to follow this  

×