How can I stop creatures wandering aimlessly (and more)?

Post » Tue Nov 04, 2014 2:54 am

So I'm trying to script a boss fight, and I'm encountering two main issues:

1. After the script uses PositionCell commands, the boss (whose Wander is initially set to 0 ) begins wandering aimlessly. This happens even when I add AIWander 0 0 0 to the script. When I use TCL and watch where the boss walks, it generally seems to be trying to get back to its original spot (where I placed it in the editor).

2. I add and remove various spells from the boss throughout the course of the fight, but for some reason the last spell swap doesn't work, i.e. "removespell X" "AddSpell Y" and yet for some reason the boss keeps using spell X. This is especially bizarre because the exact same procedure works perfectly earlier in the script.

Here is the script (and my explanation of it is below):

Begin NON_Sonneilon2short spellstatshort warpstatfloat timerif ( menumode == 1 )	returnendifif ( NON_SonneilonFight == 2 )        ; BEAT HIM UP A BIT AND HE'LL WARP AWAY	if ( GetHealth < 2000 )       ; THIS IS WHERE THE PROBLEMS START - THE BOSS IS WARPED TO		StopCombat            ; A COLLISION WALL ABOVE THE BATTLEGROUND BUT FOR SOME REASON WILL START		Setfight 10           ; WANDERING AIMLESSLY		PlaySound "conjuration area"		PlaceAtMe "NON_WarpEffect" 1 1 1		PositionCell 379 2369 1010 135 "Gor-Goroth"		NON_SonneilonDaedroth1->Enable		NON_SonneilonDaedroth2->Enable		NON_SonneilonDaedroth3->Enable		NON_SonneilonDaedroth4->Enable		RemoveSpell "NON_SonneilonSp1"		AddSpell "NON_SonneilonSp2"          ; NOTE: THESE ADDSPELL COMMANDS WORK FINE		AddSpell "her_tamed_lightning"		SetHealth 2000		SetMagicka 3000		SetFatigue 3000		AIWander 0 0 0		StartScript NON_SonneilonMinionkill		set NON_SonneilonFight to 3		return	endifendifif ( NON_SonneilonFight == 3 )        ; IGNORE THIS, IT WORKS FINE	if ( spellstat == 0 )		set timer to ( timer + getsecondspassed )		if ( timer > 6 )			set timer to 0			set spellstat to 2		else			return		endif	elseif ( spellstat == 2 )		cast "NON_SonneilonSp2" player		set spellstat to 3	elseif ( spellstat == 3 )		if ( GetEffect sEffectResistParalysis == 1 )			set spellstat to 4		endif	elseif ( spellstat == 4 )		if ( Random100 < 50 )			PlaceAtPC "NON_SonneilonExploder1" 1 100 0			set spellstat to 0		else			PlaceAtPC "NON_SonneilonExploder2" 1 100 0			set spellstat to 0		endif	endifendifif ( NON_SonneilonFight == 4 )	if ( warpstat == 0 )		PlaySound "conjuration area"		PlaceAtMe "NON_WarpEffect" 1 1 1		PositionCell -695 920 1111 90 "Gor-Goroth"    ; MORE WANDERING OBSERVED		AIWander 0 0 0		NON_SonneilonForcefield1->Disable		NON_SonneilonThug1->Enable		NON_SonneilonThug2->Enable		NON_SonneilonThug3->Enable		NON_SonneilonThug4->Enable		NON_SonneilonThug5->Enable		NON_SonneilonDaedroth5->Enable		MessageBox "Sonneilon: Will you fall before my minions? Or will you have the honour of dying at my hands?"		set warpstat to 1	else		return	endifendifif ( NON_SonneilonFight == 5 )	PositionCell -1699 184 1076 45 "Gor-Goroth"	RemoveSpell "her_tamed_lightning"	RemoveSpell "NON_SonneilonSp2"     ; THESE REMOVESPELL COMMANDS WORK FINE...	AddSpell "NON_SonneilonSp3"        ; AS DOES THIS ADDSPELL	AIWander 0 0 0	SetMagicka 120	SetFight 100	set warpstat to 2	set NON_SonneilonFight to 6endifif ( NON_SonneilonFight == 6 )	if ( GetHealth < 1000 )		PlaySound "conjuration area"		PlaceAtMe "NON_WarpEffect" 1 1 1		PositionCell 971 1534 91 270 "Gor-Goroth"		AIWander 0 0 0		SetHealth 1000		SetMagicka 1000		AddSpell "NON_SonneilonSp5"          ; THESE SPELLS ARE NOT ADDED		AddSpell "NON_SonneilonSp4"		RemoveSpell "NON_SonneilonSp3"       ; THIS SPELL IS NOT REMOVED		MessageBox "Sonneilon: blah blah blah taunt."		set NON_SonneilonFight to 7	else		return	endifendifif ( OnDeath == 1 )	Set NON_SonneilonFight to 8	NON_SonneilonForcefield3->Disableendifif ( onactivate == 1 )	if ( GetHealth > 0 )		return	else		activate	endifendifend

The script is attached to the boss. You can ignore most of it, because most of it works. I've commented on the relevant parts.

I know that the script isn't getting stuck on separate sections, because it's possible to play through right up to the end, all the warps and messageboxes work fine etc.

But as I commented, the boss starts 'wandering around' aimlessly trying to get back to its home spot. This isn't actually a major problem, but it ruins the effect of having the boss hovering over the battlefield casting explosions at the player etc, so I'd like to stop it somehow.

And the Add/Removespell issues, I have no idea. I'm able to swap spells easily with no dramas early in the script, but it just doesn't work later on.

I know it's all a mess, but any help would be greatly appreciated!

User avatar
Jhenna lee Lizama
 
Posts: 3344
Joined: Wed Jun 06, 2007 5:39 am

Post » Tue Nov 04, 2014 5:08 am

I'd try
AIWander 0 0 0 0
before each PositionCell

and
RemoveSpellEffects
after each
RemoveSpell
User avatar
phil walsh
 
Posts: 3317
Joined: Wed May 16, 2007 8:46 pm


Return to III - Morrowind