Jump to content

Help with GetFirstRef


troyquay

Recommended Posts

Hello

I have a problem with my script.

When I activate the thermal vision, the actor will be painted immediately.

But when I deactivate it, it will take longer before the effect shader will be removed.

This is my script:

scn aaaThermalVisionMainScript

short PlayerEquipped
short EffectNum
short depth
short modeChanged
float timer
float timePassed

ref NPCref
short isButtonNextPressed

Begin OnEquip player
set PlayerEquipped to 1
set EffectNum to 0
set timer to 9999
player.AddSpell VMS15WaterBreathingActual
End

Begin OnUnequip player
set PlayerEquipped to 0
set EffectNum to 0
set timer to 9999
PlaySound UIPipBoyLightOff
player.riMod ThermalVisionIsMod
player.sms BodyHeatEffectShader
player.sms BodyHeatEffectShader2
player.RemoveSpell VMS15WaterBreathingActual
End



Begin GameMode
set timePassed to GetSecondsPassed
set timer to timer + timePassed
set modeChanged to 0

if PlayerEquipped
	if IsKeyPressed 45
		if isButtonNextPressed
		else
			PlaySound UIPipBoySelect
			set EffectNum to EffectNum + 1
			if EffectNum > 1
				set EffectNum to 0
			endif
			set modeChanged to 1
		endif
		set isButtonNextPressed to 1
	else
		set isButtonNextPressed to 0
	endif

	if modeChanged == 1
		set timer to 9999

		if EffectNum == 0
			player.riMod ThermalVisionIsMod
			player.sms BodyHeatEffectShader
			player.sms BodyHeatEffectShader2
		elseif EffectNum == 1
			player.iMod ThermalVisionIsMod
			player.pms BodyHeatEffectShader
			player.pms BodyHeatEffectShader2
		endif
	endif
endif

if (timer >= 1)
	set timer to 0

	if PlayerEquipped == 1 && EffectNum == 1
		player.sms BodyHeatEffectShader
		player.pms BodyHeatEffectShader
	endif

	set depth to 2 * (player.IsInInterior ==0)
	set NPCref to GetFirstRef 200 depth 0
	Label 1

	if NPCref != 0 && isFormValid NPCref == 1
		NPCref.sms FriendlyEffectShader
		NPCref.sms BodyHeatEffectShader
		NPCref.sms BodyHeatEffectShader2
		if PlayerEquipped == 1 && EffectNum == 1
			if NPCref.GetDisabled == 1 || NPCref.GetDead == 1
				NPCref.pms FriendlyEffectShader
			else
				NPCref.pms BodyHeatEffectShader
				NPCref.pms BodyHeatEffectShader2
			endif
		endif
		set NPCref to Pencil01
		set NPCref to GetNextRef ;Get the ref of the next NPC
		Goto 1    ;Loop continues as long as NPCref exists
	endif

EndIf
End

Link to comment
Share on other sites

I read somewhere that I should be using token instead of pms/sms, but I don't know how to do it.

Can someone shed me some light? or point me into the right direction.

thanks

 

That makes no sense, as this is already an object script. Also, good luck applying visual shaders without the command that applies visual shaders.

 

I'd like to see what you read.

Link to comment
Share on other sites

I read somewhere that I should be using token instead of pms/sms, but I don't know how to do it.

Can someone shed me some light? or point me into the right direction.

thanks

 

That makes no sense, as this is already an object script. Also, good luck applying visual shaders without the command that applies visual shaders.

 

I'd like to see what you read.

 

The visual/effect shader is working. the only problem is when I remove it, it will take some time before it's gone.

But I want it to be removed immediately.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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