Nergui Posted September 15, 2015 Posted September 15, 2015 I was trying to make a swimsuit version of that rebreather you get from the boomers, but my scripting knowledge is roughly zero. Basically, why does this script work, both adding and removing the 'Water Breathing' effect when unequipped. scn 01SwimsuitScript begin OnEquip player player.AddSpell 01SwimsuitWaterBreathing end Begin OnUnequip Player player.RemoveSpell 01SwimsuitWaterBreathing end and this one doesn't scn 01SwimsuitScript int iEquipped begin OnEquip player player.AddSpell 01SwimsuitWaterBreathing set iEquipped to 1 end begin GameMode if iEquipped == 1 && Player.GetEquipped 01Swimsuit == 0 player.RemoveSpell 01SwimsuitWaterBreathing set iEquipped to 0 endif end With the second, the Effect is added, but not removed when unequipping.
Content Consumer Posted September 15, 2015 Posted September 15, 2015 I'm not familiar with Fallout 3, but... The first script has OnEquip and OnUnequip event detection. The second script has OnEquip and GameMode for some reason. Just duplicate the original, I'd say... why the integer flip? It won't cause problems, I think, but why have it at all when you've got the ability to listen for equip and unequip events? But I think your problem is the GameMode event listener. You're never detecting an unequip event, so taking off the swimsuit won't do anything.
astymma Posted September 15, 2015 Posted September 15, 2015 It might be processing the line... if iEquipped == 1 && Player.GetEquipped 01Swimsuit == 0 ..as... if iEquipped == 1 && Player.GetEquipped (01Swimsuit == 0) ...instead of... if iEquipped == 1 && (Player.GetEquipped 01Swimsuit) == 0 ...as you intended. Although, why you'd not use OnUnequip is beyond me... seems a bit strange to mix your methodology.
Nergui Posted September 16, 2015 Author Posted September 16, 2015 Although, why you'd not use OnUnequip is beyond me... seems a bit strange to mix your methodology. As I said, I barely know anything about FNV scripting, but for reference, this is the original rebreather script. scn VMS15RebreatherScript int iEquipped begin OnEquip player player.AddSpell VMS15WaterBreathingActual set iEquipped to 1 end ;begin onUnequip player ; player.RemoveSpell VMS15WaterBreathingActual ;end begin GameMode if iEquipped == 1 && Player.GetEquipped VMS15Rebreather == 0 player.RemoveSpell VMS15WaterBreathingActual set iEquipped to 0 endif end I assumed it would work for another item with a few minor edits.
Content Consumer Posted September 16, 2015 Posted September 16, 2015 Although, why you'd not use OnUnequip is beyond me... seems a bit strange to mix your methodology. As I said, I barely know anything about FNV scripting, but for reference, this is the original rebreather script. I assumed it would work for another item with a few minor edits. That's the original??? Well... huh. If it works in-game, it obviously works, I guess... But still, I would use onUnequip instead. That seems like the more logical way to do it. Just try it out - compile it and see if it works for you. It's not going to melt your computer if it doesn't...
Imperfection Posted September 17, 2015 Posted September 17, 2015 This is from an old post by RickerHK on the nexus forums when the same question was asked about the gamemode block but I would defer to script gurus as to whether this condition is still true and that the gamemode block is just a workaround. Some possible good info in that thread. Why do you have a gamemode script to check every frame if the helmet is equipped? You have an "on unequip" right there but it is commented out. Did you find that the unequip block fails to work? It is never clear to me which things need to be checked every frame and which can be triggered only upon the actual operation. #univax "If for some reason the helmet gets broken, it won't run the unequip block when it unequips."
Content Consumer Posted September 17, 2015 Posted September 17, 2015 This is from an old post by RickerHK on the nexus forums when the same question was asked about the gamemode block but I would defer to script gurus as to whether this condition is still true and that the gamemode block is just a workaround. Some possible good info in that thread. Why do you have a gamemode script to check every frame if the helmet is equipped? You have an "on unequip" right there but it is commented out. Did you find that the unequip block fails to work? It is never clear to me which things need to be checked every frame and which can be triggered only upon the actual operation. #univax "If for some reason the helmet gets broken, it won't run the unequip block when it unequips." Ah. That makes sense. Is there any way to make an item unbreakable? Or even just increase maximum condition to an extremely high number so it virtually won't break?
Nergui Posted September 17, 2015 Author Posted September 17, 2015 This is from an old post by RickerHK on the nexus forums when the same question was asked about the gamemode block but I would defer to script gurus as to whether this condition is still true and that the gamemode block is just a workaround. Some possible good info in that thread. Why do you have a gamemode script to check every frame if the helmet is equipped? You have an "on unequip" right there but it is commented out. Did you find that the unequip block fails to work? It is never clear to me which things need to be checked every frame and which can be triggered only upon the actual operation. #univax "If for some reason the helmet gets broken, it won't run the unequip block when it unequips." Ah. That makes sense. Is there any way to make an item unbreakable? Or even just increase maximum condition to an extremely high number so it virtually won't break? Toggling on the quest item flag will make an item unbreakable. Could I use this script then? scn 01SwimsuitScript begin OnEquip player player.AddSpell 01SwimsuitWaterBreathing SetQuestObject 01Swimsuit 1 end Begin OnUnequip Player player.RemoveSpell 01SwimsuitWaterBreathing SetQuestObject 01Swimsuit 0 end (assuming this is the script command for toggling quest items)
Imperfection Posted September 17, 2015 Posted September 17, 2015 From some of comments in the thread I linked it seamed like you could have the same problem if the item was removed from your inventory by quest script, the effect applied when putting it on would remain, but I have never tested it.
Nergui Posted September 17, 2015 Author Posted September 17, 2015 Which brings me back to my original question, why the second script wont remove the effect after the object is unequipped. Unless I'm just being impatient and should wait a few seconds?
Imperfection Posted September 17, 2015 Posted September 17, 2015 The second script is calling another spell "01SwimsuitWaterBreathing" so would have to be there because the rest is identical. The question is why do you need to create another spell when there is already a working version (VMS15WaterBreathingActual) of the spell built into the game? Go with what works. If your testing by loading save when you already have item equipped or in inventory try dropping on ground first then pick up and retry.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.