quake2003 Posted August 1, 2023 Share Posted August 1, 2023 hello,i ve a problem with a scrip.i want to try to get an empty fusioncell back if i fire with a laser weapon or an other weapon who used the fusioncell my problem ist that i cant read out witch weapon is equipped an witch ammo is in used Debug.MessageBox(Game.GetPlayer().GetEquippedWeapon().GetAmmo()) it shows me "[ammo"if i ask for the weaponDebug.MessageBox(Game.GetPlayer().GetEquippedWeapon() it shows me "[weapon" my inspiration for this small mod is "loads of ammo" the "breedercell" ... without a scrip you get an empty fusioncell back if you hit an enemy I searched the library but i cant find any other functionf4se is installed so i ve other function available only readout the weapon the ammo or any id of them is still missinghave someone any idea how i can fix it the debug messageboxes ... for find out whats wrong Scriptname NukaColaBottleCapAdderSCRIPT_111 extends activemagiceffect MiscObject Property FusionsCellEmpty auto Ammo Property AmmoFusionCell auto Event OnInit() RegisterForAnimationEvent(game.getplayer(), "WeaponFire") EndEvent Event OnAnimationEvent(ObjectReference akSource, string asEventName) if (asEventName == "weaponfire") Debug.MessageBox("1") if (Game.GetPlayer().GetEquippedWeapon().GetAmmo() == AmmoFusionCell) Debug.MessageBox("2") game.getplayer().AddItem(FusionsCellEmpty, 1) else Debug.MessageBox("3") Debug.MessageBox(Game.GetPlayer().GetEquippedWeapon().GetAmmo()) endif else Debug.MessageBox("4") endIf endEvent Link to comment Share on other sites More sharing options...
RaidersClamoring Posted August 2, 2023 Share Posted August 2, 2023 To get the actual name as a string you need to extend that query to also include .GetName() at the end : Debug.MessageBox(Game.GetPlayer().GetEquippedWeapon().GetAmmo().GetName()) Debug.MessageBox(Game.GetPlayer().GetEquippedWeapon().GetName())Are you not getting a messagebox saying "2" when firing the accurate ammo though? Link to comment Share on other sites More sharing options...
quake2003 Posted August 2, 2023 Author Share Posted August 2, 2023 i get an error "GetName is not a function or does not exist" I kept looking. many people have this problemI'm still searching the forum.I currently see a other solution and am trying itI'm trying to read the "keywords". Debug.MessageBox(Game.GetPlayer().GetEquippedWeapon().HasKeyword(dn_HasReceiver_MoreDamage3)) *for example so I get an answer back "true" or "false" at the moment i always get "false" :D ... i dont know why Link to comment Share on other sites More sharing options...
RaidersClamoring Posted August 3, 2023 Share Posted August 3, 2023 If it says GetName is not a function then your F4SE files might not be in order. The F4SE source script-files should be placed in a location where they can override their respective vanilla script. This isn't, or might not be, done automatically when you install F4SE. Which location this is will come down to what paths to script files you have specified in CK and likewise in whichever code editor you are using. I usually just drag the F4SE .psc-files to the "base" folder and let them overwrite the vanilla scripts.To be clear, it isn't necessary to overwrite the vanilla files, they just need to be overridden. Link to comment Share on other sites More sharing options...
LarannKiar Posted August 5, 2023 Share Posted August 5, 2023 i get an error "GetName is not a function or does not exist" I kept looking. many people have this problemI'm still searching the forum.I currently see a other solution and am trying itI'm trying to read the "keywords". Debug.MessageBox(Game.GetPlayer().GetEquippedWeapon().HasKeyword(dn_HasReceiver_MoreDamage3)) *for exampleso I get an answer back "true" or "false" at the moment i always get "false" :D ... i dont know why Enable Papyrus logging and try this: MiscObject Property FusionsCellEmpty Auto Ammo Property AmmoFusionCell Auto Event OnInit() Debug.OpenUserLog("NukaColaBottleCapAdder") RegisterForAnimationEvent(game.getplayer(), "WeaponFire") Debug.CloseUserLog("NukaColaBottleCapAdder") EndEvent Event OnAnimationEvent(ObjectReference akSource, string asEventName) Debug.TraceUser("NukaColaBottleCapAdder", " [OnAnimationEvent] :: RECEIVED: akSource = [" + akSource + ". DisplayName: " + akSource.GetDisplayName() + "]. asEventName = [" + asEventName + "].") if (asEventName == "weaponfire") Weapon PlayerEquippedWeapon = Game.GetPlayer().GetEquippedWeapon() If PlayerEquippedWeapon Debug.TraceUser("NukaColaBottleCapAdder", " [OnAnimationEvent] :: INFO: player's equipped weapon is [" + PlayerEquippedWeapon + ". Name: " + PlayerEquippedWeapon.GetName() + "].") Else Debug.TraceUser("NukaColaBottleCapAdder", " [OnAnimationEvent] :: ERROR: player's equipped weapon is 'none'. Aborting.") Return None EndIf Ammo PlayerEquippedWeaponAmmo = Game.GetPlayer().GetEquippedWeapon().GetAmmo() If PlayerEquippedWeaponAmmo Debug.TraceUser("NukaColaBottleCapAdder", " [OnAnimationEvent] :: INFO: ammo of player's equipped weapon is [" + PlayerEquippedWeaponAmmo + ". Name: " + PlayerEquippedWeaponAmmo.GetName() + "].") Else Debug.TraceUser("NukaColaBottleCapAdder", " [OnAnimationEvent] :: ERROR: ammo of player's equipped weapon is 'none'. Aborting.") Return None EndIf if PlayerEquippedWeaponAmmo == AmmoFusionCell Debug.TraceUser("NukaColaBottleCapAdder", " [OnAnimationEvent] :: SUCCESS: player equipped ammo = [" + PlayerEquippedWeaponAmmo + ". Name: " + PlayerEquippedWeaponAmmo.GetName() + "] is Fusion Cell. Adding one Fusion Cell to the player.") game.getplayer().AddItem(FusionsCellEmpty, 1) else Debug.TraceUser("NukaColaBottleCapAdder", " [OnAnimationEvent] :: ERROR: player equipped ammo = [" + PlayerEquippedWeaponAmmo + ". Name: " + PlayerEquippedWeaponAmmo.GetName() + "] is not Fusion Cell.") endif else Debug.TraceUser("NukaColaBottleCapAdder", " [OnAnimationEvent] :: ERROR: asEventName = [" + asEventName + "] is not WeaponFire. Doing nothing.") endIf endEvent Link to comment Share on other sites More sharing options...
Fantafaust Posted August 6, 2023 Share Posted August 6, 2023 Your F4SE must be set up wrong, because that compiles for me Link to comment Share on other sites More sharing options...
Recommended Posts