Powered by Invision Power Board


Forum Rules OFP.info Forum Rules
 

> Unlimited AI ammo.
armyof2
Posted: December 06, 2007 06:21


New Member
*

Group: Members
Posts: 77
Member No.: 8322
Joined: August 08, 2006



Hey all, anybody got a script to give AI unlimited ammo? Need it for a mission with lots of shooting (at invisible targets) but they always run out of ammo...

Thanks. thumbsupsmileyanim.gif


--------------------
OFP will never die.

USMC-"WE STOLE THE EAGLE FROM THE AIR FORCE, THE ANCHOR FROM THE NAVY AND THE ROPE FROM THE ARMY.
ON THE SEVENTH DAY WHILE GOD RESTED, WE OVERRAN HIS PERIMETER, STOLE THE GLOBE AND WE'VE BEEN RUNNING THE WHOLE SHOW EVER SINCE."
Top
SaS TrooP
Posted: December 06, 2007 16:57


Lazy OFP fan ;)
**

Group: Members
Posts: 274
Member No.: 9568
Joined: December 21, 2006



Just write something like this:

CODE
;InfiniteAmmo.sqs

@_unit has weapon "WeaponName";
Goto "#petla";

#petla

_unit addmagazine "magazinename";

~time

EXIT


OK, I havent got sure its working, caue I wasnt using it for long time.

Listen: Just modify:
1. _unit = name of the soldier
2. WeaponName = name of the weapon e.g "g36a"
3. Magazinename = magazine name e.g. "g36amag";
4. time = type there a time. For example 5 or 259820986. Those are seconds, so you are able to change as many as you can. Dont forget about "~" sing, cause its very important


--------------------
Removed according to the rules:
QUOTE
# total height of your signature-image(s) must not exceed 100 pixels.
# height of any image, flash animation or any other signature single element must not exceed 100 pixels.
# total size of all files used in your signature must be no more than 100 KB.


Yours were 700KB and around 150 pixels height
Users Website
Top
Rellikki
Posted: December 07, 2007 02:44


a.k.a. Serial Killer
Group Icon

Group: OFP.info Team
Posts: 1569
Member No.: 5233
Joined: January 04, 2005



That script is incorrect...
First, it goes to the "petla" section even if the player doesn't have the certain weapon - you didn't put any loop there to recheck it. Second, there's no point for the timing thing because you didn't put anything there to loop it. rolleyes.gif
Users Website
Top
JynX
Posted: December 07, 2007 05:03


Jehran Minister of Science & Technology
**

Group: Members
Posts: 171
Member No.: 8170
Joined: June 29, 2006



I mis linkers inexhaustible knoweldge of OFP scripting...

WRONG! biggrin.gif
CODE

;InfiniteAmmo.sqs

@_unit has weapon "WeaponName";
Goto "#petla";

#petla

_unit addmagazine "magazinename";

~time

EXIT


errors:
your loop wouldn't work. your not providing it with any information on what to do if the person hasn't got the weapon.
your script could be tidied up a lot though the idea is right.

Correction (I think)
using example of a unit using an AK74SU because i love that gun in the game
CODE

;InfiniteAmmo.sqs

_unit = this select 0

#checkgun
?(_unit HasWeapon "AK74SU")):Goto "loop"
;?(not(_unit HasWeapon "AK74SU")):Goto "addgun"

#loop
?(Not({_x == "AK74"} count magazines soldier1)>=2):goto "addmags"
Goto "recheckall"

#addmags

_unit AddMagazine "AK74"
~0.1
Goto "loop"

;#addgun
;~0.1
;_unit AddMagazine "AK74"
;_unit AddMagazine "AK74"
;_unit AddMagazine "AK74"
;_unit AddMagazine "AK74"
;_unit AddMagazine "AK74"
;_unit AddWeapon "AK74SU"
;_unit SelectWeapon "AK74SU"
;Goto "checkgun"

#recheckall
Goto "checkgun"
EXIT


when scripting to add stuff to units i find it best to write as if your telling the game: what the unit should have, and what to do if they dont have it. Whilst also making room for the event that they do have it. i'd describe how to make one script work for an entire group but its 3am, which i guess is my bed time lol

hope that helps

EDIT: fixed a bug in the magazine counting line

This post has been edited by JynX on December 07, 2007 05:09


--------------------
LCPL Jakal A3-PM
--------------------------------------
LCpl Andrew "Jakal" Somerville
3rd Platoon Alpha Company
--------------------------------------
Rotary Wing Transport Specialisation
--------------------------------------
OFP.Info: JynX
Xfire: asms
BI Forum: ToadBall
ArmA.info: JynX
Ingame ArmA: ToadBall
Ingame OFP: ToadBall/Jakal/JynX yet to decide which
You are not Superman. (Freshly graduated recruits from Marine boot camp and all fighter pilots, especially, take note.)

Users Website
Top
SaS TrooP
Posted: December 07, 2007 22:10


Lazy OFP fan ;)
**

Group: Members
Posts: 274
Member No.: 9568
Joined: December 21, 2006



QUOTE (Rellikki @ December 07, 2007 02:44)
That script is incorrect...
First, it goes to the "petla" section even if the player doesn't have the certain weapon - you didn't put any loop there to recheck it. Second, there's no point for the timing thing because you didn't put anything there to loop it. rolleyes.gif

???????????????????????

What?
Co?
Was?

Can you repeat???
Mógłbyś powtórzyc???
[i dont know how its in german]Can you repeat?[/i dont know how its in german]


--------------------
Removed according to the rules:
QUOTE
# total height of your signature-image(s) must not exceed 100 pixels.
# height of any image, flash animation or any other signature single element must not exceed 100 pixels.
# total size of all files used in your signature must be no more than 100 KB.


Yours were 700KB and around 150 pixels height
Users Website
Top
Rellikki
Posted: December 08, 2007 02:29


a.k.a. Serial Killer
Group Icon

Group: OFP.info Team
Posts: 1569
Member No.: 5233
Joined: January 04, 2005



Ok, that was an useless message, stop the spam. You should have pointed what you don't understand... huh.gif And you should know that repeating the message won't help. You can read it as many times as you want from above.
Users Website
Top
« Next Oldest | Mission Editing & Scripting | Next Newest »

Topic Options Fast Reply