Jump to content
Sign in to follow this  
Dael

Infinite ammo, is it possible?

Recommended Posts

Hi! Working with a new OFP MP Map, which is supposed to have a sentry gun with infinite ammo in the middle. There has to be a way to "refill" ammo in an M2 if it runs out of ammo, for example "if ammo=0, set ammo=500" or something of the sort. The M2 is classed as an armored vehicle, and not like a handheld weapon, I think that is why I cannot find the weapon nor the name of the ammo on Lustypoohs Command List...

Suggestions for a script, anyone?

P.S. No Resistance or anything, the only Flashpoint working on school computers is the good ol' Flashpoint 1.00... Back to basic =)

Share this post


Link to post
Share on other sites

Dunno if eventhandlers work in 1.00... but try

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">addeventhandler ["fired", {_this select 0 addmagazine (_this select 4)}]

Share this post


Link to post
Share on other sites

no, eventhandlers was a new editor feature of Resistance, it does not exist in 1.0 - 1.46

But, instead of making a script to refill ammo , how about adding a lot of browning magazine , this way you will have to fire a very long time to empty the M2

Put in the init line of a M2 the following (copy paste with CTRL+C and CTRL+V)

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addmagazine "Browning"; this addmagazine "Browning"; this addmagazine "Browning"; this addmagazine "Browning"; this addmagazine "Browning"; this addmagazine "Browning";this addmagazine "Browning"; this addmagazine "Browning"; this addmagazine "Browning"; this addmagazine "Browning"; this addmagazine "Browning"; this addmagazine "Browning"

This way you will have 12 full magazines of 500 bullets each already placed in the M2.

Every time you or the AI soldier will have fired 500 bullets, another magazine is placed automatically , without stoping your continued fire.

Share this post


Link to post
Share on other sites

Or you could time a loop that would add another magazine every x seconds/minutes.

Share this post


Link to post
Share on other sites

Bah, I could drain 6,000 bullets in now time biggrin_o.gif

Share this post


Link to post
Share on other sites

Harnu's is more practical. Just make a little script like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#loop

mgun1 addmagazine "Browning"

~20

goto "loop"

Share this post


Link to post
Share on other sites
Harnu's is more practical. Just make a little script like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#loop

mgun1 addmagazine "Browning"

~20

goto "loop"

I never tested this, but is there a limit on the maximum number of magazines that can be added to a weapon like this M2 ?

If there is a limit, maybe this loop script can lead to some crash.

Share this post


Link to post
Share on other sites
Harnu's is more practical. Just make a little script like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#loop

mgun1 addmagazine "Browning"

~20

goto "loop"

I never tested this, but is there a limit on the maximum number of magazines that can be added to a weapon like this M2 ?

If there is a limit, maybe this loop script can lead to some crash.

Maybe

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#loop

?(("_x == {browning}" count (magazines mgun1)) < 5): mgun1 addmagazine "browning"

~20

goto "loop"

Syntax not guaranteed.

Share this post


Link to post
Share on other sites
Dunno if eventhandlers work in 1.00... but try

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">addeventhandler ["fired", {_this select 0 addmagazine (_this select 4)}]

sry for bumping this topic, but when i use that, it says, no entry config.bin/bulletsingew of whatever, and when i use an addons it does the same with another name sad_o.gif

help me plz, i really need this...

Share this post


Link to post
Share on other sites

Well that wouldn't even work for an m2, cause if you fired 5 times it would add 5 mags, that's too much and might crash the game.

Share this post


Link to post
Share on other sites

sh*t, and theres nothing else, exept that ammorefill script for unlimited ammo? sad_o.gif

Share this post


Link to post
Share on other sites
sh*t, and theres nothing else, exept that ammorefill script for unlimited ammo?  sad_o.gif

this is something I wrote for playing around with the sst mod

put {group_1 = group this} into the init line of the group leader

init.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

mi_equip = preprocessfile "group\mi_equip.sqf"

mi_reequip = preprocessfile "group\mi_reequip.sqf"

fillammo = preprocessfile "group\fillammo.sqf"

group_1 exec "group\mi_group.sqs"

group\mi_group.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_group = _this

{_x call mi_equip} forEach units _group

#loop

{_x call mi_reequip} forEach units _group

~7 + random 3

goto "loop"

group\mi_equip.sqf

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

private ["_unit","_done"];

_unit = _this;

_done = false;

if ( "SoldierMImedic" counttype [_unit] == 1 ) then

{

// MI (Medic) SoldierMImedic

removeAllWeapons _unit;

_unit addWeapon "Binocular";

_unit addWeapon "Nvgoggles";

_unit addmagazine "morita_terra";

_unit addWeapon "morita_terra";

_done = true;

};

if ( "SSTMIJJ" counttype [_unit] == 1 ) then

{

// PowerSuit SSTMIJJ

removeAllWeapons _unit;

_unit addWeapon "Binocular";

_unit addWeapon "Nvgoggles";

_unit addmagazine "morita_lsw";

_unit addWeapon "morita_lsw";

_done = true;

};

if ( !_done ) then

{

removeAllWeapons _unit;

_unit addWeapon "Binocular";

_unit addWeapon "Nvgoggles";

_unit addmagazine "morita";

_unit addWeapon "morita_Carb";

_done = true;

};

true;

group\mi_reequip.sqf

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

private ["_unit","_weap"];

_unit = vehicle _this;

_weap = primaryWeapon _unit;

if ( alive _unit ) then

{

if ( "morita_terra" == _weap ) then

{

[_unit, "morita_terra", 4] call fillammo;

};

if ( "morita_lsw" == _weap ) then

{

[_unit, "morita_lsw", 10] call fillammo;

};

if ( "morita_Carb" == _weap ) then

{

[_unit, "morita", 8] call fillammo;

[_unit, "SST_flaregun", 1] call fillammo;

};

if ( "sst_50Caliber" counttype [_unit] == 1 ) then

{

[_unit, "50Caliber", 8] call fillammo;

};

};

true;

group\fillammo.sqf

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

private ["_unit","_mag","_number","_count"];

_unit = _this select 0;

_mag = _this select 1;

_number = _this select 2;

_count = "_x == _mag" count (magazines _unit);

if ( _number > _count ) then

{

_unit addmagazine _mag;

};

true;

quiet_man

Share this post


Link to post
Share on other sites

Yikes, your bombarding the poor guy with so many large scripts, when you can just do it with a trigger! In the condition field put<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">! SomeAmmo MgunWhere Mgun is the name of the gun, and in the activation field put <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Mgun addmagazine "Browning"Set the trigger to repeadedly, and your set.

Share this post


Link to post
Share on other sites
Dunno if eventhandlers work in 1.00... but try

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">addeventhandler ["fired", {_this select 0 addmagazine (_this select 4)}]

WHAT!!! your only using 1.00 is that your version of ofp...

if so lol u need to upgrade to res.

Quote[/b] ]! SomeAmmo Mgun

Where Mgun is the name of the gun, and in the activation field put Code Sample

Quote[/b] ]Mgun addmagazine "Browning"

Set the trigger to repeadedly, and your set.

that works

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  

×