Jump to content

Get Item Count for ammo not working


21stcenturybreakdown

Recommended Posts

Hi all. I want to know why my script for unlimited ammo won't compile.

 

----------------------

 

scn myunlimitedammotest
Begin.OnGamemode
If Player.GetItemCount Ammo10mm < 150
Player.AddItem Ammo10mm 200
EndIf
End
----------------------
The lines are only there on this post to separate the script from text, but yeah. I've tried without the Begin.OnGamemode, and I've tried with different variations, like Begin GameMode. I've even tried taking off that part and the end part, but nothing happens. And due to Fallout NV's GECK not telling you where your script went wrong, it's difficult to troubleshoot.
Advice would be appreciated.
Link to comment
Share on other sites

If you are having problems with a script refusing to compile, but no idea as to why, then you need to add the community developed "GECK 1.4 Power-Up", an optional NVSE plugin supplement, to GECK. Please see the 'Solutions to "Garden of Eden Construction Kit" (G.E.C.K.) problems' section in the wiki "Fallout NV Mod Conflict Troubleshooting" guide.

Your script has to be placed inside of a "block" consisting of a "Begin" and an "End" statement. A "GameMode" block (i.e. "Begin GameMode") executes every frame. I know you tried that, but as your problem still persisted you might have gotten confused into thinking that was the problem.

 

Your "Player.GetItemCount Ammo10mm < 150" is an expression, which needs parenthesis to cause the "(Player.GetItemCount Ammo10mm)" to be evaluated as a single value return function, which will then be compared to determine if it is less than 150. As it is, the expression won't get parsed correctly. In general when you have a "two part" function call conditional, such as "GetItemCount <object ID>", then you need parens to group the related parts of the function together for proper evaluation.

 

Learn to use "indentation" to make it easier to see which lines of code are part of different sections of code (such as the lines that are under the "true" part of an "If" condition, as opposed to those under the "Else" part). Please see the "Scripting" section of wiki "Getting started creating mods using GECK" article guides and tools to help make your script troubleshooting more effective.

 

-Dubious-

Edited by dubiousintent
Link to comment
Share on other sites

  • Recently Browsing   0 members

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