Script Help. OnDeath else condition

Post » Tue Apr 22, 2014 10:08 am

I don't know where I'm going wrong makes sense to me and compiles. Basically its an OnDeath script which counts deaths and mods a global. The else is for any of the actors dying before "time" which should fail the quest. Take a look.

GlobalVariable property Deaths AutoQuest Property myquest AutoInt Property PreReqStage AutoInt Property StageToSet AutoInt Property ReqDeathCount AutoEvent OnDeath(Actor akkiller)  if myQuest.GetStage() == PreReqStage            Deaths.Mod(1) as intdebug.notification("Somebody died")if Deaths.GetValue() == ReqDeathCountmyQuest.SetStage(StageToSet)else  if myQuest.GetStage() < PreReqStage   myQuest.SetStage(500); fail quest         endif  endifendifEndEvent

Thanks for looking.

User avatar
pinar
 
Posts: 3453
Joined: Thu Apr 19, 2007 1:35 pm

Post » Mon Apr 21, 2014 8:08 pm

Your two tests on GetStage are nested. If the outer one is true, then the inner one can never be true. It looks like one of your endif's is in the wrong place, and should be before the else.
User avatar
Ray
 
Posts: 3472
Joined: Tue Aug 07, 2007 10:17 am

Post » Mon Apr 21, 2014 9:11 pm

Something else I just noticed, the global isn't incrementing. I'm guessing this is down to not specifying the killer. This is impossible as I have a full blown riot going on with 20+ NPCs. How can I sort this?

BTW: You were right about the "endif" thanks.

User avatar
CxvIII
 
Posts: 3329
Joined: Wed Sep 06, 2006 10:35 pm

Post » Tue Apr 22, 2014 9:09 am

Based on the current script, the script will trigger and increment the global variable when the actor dies as long as

myQuest.GetStage() == PreReqStage

Of course, keep in mind that this script has to be attached to each individual actor. If it's not, that would be the problem.

(original posted script with clearer indentation) -->

Spoiler
Event OnDeath(Actor akkiller)    if myQuest.GetStage() == PreReqStage           Deaths.Mod(1) as int        debug.notification("Somebody died")        if Deaths.GetValue() == ReqDeathCount            myQuest.SetStage(StageToSet)        else            if myQuest.GetStage() < PreReqStage                   myQuest.SetStage(500); fail quest            endif        endif    endifEndEvent
User avatar
Tanika O'Connell
 
Posts: 3412
Joined: Fri Jan 26, 2007 1:34 am

Post » Tue Apr 22, 2014 3:50 am

I've attached it to 8 actors who have to die but you may have something with the stage. I may have increased it...somewhere along the line. I'll check on it, thanks.

EDIT: We were correct, I advanced it without thinking. Thanks again.

User avatar
Natasha Callaghan
 
Posts: 3523
Joined: Sat Dec 09, 2006 7:44 pm


Return to V - Skyrim