Home   Help Search Login Register  

Author Topic: dynamic infinite ammoscript  (Read 777 times)

0 Members and 1 Guest are viewing this topic.

Offline Blanco

  • Former Staff
  • ****
dynamic infinite ammoscript
« on: 04 Apr 2005, 23:48:42 »
I'm working on a dynamic infinite ammo script.
I don't want to add parameters or so, you can determine the ammo type via a "fired" eventhandler, transport the ammotype to a script that checks the ammo and add that magazine type again.

It goes like this, put this in the init :

Code: [Select]
this addeventhandler ["fired",{_this exec "fired.sqs"}]

The fired script

Code: [Select]
_unit = _this select 0
_muzzle = _this select 2

[_unit,_muzzle] exec "addmag.sqs"
_unit removealleventhandlers "fired"
exit

the addmag script

Code: [Select]
_unit = _this select 0
_ammo = _this select 1

#L
?!alive _unit : exit
?_unit ammo _ammo < 1 :goto "R"
~2
goto "L"

#R
_unit addmagazine _ammo
~1
goto "L"

The problem is that the fired script only checks one ammotype ,When the unit switches to grenades, law or handgun , the script fails.
What can be done to make this work?

 
« Last Edit: 04 Apr 2005, 23:49:36 by Blanco »
Search or search or search before you ask.

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:dynamic infinite ammoscript
« Reply #1 on: 05 Apr 2005, 00:04:24 »
You might have to detect the rest another way, they don't seem to have a 'muzzle' setting.


Planck
I know a little about a lot, and a lot about a little.

Offline Blanco

  • Former Staff
  • ****
Re:dynamic infinite ammoscript
« Reply #2 on: 05 Apr 2005, 00:31:08 »
True, for grenades you'll need the _ammo = _this select 4 to get the correct ammotype.
 
*edit*
 :P Wrong again.
_ammo = _this select 4 when you throw a grenade is "grenadehand". to add a grenade you'll need "handgrenade"

I did this and it works :

Code: [Select]
?_weapon == "throw" && _ammo == "grenadehand" : _ammo = "Handgrenade";[_unit,_ammo] exec "reloadnades.sqs"
But there is no logical system behind those ammoclasses...it a real mess...
I think the only way to do this , is to make a database inside the fired script. But I still have a real life, so I'll give up.  :(

 

 
« Last Edit: 05 Apr 2005, 00:50:40 by Blanco »
Search or search or search before you ask.

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:dynamic infinite ammoscript
« Reply #3 on: 05 Apr 2005, 02:34:55 »
Yeah, there isn't really a way to detect what MAGAZINE type was fired either, so you would have to create some sort of database any way you cut it.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!