DABoethaScript needs error-check

Post » Wed Apr 13, 2011 11:22 pm

Hi,

I need someone to error-check this script for me, so if you could help me? Thanks!


(Darn, I partially screwed-up the title of this topic, the correct title should be DABoethiaStatueScript needs error-check)

ScriptName DABoethiaStatueScript

short BoethiaSpeech
short button
short messageOn
float timer
short doorVAR

;This section will control what happens when the player activates the statue

Begin OnActivate

if isActionRef player == 1

if ( GetStage DABoethia < 20 ) && ( Player.GetLevel >= 20 )
if ( player.getitemcount DaedraHeart == 0 )
MessageBox "You do not have the proper offering Boethia requires."
elseif ( player.getitemcount DaedraHeart > 0 )
MessageBox "Do you wish to offer Daedra Heart to the altar of Boethia?" "Yes" "No"
set messageOn to 1
endif
elseif ( GetStage DABoethia == 30 ) && ( Player.GetLevel >= 20 )
set BoethiaSpeech to 6
elseif ( Player.GetLevel < 20 )
MessageBox "Boethia demands a more powerful champion to begin this quest."

endif

endif

if ( GetStage DABoethia == 100 ) && ( player.getitemcount DaedraHeart == 0 )
MessageBox "You do not have the 5 Daedric Hearts Boethia requires."
elseif ( GetStage DABoethia == 100 ) && ( player.getitemcount DaedraHeart > 5 )
MessageBox "Champion! Do you wish to be tested again?" "Yes" "No"
set messageOn to 1

endif

endif


End

;This section will control the audio files played when the statue is activated

Begin GameMode

if ( messageOn == 1 )

set button to GetButtonPressed

if ( button >= 0 )
set messageOn to 0
endif

if ( button == 0 ) && ( BoethiaSpeech == 0 )
Player.RemoveItem DaedraHeart 1
;MessageBox "Your offering is accepted."
set button to 0
set BoethiaSpeech to 1
else
set button to 0
endif

if ( messageOn == 1 ) && ( GetStage DABoethia == 100 )
Set button to GetButtonPressed
if ( button >= 0 )
set messageOn to 0
endif

if ( button == 0 )
Player.RemoveItem DaedraHeart 5
;MessageBox "Your offering is accepted."
set DABoethia.doorVAR to 1
player.MoveToMarker DABoethiaMoveMarkerREF
elseif ( button == 1 )
set button to 0
endif


set timer to ( timer - GetSecondsPassed )

if ( timer <= 0 )
if ( GetStage DABoethia <= 10 )
if ( BoethiaSpeech == 1 )
;PLAY AUDIO
DisablePlayerControls
set timer to DABoethiaShrineRef.say DABoethiaSpeech 1 DABoethiaVoice 1
set BoethiaSpeech to 2
elseif ( BoethiaSpeech == 2 )
;PLAY AUDIO2
set timer to DABoethiaShrineRef.say DABoethiaSpeech 1 DABoethiaVoice 1
set BoethiaSpeech to 3
elseif ( BoethiaSpeech == 3 )
;PLAY AUDIO3
set timer to DABoethiaShrineRef.say DABoethiaSpeech 1 DABoethiaVoice 1
set BoethiaSpeech to 4
elseif ( BoethiaSpeech == 4 )
;PLAY AUDIO4
set timer to DABoethiaShrineRef.say DABoethiaSpeech 1 DABoethiaVoice 1
set BoethiaSpeech to 5
elseif ( BoethiaSpeech == 5 )
SetStage DABoethia 20
EnablePlayerControls
DABoethiaPortalRef.enable
Set DABoethia.warriorvar to 1
endif
elseif ( GetStage DABoethia == 30 )
if ( BoethiaSpeech == 6 )
;PLAY AUDIO5
DisablePlayerControls
set timer to DABoethiaShrineRef.say DABoethiaSpeech 1 DABoethiaVoice 1
set BoethiaSpeech to 7
elseif ( BoethiaSpeech == 7 )
;PLAY AUDIO6
set timer to DABoethiaShrineRef.say DABoethiaSpeech 1 DABoethiaVoice 1
set BoethiaSpeech to 8
elseif ( BoethiaSpeech == 8 )
EnablePlayerControls
SetStage DABoethia 100
Player.AddItem DAGoldBrand 1
ModPCFame 1
endif
endif
endif

End


Maybe two or more (of the added) lines could be merged into one to make this script more efficient, but I don't know how :)
User avatar
Miguel
 
Posts: 3364
Joined: Sat Jul 14, 2007 9:32 am

Post » Thu Apr 14, 2011 4:32 am

An alternative approach that I've used, and may turn out simpler for you, is to replace a Daedric shrine statue with a clone when the quest needs it, and swap back afterward using enable/disable on each. The replacement statue has its own script so you don't have the complications of trying to get it to work for both quests. One big advantage is that no other mod can mess with the script on your version of the statue and break things, and you're not changing the script on the vanilla one, so you can't break that.
User avatar
Ann Church
 
Posts: 3450
Joined: Sat Jul 29, 2006 7:41 pm

Post » Wed Apr 13, 2011 3:25 pm

Smart thinking :lightbulb: I will create a new script and post it here when completed :)
User avatar
Katy Hogben
 
Posts: 3457
Joined: Mon Oct 30, 2006 12:20 am

Post » Wed Apr 13, 2011 4:52 pm

The new script:


ScriptName O4EDABoethiaStatueScript

short button
short messageOn
short doorVAR

;This will control what happens when the player activates Boethia's clone statue

Begin OnActivate

if isActionRef player == 1

if ( GetStage DABoethia == 100 ) && ( player.getitemcount DaedraHeart == 0 )
MessageBox "You do not have the 5 Daedric Hearts Boethia requires."
elseif ( GetStage DABoethia == 100 ) && ( player.getitemcount DaedraHeart > 5 )
MessageBox "Champion! Do you wish to be tested again?" "Yes" "No"
set messageOn to 1

endif

endif

End

Begin GameMode

if ( GetStage DABoethia == 100 )
O4EDABoethiaStatue01REF.enable
O4EDABoethiaStatue02REF.disable

endif

if ( messageOn == 1 )

Set button to GetButtonPressed

if ( button >= 0 )
set messageOn to 0

endif

if ( button == 0 )
Player.RemoveItem DaedraHeart 5
set DABoethia.doorVAR to 1
player.MoveToMarker DABoethiaMoveMarkerREF
elseif ( button == 1 )
set button to 0

endif

End


What do you (or anyone else) think about this version of the script? :)
User avatar
TOYA toys
 
Posts: 3455
Joined: Sat Jan 13, 2007 4:22 am

Post » Thu Apr 14, 2011 12:00 am

O4EDABoethiaStatue01REF.enable
O4EDABoethiaStatue02REF.disable

This part confused me. You should only need one clone, so I'd expect the original DABoethiaStatueRef instead of one of these. Neither is a reference variable in the script, so I assume they're placed objects.

And the way you've coded it, the swap is happening as soon as the standard quest ends, which means the player is there to potentially notice it happening. I'd try to have an event that happens when the player's away from the shrine make the swap happen, so if there's no chance for alignment problems to show.

When I did this in my mods, the swap was triggered when the player was talking to an NPC at the other end of the map, so even if the statue spun around during the process, you'd never see it.

Putting back the original statue may important if any other mods are using it.

I've replaced the Lucky Old Lady in Bravil in one mod. She's already replaced in the vanilla game twice! The statue before you're the Listener gives you a blessing. The one afterward gives the Listener a new contract to pass to Arquen, and there's a version that morphs out of the way to reveal the door to the crypt. To complicate things further, Open Cities creates new versions of those in the Tamriel worldspace which (logically but not physically) replace the ones in the Bravil worldspace, so I needed logic to handle the possibility of half-a-dozen different statues being involved besides mine. To do that I had to set a variable in the script to the reference of the original statue (which depended on the stage of the DB quest, and the presence of OC) and use that in place of a fixed form reference. Your own copy can safely be the object you placed, as no other mod knows about it, and you're putting back the one you found when you're done.
User avatar
Nadia Nad
 
Posts: 3391
Joined: Thu Aug 31, 2006 3:17 pm

Post » Wed Apr 13, 2011 7:40 pm

O4EDABoethiaStatue01REF.enable
O4EDABoethiaStatue02REF.disable

This part confused me. You should only need one clone, so I'd expect the original DABoethiaStatueRef instead of one of these. Neither is a reference variable in the script, so I assume they're placed objects.


That particular part of the script should disable the vanilla statue and enable the clone.


And the way you've coded it, the swap is happening as soon as the standard quest ends, which means the player is there to potentially notice it happening. I'd try to have an event that happens when the player's away from the shrine make the swap happen, so if there's no chance for alignment problems to show.

When I did this in my mods, the swap was triggered when the player was talking to an NPC at the other end of the map, so even if the statue spun around during the process, you'd never see it.


Hm, interesting approach.... :)


Putting back the original statue may important if any other mods are using it.

I've replaced the Lucky Old Lady in Bravil in one mod. She's already replaced in the vanilla game twice! The statue before you're the Listener gives you a blessing. The one afterward gives the Listener a new contract to pass to Arquen, and there's a version that morphs out of the way to reveal the door to the crypt. To complicate things further, Open Cities creates new versions of those in the Tamriel worldspace which (logically but not physically) replace the ones in the Bravil worldspace, so I needed logic to handle the possibility of half-a-dozen different statues being involved besides mine. To do that I had to set a variable in the script to the reference of the original statue (which depended on the stage of the DB quest, and the presence of OC) and use that in place of a fixed form reference. Your own copy can safely be the object you placed, as no other mod knows about it, and you're putting back the one you found when you're done.


How do you exactly 'replace' a statue if the disable/enable approach isn't the proper way?
User avatar
CSar L
 
Posts: 3404
Joined: Fri Nov 09, 2007 9:36 pm

Post » Thu Apr 14, 2011 4:18 am

I forgot that the Boethia statue already has a REF ID. I will make the proper alterations to the script :)


Edit: done...

ScriptName O4EDABoethiaStatueScriptshort buttonshort messageOnshort doorVAR;This will control what happens when the player activates Boethia's clone statueBegin OnActivateif isActionRef player == 1if ( GetStage DABoethia == 100 ) && ( player.getitemcount DaedraHeart == 0 )	MessageBox "You do not have the 5 Daedric Hearts Boethia requires."elseif ( GetStage DABoethia == 100 ) && ( player.getitemcount DaedraHeart > 5 )	MessageBox "Champion! Do you wish to be tested again?" "Yes" "No"	set messageOn to 1endifendifEndBegin GameModeif ( GetStage DABoethia == 100 )            O4EDABoethiaShrineCloneRef.enable            DABoethiaShrineRef.disableendifif ( messageOn == 1 )	Set button to GetButtonPressed	if ( button >= 0 )		set messageOn to 0	endif	if ( button == 0 )		Player.RemoveItem DaedraHeart 5		set DABoethia.doorVAR to 1		player.MoveToMarker DABoethiaMoveMarkerREF	elseif ( button == 1 )		set button to 0	endifEnd


I'm working on some additional lines to fix the visible swapping of statues issue :)
User avatar
Tammie Flint
 
Posts: 3336
Joined: Mon Aug 14, 2006 12:12 am

Post » Wed Apr 13, 2011 4:05 pm

Enable/disable is the right way, but there needs to be another swap back at the other end of the process. I only see one pair of enable and disable, and nothing touches DABoethiaStatueRef, which is the original statue, the one I'd expect you to disable at the begiining, and enable again at the end of your quest.

O4EDABoethiaStatue01REF and O4EDABoethiaStatue02REF are both references in your mod only. Did you create two copies? If they are reference variables in another script, then you'd have to qualify the variables with the questname, and you haven't.
User avatar
Kristina Campbell
 
Posts: 3512
Joined: Sun Oct 15, 2006 7:08 am

Post » Thu Apr 14, 2011 12:08 am

Take a look at the post above your last post, I think I've fixed the problem :)
User avatar
Leticia Hernandez
 
Posts: 3426
Joined: Tue Oct 23, 2007 9:46 am

Post » Wed Apr 13, 2011 6:37 pm

I think these lines should fix the visible swapping of statues issue, but i don't know if this is an efficient solution...


Begin onResetif ( GetStage DABoethia == 100 )            O4EDABoethiaShrineCloneRef.enable            DABoethiaShrineRef.disableendifEnd



What do you think?
User avatar
LittleMiss
 
Posts: 3412
Joined: Wed Nov 29, 2006 6:22 am

Post » Thu Apr 14, 2011 12:00 am

I think the script will work now. I removed ' doorVAR ' and set DABoethia.doorVAR to 1, cuz I don't need them.

The new script:


ScriptName O4EDABoethiaStatueScriptshort buttonshort messageOn;This will control what happens when the player activates Boethia's clone statueBegin OnActivateif isActionRef player == 1if ( GetStage DABoethia == 100 ) && ( player.getitemcount DaedraHeart == 0 )	MessageBox "You do not have the 5 Daedric Hearts Boethia requires."elseif ( GetStage DABoethia == 100 ) && ( player.getitemcount DaedraHeart > 5 )	MessageBox "Champion! Do you wish to be tested again?" "Yes" "No"	set messageOn to 1endifendifEndBegin GameModeif ( messageOn == 1 )	Set button to GetButtonPressed	endif	if ( button >= 0 )		set messageOn to 0	endif	if ( button == 0 )		Player.RemoveItem DaedraHeart 5		player.MoveToMarker DABoethiaEntranceMarker	elseif ( button == 1 )		set button to 0	endifEndBegin onResetif ( GetStage DABoethia == 100 )            O4EDABoethiaShrineCloneRef.enable            DABoethiaShrineRef.disableendifEnd


Now its time to play test....
User avatar
Georgine Lee
 
Posts: 3353
Joined: Wed Oct 04, 2006 11:50 am

Post » Wed Apr 13, 2011 11:06 pm



The script I've made locks the game up :thumbsdown:


User avatar
Brian Newman
 
Posts: 3466
Joined: Tue Oct 16, 2007 3:36 pm

Post » Wed Apr 13, 2011 11:48 pm

I've decided to return to my original idea in the start-post of this topic: rewriting the original DABoethiaStatue Script and lets see if we can make that work.

So, after a lot of re-writing and -testing the script, I've made a script which only works to a certain point. After that it just freezes the game.


ScriptName DABoethiaStatueScript

short BoethiaSpeech
short button
short messageOn
float timer

;This section will control what happens when the player activates the statue

Begin OnActivate

if isActionRef player == 1

if ( GetStage DABoethia < 20 ) && ( Player.GetLevel >= 20 )
if ( player.getitemcount DaedraHeart == 0 )
MessageBox "You do not have the proper offering Boethia requires."
elseif ( player.getitemcount DaedraHeart > 0 )
MessageBox "Do you wish to offer Daedra Heart to the altar of Boethia?" "Yes" "No"
set messageOn to 1
endif
elseif ( GetStage DABoethia == 30 ) && ( Player.GetLevel >= 20 )
set BoethiaSpeech to 6
elseif ( Player.GetLevel < 20 )
MessageBox "Boethia demands a more powerful champion to begin this quest."
endif

endif

if ( GetStage DABoethia == 100 ) && ( player.getitemcount DaedraHeart == 0 )
MessageBox "You do not have the 5 Daedric Hearts Boethia requires."
elseif ( GetStage DABoethia == 100 ) && ( player.getitemcount DaedraHeart > 5 )
MessageBox "Champion! Do you wish to be tested again?" "Yes" "No"
set messageOn to 1
endif


End

;This section will control the audio files played when the statue is activated

Begin GameMode

if ( messageOn == 1 )

set button to GetButtonPressed

endif

if ( button >= 0 )
set messageOn to 0

endif

if ( button == 0 ) && ( BoethiaSpeech == 0 )
Player.RemoveItem DaedraHeart 1
set button to 0
set BoethiaSpeech to 1
elseif ( messageOn == 1 ) && ( GetStage DABoethia == 100 )
Player.RemoveItem DaedraHeart 5
set button to 0
player.MoveToMarker DABoethiaEntranceMarker
else
set button to 0
endif
endif


set timer to ( timer - GetSecondsPassed )

if ( timer <= 0 )
if ( GetStage DABoethia <= 10 )
if ( BoethiaSpeech == 1 )
;PLAY AUDIO
DisablePlayerControls
set timer to DABoethiaShrineRef.say DABoethiaSpeech 1 DABoethiaVoice 1
set BoethiaSpeech to 2
elseif ( BoethiaSpeech == 2 )
;PLAY AUDIO2
set timer to DABoethiaShrineRef.say DABoethiaSpeech 1 DABoethiaVoice 1
set BoethiaSpeech to 3
elseif ( BoethiaSpeech == 3 )
;PLAY AUDIO3
set timer to DABoethiaShrineRef.say DABoethiaSpeech 1 DABoethiaVoice 1
set BoethiaSpeech to 4
elseif ( BoethiaSpeech == 4 )
;PLAY AUDIO4
set timer to DABoethiaShrineRef.say DABoethiaSpeech 1 DABoethiaVoice 1
set BoethiaSpeech to 5
elseif ( BoethiaSpeech == 5 )
SetStage DABoethia 20
EnablePlayerControls
DABoethiaPortalRef.enable
Set DABoethia.warriorvar to 1
endif
elseif ( GetStage DABoethia == 30 )
if ( BoethiaSpeech == 6 )
;PLAY AUDIO5
DisablePlayerControls
set timer to DABoethiaShrineRef.say DABoethiaSpeech 1 DABoethiaVoice 1
set BoethiaSpeech to 7
elseif ( BoethiaSpeech == 7 )
;PLAY AUDIO6
set timer to DABoethiaShrineRef.say DABoethiaSpeech 1 DABoethiaVoice 1
set BoethiaSpeech to 8
elseif ( BoethiaSpeech == 8 )
EnablePlayerControls
SetStage DABoethia 100
Player.AddItem DAGoldBrand 1
ModPCFame 1
endif
endif
endif

End



As soon as I come back into Tamriel via the Magical Portal in Boethia's realm, the game just locks up... :mellow:

Please help me debug this poorly done script I've made :thumbsup:
User avatar
James Smart
 
Posts: 3362
Joined: Sun Nov 04, 2007 7:49 pm

Post » Thu Apr 14, 2011 1:29 am

Finally! This script works, the only thing I have to do now is to make sure nobody will notice the statue swap :D


ScriptName 1TESTDABoethiasStatueScriptshort buttonshort messageOnBegin onActivateif ( player.getitemcount DaedraHeart < 5 )		MessageBox "You do not have the 5 Daedric Hearts Boethia requires."elseif ( player.getitemcount DaedraHeart >= 5 )		MessageBox "Chosen One! Do you wish to be tested again?" "Yes" "No"		set messageOn to 1endifEndBegin GameModeif ( messageOn == 1 )	Set button to GetButtonPressed	if ( button >= 0 )		set messageOn to 0	endif	if ( button == 0 )		player.RemoveItem DaedraHeart 5		player.MoveToMarker DABoethiaEntranceMarker	elseif ( button == 1 )		set button to 0	endifendifEndBegin onResetif ( GetStage DABoethia == 100 )     DABoethiaShrineCloneRef.enable     DABoethiaShrineRef.disable  endifEnd


:)
User avatar
Elea Rossi
 
Posts: 3554
Joined: Tue Mar 27, 2007 1:39 am

Post » Wed Apr 13, 2011 7:19 pm

Adding an earlier idea to the script makes sure nobody will notice the statue swap:

Begin onResetif ( GetStage DABoethia == 100 )     DABoethiaShrineCloneRef.enable     DABoethiaShrineRef.disable  endifEnd


I've edited the above post, so everyone can take a look at the completed script.

End of topic :D
User avatar
barbara belmonte
 
Posts: 3528
Joined: Fri Apr 06, 2007 6:12 pm


Return to IV - Oblivion