Jump to content

NPC Script CTD


GreatLucifer

Recommended Posts

Hello people....

 

I'm stuck again :blink:

 

I'm trying to script an npc, so it'll react to weaponry. I've had many versions of the script sofar, all slightly different, but none seem to work.

 

Thing is, it all seems to work fine. And it does.... until the final blow. Whenever the NPC dies, it crashes to desktop, immediately.

 

At first, I had an OnDeath block as well, removed it just to be sure. Didn't help.

Tried to secure the entire script with if GetDead == 0, to make it only run when alive. Didn't work.

Whatever I do, it won't seem to help.... :unsure:

 

The script in question;

 

 

 

begin GameMode
;========================================ANALYSIS===========================================
if Status != 0
	set Alarm to 0
	set Pushed to 0
	set KnockOut to 0
	set KnockBack to 0
	set Self to GetSelf
	if GetIsAlerted == 1
		set Alarm to 1
	endif
	if GetAlarmed == 1
		set Alarm to 1
	endif
	If Alarm == 0
;==========AMBUSHED===========
		if Status == 1
			set KnockBack to 5
			set KnockBackChance to 75
			set KnockOut to 1
			set KnockOutChance to 5
		elseif Status == 2
			set KnockBack to 3
			set KnockBackChance to 40
			set KnockOut to 1
			set KnockOutChance to 60
		endif
	elseif Alarm == 1
;============COMBAT============
		if Status == 1
			set KnockBack to 3
			set KnockBackChance to 20
			set KnockOut to 0
			set KnockOutChance to 0
		elseif Status == 2
			set KnockBack to 1
			set KnockBackChance to 50
			set KnockOut to 1
			set KnockOutChance to 5
		endif
	endif
;========================================EFFECT===========================================
	if KnockBack != 0
		set Rand to GetRandomPercent
		if Rand <= KnockBackChance
			set Rand4 to KnockBackChance
			set Rand4 to Rand4 / 2
			if Rand <= Rand4
				set Rand3 to GetRandomPercent
				set Rand3 to Rand3 / 20
				set KnockBack to KnockBack + Rand3
			endif
			set CombatTarget to GetCombatTarget
			CombatTarget.pushactoraway Self KnockBack
			set Pushed to 1
		endif
	endif
	if Pushed == 0
		If KnockOut != 0
			set Rand2 to GetRandomPercent
			if Rand2 <= KnockOutChance
				set KnockDown to 0
				set Rand3 to GetRandomPercent
				set Rand3 to Rand3 / 10
				set KnockDown to KnockDown - Rand3
				Self.pushactoraway Self KnockDown
			endif
		endif
	endif
	set Status to 0
endif
end

 

 

 

If you could shed some light on my situation, please do.

 

Thanks,

 

 

 

Lucifer

 

 

EDIT;

 

Solved it :)

 

Appearantly, calling GetIsAlerted or GetAlarmed on something dead crashes to desktop.

This is not on the cs.elderscrolls page, but it still definitely appears so...

Edited by GreatLucifer
Link to comment
Share on other sites

  • Recently Browsing   0 members

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