vforvic Posted December 11, 2012 Share Posted December 11, 2012 New to scripting with FOSE and can't get this script to work. This is a simple test script for a larger script. I am trying to get the ammo type of the weapon the Player is carrying when the object is activated. I thought I could just use GetEquipedObject 5 to get the Weapon and then use GetWeaponAmmo on the returned ref to get the ammotype, but FinishMessage never shows so I can only imagine that it is not completing because it is either not getting the ammotype or I am using the wrong code for MicrofusionCell 00004485 or who knows why. Scriptname WeaponTest ref curRef int type int ammotype int Active begin Onactivate if active == 0 set Active to 1 Endif End Begin Gamemode if Active == 1 Set curRef to player.GetEquippedObject 5 Set ammotype to curRef.GetWeaponAmmo if ammotype == 00004485 ;MicroFusionCell ShowMessage FinishMessage Set Active to 0 Endif Endif End Link to comment Share on other sites More sharing options...
rickerhk Posted December 12, 2012 Share Posted December 12, 2012 Ammotype needs to be a REF variable since GetWeaponAmmo is returning a form.You should be able to just doset Ammotype to player.GetWeaponAmmoYou may run into problems with the script compiler here and there if you have a habit of using form IDs instead of just using the EditorID of objects.When the script is compiled, if ammotype == AmmoMicroFusionCellAmmoMicroFusionCell is converted to 00004485 for you. Edit:If you want to use GetWeaponAmmo on the weapon itself, then you call the function in base form format: set Ammotype to GetWeaponAmmo curRef Link to comment Share on other sites More sharing options...
vforvic Posted December 13, 2012 Author Share Posted December 13, 2012 Much thanks and a Kudo to you. This got me going in the right direction again. I might actually get this whole thing working in spite of my pathetic scripting skills. :) Link to comment Share on other sites More sharing options...
Recommended Posts