Jump to content

Would this script part from what I am working on work for an ammo limit?


Recommended Posts

Posted (edited)

I am trying to make an ammo limiting mod, this is a small part of it, would this work if I tried to compile it? Keep in mind I am asking about this setup, not the actual script itself, it is missing a name and everything obviously.

 

Event OnInit()
;--------------------------------------------------------------------------------
Player = Game.GetPlayer()
;--------------------------------------------------------------------------------
int MaxAmmo10mm = 120
;--------------------------------------------------------------------------------
int 10mmAmmoDrop = (Player.GetItemCount(Ammo10mm) - MaxAmmo10mm)
;--------------------------------------------------------------------------------
If (Player.GetItemCount(Ammo10mm) > MaxAmmo10mm)
Player.DropObject(Ammo10mm, 10mmAmmoDrop)
Debug.Tracer("Ammo limit for 10mm reached!")
EndIf
EndEvent
Edited by vTemporalZEROv
Posted
Yes and no. Yes in that the code looks good, no in that it would only run once and the player could simply pick up the ammo again from the ground.
Posted

Yes and no. Yes in that the code looks good, no in that it would only run once and the player could simply pick up the ammo again from the ground.

Hmmm how would I make it constantly run? I have a quest set up that checks if the player has more than 120 rounds as an entry point getitemcount, and haven't really touched it much, could I use that somehow? Or would it have to be via this script?

Posted
You could use the quest to do it. You would want to use the StartTimer and OnTimer functions to create a looping system, then check in the OnTimer function to see if the player has too much ammo.
Posted

You could use the quest to do it. You would want to use the StartTimer and OnTimer functions to create a looping system, then check in the OnTimer function to see if the player has too much ammo.

Are those script functions or something to do with the quest?

Posted

 

 

You could use the quest to do it. You would want to use the StartTimer and OnTimer functions to create a looping system, then check in the OnTimer function to see if the player has too much ammo.

Are those script functions or something to do with the quest?
Those are script functions.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...