Jump to content

Scripting noob, need help


62firelight

Recommended Posts

I'd try the PlaySound command - pick the appropriate sound from the available sound baseobjects and use the command just before the MoveTo. You could also consider PlayMagicShaderVisuals if you want there to be a visual effect.

 

One problem I can think of though is that the sound (and visual effect) might stop instantly... give it a try and see if the sound continues during the loadingscreen.

Link to comment
Share on other sites

I'm using PlaySound SPLAlterationCast to play the sound (if you haven't noticed) and it won't play the sound. I think it's the sound I've chosen, I only picked it because it was the open/close sound for Mages' Guild portals.
Link to comment
Share on other sites

Test this out for me... comment out the MoveTo commands. For testing purposes, it will stop the player from teleporting, but it will check whether it's the MoveTo that's killing the sound or something else.

 

If the sound does play, I can whip up a bit of timer code that will wait for the sound to finish playing before teleporting the player.

If the sound doesn't play, it's the actual PlaySound command that's behaving funny. Try PlaySound3D or other sound files.

 

Welcome to the world of Oblivion scripting where functions rarely work precisely as intended. ;)

Link to comment
Share on other sites

Yup, it plays when I comment out the MoveTo command from the script.

 

They rarely work precisely? o.O I never knew that. Well I think you mean that some things work but some things don't.

Edited by 62firelight
Link to comment
Share on other sites

Yes, Oblivion scripting is very quirky and things often only work if done in a particular way. For example, who would have thought that MoveTo would mess up the sounds and stop the rest of the script from running?

 

Anyway, if the sound plays, then all we need to do is add a delay before teleporting the player. We'll also disable their controls so they can't run around and go shopping while the sound is still playing (it would probably cause some big problems!)

 

Scriptname AARavenspirePortalwhereto

short Ravencontrolvar
short Ravenbutton

float Timer	; <------- Add this

Begin OnActivate

; When you activate object, it will popup a message box.
If ( ravencontrolvar == 0 )
	MessageBox "The tingly feeling of the portal touches you and it makes you think, where do I go?" "Chorrol Mages Guild" "Bravil Mages Guild" "Cancel"	; <------- Added third option
	set ravencontrolvar to 1
	set ravenbutton to getbuttonpressed
	;messagebox is displayed, options are displayed and ravencontrolvar set to 1
	Activate
endif

end

Begin GameMode

If ( ravencontrolvar == 1 ) 
	Set ravenbutton to GetButtonPressed
	If ( ravenbutton == -1 )
		return
	elseif  ( ravenbutton == 0 )
		MessageBox "As you fade away, you see...the Chorrol Mages Guild." 
		playsound splalterationcast
		set ravencontrolvar to 2	; <------- Change this
		DisablePlayerControls		; <------- Add this - it stops the player from running around
		set Timer to 5			; <------- Add this and change the number of seconds to whatever you want
		;player.moveto ravenchorrol	; <------- Remove this

		;scripting is so confusing

	elseif ( ravenbutton == 1 )
		MessageBox "As you fade away, you see...the Bravil Mages Guild."
		playsound splalterationcast
		set ravencontrolvar to 3	; <------- Change this
		DisablePlayerControls		; <------- Add this - it stops the player from running around
		set Timer to 5			; <------- Add this and change the number of seconds to whatever you want
		;player.moveto ravenbravil	; <------- Remove this

	else
		set ravencontrolvar to 0

	endif
	;as you can see, the pc teleports to the bravil mages guild xmarker when the messagebox ends.



;----- Add this entire section -----

elseif ( ravencontrolvar > 1 )
	set Timer to Timer - GetSecondsPassed
	if Timer <= 0					; The countdown has finished
		EnablePlayerControls			; Lets the player move around again
		if ravencontrolvar == 2
			set ravencontrolvar to 0
			player.moveto ravenchorrol
		elseif ravencontrolvar == 3
			set ravencontrolvar to 0
			player.moveto ravenbravil
		else 
			set ravencontrolvar to 0	; (just in case something borked)
		endif
	endif

; ----- end of new section -----


endif  

end

 

Update, test and debug. :)

Link to comment
Share on other sites

Never mind, I copied the script from your post and suddenly it was fixed. And about the sound, it doesn't play the Cast sound because of the MessageBox, so I just changed it to say Message instead and it works.

 

I have another problem, but I won't try to bother you again. If you want to help then, I have a script that disables an NPC after the PC leaves the cell the NPC is in. However instead of disabling the NPC, it reverts his dialogue to a default NPC (Just Rumors topic and he is voiced)

Link to comment
Share on other sites

I have another problem, but I won't try to bother you again. If you want to help then, I have a script that disables an NPC after the PC leaves the cell the NPC is in. However instead of disabling the NPC, it reverts his dialogue to a default NPC (Just Rumors topic and he is voiced)

 

Is it a new NPC or a modified vanilla one?

 

Usually you can make NPCs disappear by using the Disable command. However, if the NPC has a parent, this won't work (check on the NPC object's properties and see if there's a parent).

 

If there is a parent, another way is to use MoveTo to move them to a dummy cell somewhere. The problem with this is if they have some sort of AI schedule such as "go to sleep in cell X", they'll eventually find their way back into the world.

 

Last option is to kill them... and then reset the cell if you want to delete them from the savegame as well.

 

All these options can actually be combined... disable them, move them, kill them and reset the cell. But keep in mind that almost all vanilla NPCs have some sort of quest related function, so messing with them in this way isn't recommended. ;)

Link to comment
Share on other sites

It is a new NPC. None of his dialogue created by me are not voiced and when I leave the cell/talk to him he will mysteriously start being voice acted with the Dark Elf Male voice actor on. Also, I forgot to post the script last time so here it is.

 

 

ScriptName UnviniDisappears 
begin GameMode      
         if ( GetInSameCell ravenspireflowingbowlunvini == 0 ) ( GetStage RavenspireSale >= 100 )   
           disable                                                       
      else  ;<---- Extra?    
endif
end

 

Edited by 62firelight
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...