OnDeath script not compiling

Post » Wed Oct 30, 2013 12:01 am

I've written a few of these scripts and all compiled fine - this one won't...

Quest Property MyQuest AutoInt Property StageToSet AutoWeather Property ChangeWeather AutoGlobalVariableProperty DeathCount AutoEvent OnDeath(Actor killer)DeathCount.Mod(1)If DeathCount.GetValue() == 3ChangeWeather.SetActive()MyQuest.Setstage(StageToSet)EndifEndevent

Get these arrors...

(6,34): required (...)+ loop did not match anything at input 'Auto'

(6,38): mismatched input '\\r\\n' expecting STATE

So I studied the default setstageondeath script and tried this...

Quest Property MyQuest AutoInt Property StageToSet AutoWeather Property ChangeWeather AutoGlobalVariableProperty DeathCount AutoAuto state waitingEvent OnDeath(Actor killer)DeathCount.Mod(1)If DeathCount.GetValue() == 3ChangeWeather.SetActive()MyQuest.Setstage(StageToSet)EndifEndeventEndstateSTATE inactiveendSTATE

Got exactly the same errors. What am I doing wrong please?

User avatar
Captian Caveman
 
Posts: 3410
Joined: Thu Sep 20, 2007 5:36 am

Post » Tue Oct 29, 2013 11:20 pm

Event OnDeath(Actor akKiller)

You typed it wrong. Also make sure your script extends Actor or ReferenceAlias.
User avatar
Tania Bunic
 
Posts: 3392
Joined: Sun Jun 18, 2006 9:26 am

Post » Wed Oct 30, 2013 10:03 am

Looks like you need a space to separate GlobalVariable from Property

User avatar
Nathan Barker
 
Posts: 3554
Joined: Sun Jun 10, 2007 5:55 am

Post » Tue Oct 29, 2013 8:55 pm

Parameters in events can have any name you wish, as long as they're the correct amount/order/type. The missing space is the culprit...

The compiler even says that it's on line six. I know I didn't pay attention to the errors at first, but really, they can be informative :P

User avatar
Jessica Colville
 
Posts: 3349
Joined: Wed Oct 18, 2006 6:53 pm

Post » Wed Oct 30, 2013 5:42 am

ARGH! You're right, I'm script blinded.

Just a quick question, what's the difference between Event OnDeath(Actor akKiller) and Event OnDeath(Actor killer)? I've looked at CK's default onDeath scripts and they use the latter.

User avatar
Dan Scott
 
Posts: 3373
Joined: Sun Nov 11, 2007 3:45 am

Post » Wed Oct 30, 2013 5:06 am

Fail, i didn't check the error line :facepalm: lol.
User avatar
elliot mudd
 
Posts: 3426
Joined: Wed May 09, 2007 8:56 am

Post » Wed Oct 30, 2013 12:19 am

There's no difference. You can rename the variables in events/functions to whatever you want - though I guess some would consider it "best practice" to use the defaults in most cases for consistency's sake.

User avatar
Adam Baumgartner
 
Posts: 3344
Joined: Wed May 30, 2007 12:12 pm

Post » Wed Oct 30, 2013 6:41 am

So I could use "Event OnDeath(Actor theSwine)" ?

User avatar
Nicole Elocin
 
Posts: 3390
Joined: Sun Apr 15, 2007 9:12 am

Post » Tue Oct 29, 2013 7:41 pm

Yep.

Edit: Though I suppose I should add for clarity that you can't change the order or type of variables in a function/event - you can just change the names of the variables. Technically what you're doing when you add an event to your script is that you're "extending" the same event in the parent script (the Actor.psc script, in this case).

User avatar
Eddie Howe
 
Posts: 3448
Joined: Sat Jun 30, 2007 6:06 am


Return to V - Skyrim