Jump to content

Why can I not save this script?


iRonnie16

Recommended Posts

scn ShadowBreathingEffect

float fTimer
short State
begin Gamemode
label 9
if player.getequipped ShadowBreathingMask
set state to 1
endif
if isPC1stPerson == 0
set state to 0
endif
if player.getequipped ShadowBreathingMask == 0
set state to 0
endif
if state == 1
if player.getav health > player.getbaseav health / 3
if fTimer > 0
set fTimer to fTimer - getSecondsPassed
else
playSound ShadowBreathingEffectSound
set fTimer to 15.5
endif
endif
endif
if state == 1
if player.getav health < player.getbaseav health / 3
set state to 2
endif
endif
if state == 2
if fTimer > 0
set fTimer to fTimer - getSecondsPassed
else
playsound ShadowBreathingEffectCombatSound01
set fTimer to 19.5
else goto 9
endif
endif
end
Link to comment
Share on other sites

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 by Ladez
Link to comment
Share on other sites

 

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

EndIf

End

 

SCN FilterEquip

 

 

begin OnEquip player

if player.getequipped ShadowBreathingMask ==1

playSound FilterEquipSound 1

endif

end

 

These ones save but just don't work

Edited by iRonnie16
Link to comment
Share on other sites

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

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

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

Alright I have this script attached to the mask

SCN AvonSF10Equip

begin OnEquip player
if player.GetEquipped 01S10 ==1
player.EquipItem ShadowBreathingMask
EndIf
End

And this one attached to the breathing ( to which when equpped will play a sound for attaching a filter to the mask)


SCN FilterEquip

begin OnEquip player
if player.GetEquipped ShadowBreathingMask ==1
playSound FilterEquipSound
EndIf
End

yet 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

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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...