Sithrazer Posted July 18, 2014 Share Posted July 18, 2014 (edited) ===EDIT:I've got a hack-y workaround that sorta works, simply removing the item to be repaired and giving the player a new one, but I'd still like to hear if anyone knows why my script below doesn't work.===EDIT 2:The setHealth function does -not- do what I thought it did. I think I've got this figured out now, though. It might not be exactly what I was hoping to accomplish, but should be a lot better than the workaround in my first edit.=== Started playing FO3 again and revisited my repair anvil mod, trying to work out a custom script beyond just calling player.srm. I'm not sure if the functions I'm using just don't do what I think they do or if I'm overlooking something stupid. Anyway, here's the code I have. scn srRepairAnvilScript ref rEqArmor ref rEqWeapon int iTemp begin onActivate if player.getItemCount SpareParts == 0 showmessage srNoScrap else set rEqArmor to player.getEquippedObject 2 set rEqWeapon to player.getEquippedObject 5 set iTemp to rEqArmor.getHealth player.addItem caps001 iTemp ; debug attempt, gives number of caps equal to max health of [armor] rEqArmor.setHealth iTemp set iTemp to rEqWeapon.getHealth player.addItem caps001 iTemp ; debug attempt, gives number of caps equal to max health of [weapon] rEqWeapon.setHealth iTemp player.removeItem SpareParts 1 endif end It's supposed to get the max possible health for the current equipped armor and weapon and set it to those values, and take scrap metal from the player in return. Currently all it does is take scrap metal away, and judging from my debug attempts it's not getting the max possible health for the equipped armor/weapon. It also won't set the health of the equipped items even using hard coded values. I have FOSE installed, it's compiling fine in GECK, and it runs in game, but the get/set health functions just don't seem to be doing anything and I don't understand why. Any help anyone can offer would be greatly appreciated. Edited July 22, 2014 by Sithrazer Link to comment Share on other sites More sharing options...
vforvic Posted July 21, 2014 Share Posted July 21, 2014 Speaking strictly to the code example you have posted and not getting into exactly what you are trying to accomplish overall.When you say: set iTemp to rEqArmor.getHealthThe correct syntax is really: set iTemp to GetHealth rEqArmorSame with the weapon line. It should be: set iTemp to getHealth rEqWeaponI know examples show it the way you have it in your script, but I believe that is only if you are calling it on a specific Reference in the game and not a Reference Variable in a script. Link to comment Share on other sites More sharing options...
Sithrazer Posted July 22, 2014 Author Share Posted July 22, 2014 (edited) Huh. I don't think I've seen that syntax anywhere, but I haven't gone out of my way to read vanilla scripts unless I'm looking to alter one. I'll have to give that a try. Thanks! Edit: Worked as advertised, thanks so much! Edited July 22, 2014 by Sithrazer Link to comment Share on other sites More sharing options...
Recommended Posts