rlavlfwo0911 Posted May 10, 2019 Share Posted May 10, 2019 I want to add water breathing effect to about 20 helmets.So that I need to write 20 identical scripts like this. scn script int iEquipped begin OnEquip playerplayer.AddSpell VMS15WaterBreathingActualset iEquipped to 1end begin GameModeif iEquipped == 1 && Player.GetEquipped helmet == 0player.RemoveSpell VMS15WaterBreathingActualset iEquipped to 0endifend But as far as I know Gamemode block is executed every frame and has a chance to affect gaming performance.Can this scripts significantly affect performance? Link to comment Share on other sites More sharing options...
KiCHo666 Posted May 10, 2019 Share Posted May 10, 2019 You don't need to add a script that checks if helmet is equipped every frame in order to apply water breathing. You just need to add Object Effect (water breathing) to the item and water breathing ability will be added to the wearer.Look for "Rebreather" item, the one you get from those Boomer people. It has water breathing effect already applied. Just pick the water breathing effect from the object effect drop down menu for your helmets. Link to comment Share on other sites More sharing options...
rlavlfwo0911 Posted May 10, 2019 Author Share Posted May 10, 2019 You don't need to add a script that checks if helmet is equipped every frame in order to apply water breathing. You just need to add Object Effect (water breathing) to the item and water breathing ability will be added to the wearer.Look for "Rebreather" item, the one you get from those Boomer people. It has water breathing effect already applied. Just pick the water breathing effect from the object effect drop down menu for your helmets.Water breathing effect works properly when in actor effect category.This is the reason rebreather in new vegas also use the same script to add water breathing effect. Link to comment Share on other sites More sharing options...
dubiousintent Posted May 10, 2019 Share Posted May 10, 2019 If you split the compound conditional "if iEquipped == 1 && Player.GetEquipped helmet == 0" into two separate lines: if iEquipped == 1 If Player.GetEquipped helmet == 0 you will get better efficiency and it should have no impact at all in GameMode. A compound statement always has to evaluate both conditions first before it can determine if the statement should be executed, whereas you don't need to check for the helmet if "iEquipped" is not true. And a simple variable check is quite efficient, whereas "GetEquipped" has a bit more of processing overhead. -Dubious- Link to comment Share on other sites More sharing options...
Mktavish Posted May 10, 2019 Share Posted May 10, 2019 This is just to expound on the idea of stop gate code reading.But if you need a gamemode block to continually run for say a few seconds , so as to calculate a complicated scenario. You can attach it to a quest which you can turn on , then off.Also if need long time game mode checks ... a quest has the ability to slow the code read checks down. Even a .5 process delay becomes a lot less cumbersome than the standard frame rate checks at 40-60 times a second. BUT !!! and that is a big but ... you need to keep in mind if the whole of th code path has been put in slow mode. And how that effects your outcome.Hence you may need some "OnActivate" scripts ready to fire at key times in the Quest's "GameMode" block. Which is done by dropping in an activator reference , and having the quest use ... MyActivatorRef.Activate ... when it is applicable.Not totally sure if you could just make a dummy cell of activators for this ... or the activator ref need be in the same cell/loaded ... as the player ??? On a side note I found .... you can adjust the clock tick of air , or reset it. Link to comment Share on other sites More sharing options...
Recommended Posts