Scripting Help Needed (Enabling problem)

Post » Thu Jun 21, 2012 3:45 pm

I have a problem with a mod that I'm producing that is WiP. I'm planning on adding a boss that requires you to kill 4 phases of it. All 4 phases of the boss will take place in the exact same area, with each being a separate, individual monster. What I can't figure out is how to make each boss appear separately after the one before it dies. I've tried using the "Enable Parent" tab, but that merely enables Form 1 and Form 3 simultaneously, and once form 1 is killed it enables Form 2 and Form 4. After a long day of messing around with enabling and disabling markers in a long and ridiculous chain I opted that scripting would be the better option...

Now I am a novice scripter at best. I do have a basic grasp of what needs to be done, but I am by no means experienced in the scripting field. This may wind up being a really simple problem (and I hope it is), but one thing's for sure. I need help.

My current script is as follows:

Scriptname BlackreachBossSpawnScript extends ObjectReference
{Function Enable (bool abFadeIn = False) native
ObjectReference Property MQBlackreachBoss1 Auto
ObjectReference Property MQBlackreachBoss2 Auto
ObjectReference Property MQBlackreachBoss3 Auto
ObjectReference Property MQBlackreachBoss4 Auto
 
Event OnDeath (Actor akKiller, form akWeapon, projectile akProjectile) (Actor MQBlackReachBoss1)
if (akKiller == Game.GetPlayer())
MQBlackReachBoss2.Enable()
endif
EndEvent
Event OnDeath (Actor akKiller, form akWeapon, projectile akProjectile) (Actor MQBlackReachBoss2)
if (akKiller == Game.GetPlayer())
MQBlackReachBoss3.Enable()
endif
EndEvent
Event OnDeath (Actor akKiller, form akWeapon, projectile akProjectile) (Actor MQBlackReachBoss3)
if (akKiller == Game.GetPlayer())
MQBlackReachBoss4.Enable()
endif
EndEvent}


Every time I've saved and compiled it there are no errors from the compiler, which would lead me to assume the script is fine, but not taking effect in-game. I have the first boss enabled by default, and the other 3 are tagged to be disabled. I kill the first form, and nothing happens. No other forms spawn, so I'm not sure what I'm missing. By the way, each individual monster has the script attached, and the References are all tagged properties, so I have no clue what's wrong...

Help would be much appreciated!

If my post is in the wrong forum, please tell me how to move it to the right one!
User avatar
IM NOT EASY
 
Posts: 3419
Joined: Mon Aug 13, 2007 10:48 pm

Post » Thu Jun 21, 2012 2:27 pm

The reason your script compiles is that it is all commented out, as a result of the curly braces at the beginning (before Function) and end. Take those out, and try to compile, and you will see a lot of errors.

OnDeath is an event that occurs to actors, not objects; it takes one parameter (Actor akKiller), and each actor can have one OnDeath event. Something like:
Scriptname BlackreachBossSpawnScript extends ActorActor Property BossToSpawn AutoEvent OnDeath (Actor akKiller)  if (akKiller == Game.GetPlayer())	BossToSpawn.Enable()  endifendEvent

Then you would give this script to each of the bosses and set their BossToSpawn properties appropriately.

But it would probably be better to use the defaultEnableLinkedRefOnDeath script and give your first three bosses the appropriate linked refs.
User avatar
Elena Alina
 
Posts: 3415
Joined: Sun Apr 01, 2007 7:24 am

Post » Thu Jun 21, 2012 4:56 pm

THANK YOU! It works, thank you so much!
User avatar
maddison
 
Posts: 3498
Joined: Sat Mar 10, 2007 9:22 pm

Post » Thu Jun 21, 2012 7:16 pm

Yes, thank you both, this will come in handy! Someone needs to put this on the wiki tutorial section.
User avatar
Kill Bill
 
Posts: 3355
Joined: Wed Aug 30, 2006 2:22 am

Post » Thu Jun 21, 2012 10:15 am

Good catch, Ihttp://www.gamesas.com/user/791516-ingenue/; I didn't even spot those on my first scan of the post ;o)
If post had been with spoiler and code tags I might have looked more closely...
User avatar
Penny Courture
 
Posts: 3438
Joined: Sat Dec 23, 2006 11:59 pm

Post » Thu Jun 21, 2012 5:30 am

Minty911 - how do you flag a spoiler in here? Don't know how to do that, but would like to...
User avatar
Maddy Paul
 
Posts: 3430
Joined: Wed Feb 14, 2007 4:20 pm

Post » Thu Jun 21, 2012 7:07 pm

[ spoiler ]

[ code ]

...scripting code...

[ / code ]

[ / spoiler ]

The above will preserve your indentations of you script code and put it in a spoiler box. Type the code and spoiler "pieces" without spaces.
User avatar
Tessa Mullins
 
Posts: 3354
Joined: Mon Oct 22, 2007 5:17 am

Post » Thu Jun 21, 2012 9:43 am

Thanks aellis, actually just found the BB Code thread tonight. Thank you all for your help! :)
User avatar
Nikki Morse
 
Posts: 3494
Joined: Fri Aug 25, 2006 12:08 pm


Return to V - Skyrim