iRonnie16 Posted August 25, 2014 Share Posted August 25, 2014 scn ShadowBreathingEffectfloat fTimershort State begin Gamemodelabel 9if player.getequipped ShadowBreathingMaskset state to 1endif if isPC1stPerson == 0set state to 0endif if player.getequipped ShadowBreathingMask == 0set state to 0endif if state == 1if player.getav health > player.getbaseav health / 3if fTimer > 0set fTimer to fTimer - getSecondsPassedelseplaySound ShadowBreathingEffectSoundset fTimer to 15.5endifendifendif if state == 1if player.getav health < player.getbaseav health / 3 set state to 2endifendif if state == 2if fTimer > 0set fTimer to fTimer - getSecondsPassedelseplaysound ShadowBreathingEffectCombatSound01 set fTimer to 19.5else goto 9endif endif end Link to comment Share on other sites More sharing options...
Ladez Posted August 25, 2014 Share Posted August 25, 2014 (edited) There's two options: 1: You're referencing some editor ID that doesn't exist. Check that you're using the correct ID's for the armor and sounds you're referencing. 2: Label and Goto are NVSE functions and you haven't set up the GECK to use NVSE functions. From the NVSE website: Scripts written with these new commands must be created via the G.E.C.K. after it is launched via nvse_loader. Open a command prompt window, navigate to your NV install direcory, and type "nvse_loader -editor". Alternately you can create a shortcut to nvse_loader.exe, open the properties window and add "-editor" to the Target field. The normal editor can open plugins with these extended scripts, but it cannot recompile them and will give errors if you try. But I wonder why you used label/goto at all. Since this is running in a gamemode block the script will run every frame in-game, so you're jumping back to your label for no reason. What's more, goto is placed in an else statement that will never get executed because there's another else statement right before it. If you remove the label and goto you don't need NVSE. Also, another time use code tags around your code and use indentation so it's presentable. Edited August 25, 2014 by Ladez Link to comment Share on other sites More sharing options...
iRonnie16 Posted August 25, 2014 Author Share Posted August 25, 2014 (edited) 2: Label and Goto are NVSE functions and you haven't set up the GECK to use NVSE functions. From the NVSE website: The GoTo was the problem have it working now, thanks. would you have any idea why these wouldn't work? I'm trying to script it so when I equip a gas mask it also equips the item I use for the gas mask breathing effect and then furthermore to playSound EquipFilter when that script completes SCN AvonSF10Equip begin Gamemode if player.GetEquipped 01S10 ==1 EquipItem ShadowBreathingMask Else EquipItem 01S10 EndIfEnd SCN FilterEquip begin OnEquip player if player.getequipped ShadowBreathingMask ==1 playSound FilterEquipSound 1 endifend These ones save but just don't work Edited August 25, 2014 by iRonnie16 Link to comment Share on other sites More sharing options...
Ladez Posted August 25, 2014 Share Posted August 25, 2014 I see some problems with the first script (I assume this one is attached to the object called 01S10?) First off, EquipItem needs to be called on the player, otherwise it'll do nothing (unless the script is attached to the player.) Also, since the GameMode block will run every frame, whenever 01S10 is not equipped it will be equipped, resulting in you never being able to take if off! Use an OnEquip block instead like you do with the second script: begin OnEquip Player Player.EquipItem ShadowBreathingMask End The second script (which I assume is attached to the object called ShadowBreathingMask) looks fine, although the GetEquipped call is redundant since it'll only ever run when the player equips the item in question. I've removed it in this revised version: begin OnEquip Player PlaySound FilterEquipSound 1 End Link to comment Share on other sites More sharing options...
iRonnie16 Posted August 25, 2014 Author Share Posted August 25, 2014 I'm a bit confused, could you write your version of each? The first one needs to equip ShadowBreathingMask when 01S10 is equipped and the second has to play the sound FilterEquip when ShadowBreathingMask is auto equipped. With your first edit you don't seem to be telling the script to do anything and in the second you don't seem to define when to play the sound. Link to comment Share on other sites More sharing options...
Ladez Posted August 25, 2014 Share Posted August 25, 2014 Both scripts does exactly what you want. The first script makes the player automatically equip ShadowBreathingMask when 01S10 is equipped. The OnEquip block runs once when the object to which the script is attached is equipped, so you just need to attach the script to 01S10. The second script defines exactly when to play the sound; when ShadowBreathingMask is equipped. Because the script will be attached to ShadowBreathingMask, you don't need any further checks, the OnEquip block is sufficient. Link to comment Share on other sites More sharing options...
iRonnie16 Posted August 25, 2014 Author Share Posted August 25, 2014 Alright I have this script attached to the maskSCN AvonSF10Equipbegin OnEquip player if player.GetEquipped 01S10 ==1 player.EquipItem ShadowBreathingMask EndIfEndAnd this one attached to the breathing ( to which when equpped will play a sound for attaching a filter to the mask)SCN FilterEquipbegin OnEquip player if player.GetEquipped ShadowBreathingMask ==1 playSound FilterEquipSound EndIfEndyet only the playSound one works, which I'm thankful for by the way, better one than neither. If you have any idea why the first one won't work I'd appreciate it Link to comment Share on other sites More sharing options...
Ladez Posted August 25, 2014 Share Posted August 25, 2014 Do you have both items in your inventory? EquipItem only equips an item if it is found in your inventory, otherwise you'll have to add it. Link to comment Share on other sites More sharing options...
iRonnie16 Posted August 25, 2014 Author Share Posted August 25, 2014 I have both, I even equipped the filter manually from my inventory and it played the sound, it also plays the breathing sound. the only part of the mod not working is the filter/breathing being equipped when I equip the mask Link to comment Share on other sites More sharing options...
jazzisparis Posted August 25, 2014 Share Posted August 25, 2014 The OnEquip block type will not fire if the scripted object was equipped via calling EquipItem.Seeing as the sound is supposed to play immediately upon equipping the gas mask (and filter), you really only need the script that is attached to the gas mask. scn AvonSF10Equip begin OnEquip player if player.GetItemCount ShadowBreathingMask player.EquipItem ShadowBreathingMask PlaySound FilterEquipSound endif end Link to comment Share on other sites More sharing options...
Recommended Posts