Gribbleshnibit8 Posted August 16, 2010 Share Posted August 16, 2010 I'm trying to make a script that will walk the player's inventory, checking each item to see if it's a weapon. If it is a weapon, it should then check if the weapon is of a certain type (a gun), and then get the weapon's ammo and other various info before performing other functions on the acquired data. Here's my script so far (minus the initial check for a gun weapon):set index to 0 label 10 set item to player.getInventoryObject index printc "%n" item if (item) if (GetType item == 40) printc "Getting weapon info" set ammoType to item.GetWeaponAmmo printc "%n uses %n ammo" item, ammotype set weapType to item.GetWeaponType printc "%n is a weapon of type %.0f" item, weapType set clipSize to item.GetWeaponClipRounds printc "%n has a clip size of %.0f" item, clipSize set ammoUse to item.GetWeaponAmmoUse printc "%n uses %.0f rounds per shot" item, ammoUse set clipUse to (clipSize / ammoUse) ;calculates how many shots can be made with one clip printc "%n gets %.0f shots per clip" item, clipUse printc "Weapon info obtained"In theory, it seems it should all work (I'm working off the rather horribly documented FOSE function descriptions for my usage). And for the first bit, it works. All the lines print out the name of the first weapon. The issue that I'm getting is that none of the functions from getWeaponAmmo down work (it returns <No Name> and the others just return 0. Which gets me to my next problem. Since all the values are zero, the line:set clipUse to (clipSize / ammoUse) ;calculates how many shots can be made with one clipcauses a divide by zero issue and makes the object lock up (Strange the game can survive a divide by zero error, but crashes when you do an integral action like save). I did try doing an equip on the weapon I wanted to check, but it wound up equipping a laser pistol and checking a shotgun. So I'm not sure what got messed up with that. Anyway, that's my issue. Link to comment Share on other sites More sharing options...
Recommended Posts