complicated script help plz?

Post » Thu May 03, 2012 11:21 pm

I'm having trouble even grasping the script I want to create here.


Start of script:


Plays a sound file (Dragon8) with message box. Once message has been played then you get a journal update.

Once this is complete, you gather 10 souls in soul gems and present them back to the same activator. The soul gems are taken off you and you recieve another sound file (Dragon9) and a journal update.



Can anyone help me write such a script?
User avatar
StunnaLiike FiiFii
 
Posts: 3373
Joined: Tue Oct 31, 2006 2:30 am

Post » Fri May 04, 2012 6:15 am

short doOnceif ( OnActivate == 1 )	if ( doOnce == 0 )		set doOnce to 1	elseif ( doOnce == 2 )		set doOnce to 3	endifendifif ( doOnce == 1 )	set doOnce to 2	PlaySound3D "Dragon8"	MessageBox "Message 1" "OK"	Journal "QuestName" 10endifif ( doOnce == 3 )	if ( Player->HasSoulGem, "golden saint" >= 10 )		Player->RemoveSoulGem, "golden saint", 10		set doOnce to 4		PlaySound3D "Dragon9"		Journal "QuestName" 20	else		set doOnce to 2		MessageBox "You don't have enough souls." "OK"	endifendif
That's assuming you want souls from some specific monster. Otherwise the script becomes unreasonably bloated with checks for every possible monster in game.
User avatar
Siidney
 
Posts: 3378
Joined: Fri Mar 23, 2007 11:54 pm

Post » Fri May 04, 2012 3:08 am

short doOnceif ( OnActivate == 1 )	if ( doOnce == 0 )		set doOnce to 1	elseif ( doOnce == 2 )		set doOnce to 3	endifendifif ( doOnce == 1 )	set doOnce to 2	PlaySound3D "Dragon8"	MessageBox "Message 1" "OK"	Journal "QuestName" 10endifif ( doOnce == 3 )	if ( Player->HasSoulGem, "golden saint" >= 10 )		Player->RemoveSoulGem, "golden saint", 10		set doOnce to 4		PlaySound3D "Dragon9"		Journal "QuestName" 20	else		set doOnce to 2		MessageBox "You don't have enough souls." "OK"	endifendif
That's assuming you want souls from some specific monster. Otherwise the script becomes unreasonably bloated with checks for every possible monster in game.






So far my script looks like this now:

Begin dragonvoice2

short doOnce

if ( OnActivate == 1 )
if ( doOnce == 0 )
set doOnce to 1
elseif ( doOnce == 2 )
set doOnce to 3
endif
endif

if ( doOnce == 1 )
set doOnce to 2
PlaySound3D "Vo\Misc\Dragon8.wav"
MessageBox "Message 1" "OK"
Journal "Drag_test3" 10
endif

if ( doOnce == 3 )
if ( Player->HasSoulGem, "0TRP-lostsoul" >= 10 )
Player->RemoveSoulGem, "0TRP-lostsoul", 10
set doOnce to 4
PlaySound3D "Vo\Misc\Dragon9.wav"
Journal "Drag_test3" 20
else
set doOnce to 2
MessageBox "You don't have enough souls." "OK"
endif
endif

End



I get the first part correct where the voice speaks with a journal entry but it dosn't recognise the favt that I've collected ten souls nor does it tell me I don't have enough souls if I come back prematurely
User avatar
Jade
 
Posts: 3520
Joined: Mon Jul 10, 2006 6:42 am

Post » Fri May 04, 2012 6:06 am

I think HasSoulgem returns true/false, not quantity, and RemoveSoulgem removes one. Also, as in Kir's example, you would have to refer to a sound object created in construction set pointing to a sound file, not to the sound file directly.
I'd try a variation like this
Begin dragonvoice2short doOnceshort countif ( OnActivate )	if ( doOnce == 0 )		set doOnce to 1	elseif ( doOnce == 2 )		set doOnce to 3	endifendifif ( doOnce == 1 )	set doOnce to 2	PlaySound3D "Dragon8" ;  create a sound pointing to Vo\Misc\Dragon8.wav file	Journal "Drag_test3" 10	MessageBox "Message 1" "OK"endifif ( doOnce == 3 )	set count to 0	while ( Player->HasSoulGem "0TRP-lostsoul" )		if ( count < 10 )			Player->RemoveSoulGem "0TRP-lostsoul"			set count to ( count + 1 )		endif	endwhile	if ( count >= 10 )		set doOnce to 4		PlaySound3D "Dragon9" ; create a sound pointing to Vo\Misc\Dragon8.wav file		Journal "Drag_test3" 20	else		while ( count > 0 )			Player->AddSoulGem "0TRP-lostsoul"			set count to ( count - 1 )		endwhile		set doOnce to 2		MessageBox "You don't have enough souls." "OK"	endifendifEnd
User avatar
Irmacuba
 
Posts: 3531
Joined: Sat Mar 31, 2007 2:54 am

Post » Fri May 04, 2012 9:39 am

I think HasSoulgem returns true/false, not quantity, and RemoveSoulgem removes one. Also, as in Kir's example, you would have to refer to a sound object created in construction set pointing to a sound file, not to the sound file directly.
I'd try a variation like this
Begin dragonvoice2short doOnceshort countif ( OnActivate )	if ( doOnce == 0 )		set doOnce to 1	elseif ( doOnce == 2 )		set doOnce to 3	endifendifif ( doOnce == 1 )	set doOnce to 2	PlaySound3D "Dragon8" ;  create a sound pointing to Vo\Misc\Dragon8.wav file	Journal "Drag_test3" 10	MessageBox "Message 1" "OK"endifif ( doOnce == 3 )	set count to 0	while ( Player->HasSoulGem "0TRP-lostsoul" )		if ( count < 10 )			Player->RemoveSoulGem "0TRP-lostsoul"			set count to ( count + 1 )		endif	endwhile	if ( count >= 10 )		set doOnce to 4		PlaySound3D "Dragon9" ; create a sound pointing to Vo\Misc\Dragon8.wav file		Journal "Drag_test3" 20	else		while ( count > 0 )			Player->AddSoulGem "0TRP-lostsoul"			set count to ( count - 1 )		endwhile		set doOnce to 2		MessageBox "You don't have enough souls." "OK"	endifendifEnd


thanks for the input abot but I'm still having the same problem
User avatar
Kristina Campbell
 
Posts: 3512
Joined: Sun Oct 15, 2006 7:08 am

Post » Fri May 04, 2012 12:34 pm

I think HasSoulgem returns true/false, not quantity
Well, the MSFD describes the function with an example like this:
if ( Player->HasSoulGem "atronach_storm" > 1 )	   Set counter to ( counter + 2 )elseif ( Player->HasSoulGem "atronach_storm" > 0 )	   Set counter to ( counter + 1 )endif
so I assumed it's about quantity. As for the problem, the script doesn't look like there's something wrong with it, but with CS you never can be sure :sweat: . Try to stuff it with debug messages and see if anything happens:
Begin dragonvoice2short doOnceshort countif ( OnActivate )	    if ( doOnce == 0 )			    set doOnce to 1	    elseif ( doOnce == 2 )			    set doOnce to 3	    endif	    MessageBox "Activator hit, doOnce=%.0f" doOnceendifif ( doOnce == 1 )	    set doOnce to 2	    PlaySound3D "Dragon8" ;  create a sound pointing to Vo\Misc\Dragon8.wav file	    Journal "Drag_test3" 10	    MessageBox "Message 1" "OK"	    MessageBox "Quest started, doOnce=%.0f" doOnceendifif ( doOnce == 3 )	    MessageBox "Second hit, doOnce=%.0f" doOnce	    set count to 0	    while ( Player->HasSoulGem "0TRP-lostsoul" )			    if ( count < 10 )					    Player->RemoveSoulGem "0TRP-lostsoul"					    set count to ( count + 1 )			    endif	    endwhile	    if ( count >= 10 )			    set doOnce to 4			    PlaySound3D "Dragon9" ; create a sound pointing to Vo\Misc\Dragon8.wav file			    Journal "Drag_test3" 20	    else			    while ( count > 0 )					    Player->AddSoulGem "0TRP-lostsoul"					    set count to ( count - 1 )			    endwhile			    set doOnce to 2			    MessageBox "You don't have enough souls." "OK"	    endif	    MessageBox "Second hit processed, doOnce=%.0f" doOnceendifEnd
User avatar
Mariaa EM.
 
Posts: 3347
Joined: Fri Aug 10, 2007 3:28 am

Post » Fri May 04, 2012 9:49 am

Ok, done a little testing:
HasSoulGem returns count, MSFD is right, nice, so that should not be the problem,

RemoveSoulGem "atronach_storm" 2
is same as
RemoveSoulGem "atronach_storm"
always removes 1, last number is skipped
, MSFD is wrong, MWEdit/UESPWiki is right


AddSoulGem "atronach_storm" Misc_SoulGem_Grand 2
is same as
AddSoulGem "atronach_storm" Misc_SoulGem_Grand
always adds 1, last number is skipped
MSFD,MWEdit help/UESPWiki is correct,
MWEdit compiler wrongly asks for swapped arguments (AddSoulGem, [Soulgem], [Creature])
[EDIT]typo


so a problem was probably
Player->RemoveSoulGem, "0TRP-lostsoul", 10
User avatar
jess hughes
 
Posts: 3382
Joined: Tue Oct 24, 2006 8:10 pm

Post » Fri May 04, 2012 12:25 am

Ok, done a little testing: HasSoulGem returns count, MSFD is right, nice, so that should not be the problem, RemoveSoulGem "atronach_storm" 2 is same as RemoveSoulGem "atronach_storm" always removes 1, last number is skipped , MSFD is wrong, MWEdit/UESPWiki is right AddSoulGem "atronach_storm" Misc_SoulGem_Grand 2 is same as AddSoulGem "atronach_storm" Misc_SoulGem_Grand always adds 1, last number is skipped MSFD,MWEdit help/UESPWiki is correct, MWEdit compiler wrongly asks for swapped arguments (AddSoulGem, [Soulgem], [Creature]) [EDIT]typo so a problem was probably Player->RemoveSoulGem, "0TRP-lostsoul", 10
]


I got this error message with the scripts provided: (Player->AddSoulGem "0TRP-lostsoul") = (Item function needs to have two items ID's) I have no idea what its asking
User avatar
DarkGypsy
 
Posts: 3309
Joined: Tue Jan 23, 2007 11:32 am

Post » Thu May 03, 2012 11:54 pm

Use ( Player->AddSoulGem "0TRP-lostsoul" "Misc_SoulGem_Grand" ) instead
User avatar
MatthewJontully
 
Posts: 3517
Joined: Thu Mar 08, 2007 9:33 am

Post » Thu May 03, 2012 11:10 pm

Use ( Player->AddSoulGem "0TRP-lostsoul" "Misc_SoulGem_Grand" ) instead


that fixed the error message but I'm still having the problem of the soul count not being recognised
User avatar
Breanna Van Dijk
 
Posts: 3384
Joined: Mon Mar 12, 2007 2:18 pm

Post » Thu May 03, 2012 11:35 pm

Debugging results?
User avatar
Lexy Corpsey
 
Posts: 3448
Joined: Tue Jun 27, 2006 12:39 am

Post » Fri May 04, 2012 8:49 am

Debugging results?

not sure what you mean. the first half of a script works. I get the first message and journal entry but after that, the activator is inert
User avatar
Stat Wrecker
 
Posts: 3511
Joined: Mon Sep 24, 2007 6:14 am

Post » Fri May 04, 2012 10:41 am

Begin dragonvoice2short doOnceshort countif ( OnActivate )	if ( doOnce == 0 )		set doOnce to 1	elseif ( doOnce == 2 )		set doOnce to 3	endifendifif ( doOnce == 1 )	set doOnce to 2	PlaySound3D "Dragon8"	Journal "Drag_test3" 10	returnendifif ( doOnce == 3 )	set count to ( Player->HasSoulGem "0TRP-lostsoul" )	if ( count >= 10 )		MessageBox "DEBUG: you have %g souls" count		set count to 10		MessageBox "DEBUG: removing %g souls" count		set doOnce to 4	else		set doOnce to 2		MessageBox "You don't have enough souls." "OK"	endif	returnendifif ( doOnce == 4 )	if ( count > 0 )		Player->RemoveSoulGem "0TRP-lostsoul"		set count to ( count - 1 )		return	endif	PlaySound3D "Dragon9"	Journal "Drag_test3" 20	set doOnce to 5endifEnd
this works for me
User avatar
Amelia Pritchard
 
Posts: 3445
Joined: Mon Jul 24, 2006 2:40 am

Post » Fri May 04, 2012 3:29 am

Begin dragonvoice2 short doOnce short count if ( OnActivate ) if ( doOnce == 0 ) set doOnce to 1 elseif ( doOnce == 2 ) set doOnce to 3 endif endif if ( doOnce == 1 ) set doOnce to 2 PlaySound3D "Dragon8" Journal "Drag_test3" 10 return endif if ( doOnce == 3 ) set count to ( Player->HasSoulGem "0TRP-lostsoul" ) if ( count >= 10 ) MessageBox "DEBUG: you have %g souls" count set count to 10 MessageBox "DEBUG: removing %g souls" count set doOnce to 4 else set doOnce to 2 MessageBox "You don't have enough souls." "OK" endif return endif if ( doOnce == 4 ) if ( count > 0 ) Player->RemoveSoulGem "0TRP-lostsoul" set count to ( count - 1 ) return endif PlaySound3D "Dragon9" Journal "Drag_test3" 20 set doOnce to 5 endif End
this works for me


thanks abot! that did the trick!
User avatar
Nick Tyler
 
Posts: 3437
Joined: Thu Aug 30, 2007 8:57 am


Return to III - Morrowind