Dynamic expansion of script for teleporting PC; possible?

Old and generally outdated discussions, with the rare hidden gem. Enter at your own risk.

Moderators: Haplo, Lead Developers

Locked
Bladed_Edge
Member
Posts: 4
Joined: Sun Jan 31, 2010 5:01 am
Location: Sterling, VA, USA

Dynamic expansion of script for teleporting PC; possible?

Post by Bladed_Edge »

I'm working on an .esp right now, part of a combined birthday/anniversary present for my fiance, who recently got into Morrowind. The .esp consists of my noodlings with Dragonsong's tutorial instructions enlarged into a trio of pieces of real estate in Pelagiad, Balmora and Ald-Ruhn. I've included a script a friend gave me, modified to allow an item (a dwemer tube) to bring the player on equip to any of the three properties. The script is below.

My question is, is it possible to use If statements or some other loop to dynamically expand the script's possible teleporter locations based on what journal entries have been reached? Something like:

If (;TelvanniStrongholdQuest; >= 50)
Messagebox (;Previous Entries; + "Uvirith's Grave"

or for when it's given to you

If (;mainquestSomething; >= 40)
Messagebox (;Previous Entries; + ;Stronghold; + "Caius Cosades' House"


I'm not the world's greatest programmer. I've been examining the TESCS help file and it seems like this sort of thing is *theoretically* possible, but in practice my attempts have crashed the game. Anybody have any ideas? Thanks in advance.


My script is:

Code: Select all

Begin BDE_tport_Script
//Author: Medius Laire
//Modified: BladedEdge

short button
short messageOn
short reset
short OnPcEquip

//if ( MenuMode == 1 )
//	Return
//endif

if ( OnPCEquip == 0 )
	set reset to 0
endif

if ( reset == 1 )
	return
endif

if ( OnPCEquip == 1 )
	if ( reset == 0 )
		Set OnPCEquip to 0
		MessageBox "Where would you like to go?" "Ex Nihilo" "Habe Quiddam" "Ad Infinitum" "Nowhere"
		set messageOn to 1
	endif
endif

if ( messageOn == 1)

	set button to GetButtonPressed

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

	if ( button == 0 )
		PlaySound, "mysticism area"
		Player->PositionCell 185.098,-1793.876,464.000,270.0 "Ex Nihilo"
		set reset to 1		
			
	elseif ( button == 1 )
		PlaySound, "mysticism area"
		Player->PositionCell 1487.713,227.348,0,270.0 "Habe Quiddam"
		set reset to 1

	elseif ( button == 2 )
		PlaySound, "mysticism area"
		Player->PositionCell 376.380,-10.876,16.000,91.7 "Ad Infinitum"
		set reset to 1

	elseif ( button == 3 )
		PlaySound, "Spell Failure Mysticism"
		set reset to 1
		return
	endif
endif


End
EDIT: Changed to using Code function at MMMowSkwoz's request
Last edited by Bladed_Edge on Fri Feb 05, 2010 8:34 pm, edited 2 times in total.
User avatar
Thrignar Fraxix
Developer Emeritus
Posts: 10644
Joined: Mon Dec 06, 2004 10:30 pm
Location: Silnim
Contact:

Post by Thrignar Fraxix »

Knowing next to nothing about scripting, all I can suggest is that you copy and edit the script on Barlizar's Mazed band. (or did you do that already, I'm a scripting noob so I can't tell)

If not, I would imagine that script would be fairly simple to add to and edit. If this is an edit of that script, then disregard the first sentence because it doesn't seem as intuitive to edit as I thought it would be.
Reviewing Administrator
Morrowind Reviews: 1640
Completed MW Interiors: 29

The just man frowns, but never sneers. We can understand anger, but not malevolence - Victor Hugo, Les Miserables

The abuse of greatness is when it disjoins remorse from power - Brutus, Julius Caesar

Fun is bad - Haplo
MMMowSkwoz
Developer
Posts: 835
Joined: Mon Oct 27, 2008 11:18 pm
Location: London

Post by MMMowSkwoz »

Please use the code function when posting script.

Try this:

Code: Select all

Begin BDE_tport_Script

short button
short MessageOn
short OnPCEquip

if ( OnPCEquip == 1 )

	Set OnPCEquip to 0
	Set MessageOn to 1
	
	if ( GetJournalIndex "HT_Stronghold" >= 300 )

		MessageBox "Where would you like to go?", "Nowhere", "Ex Nihilo", "Habe Quiddam", "Ad Infinitum", "Uvirith's Grave" 

	else

		MessageBox "Where would you like to go?", "Nowhere", "Ex Nihilo", "Habe Quiddam", "Ad Infinitum"

	endif

endif

if ( MessageOn == 1 )

	set button to GetButtonPressed
	set MessageOn to 0

	if ( button == -1 )

		set MessageOn to 1

	elseif ( button == 0 )

		PlaySound, "Spell Failure Mysticism" 

	elseif ( button == 1 )

		PlaySound, "mysticism area"
		Player->PositionCell 185.098,-1793.876,464.000,270.0 "Ex Nihilo"

	elseif ( button == 2 )

		PlaySound, "mysticism area"
		Player->PositionCell 1487.713,227.348,0,270.0 "Habe Quiddam" 

	elseif ( button == 3 )

		PlaySound, "mysticism area"
		Player->PositionCell 376.380,-10.876,16.000,91.7 "Ad Infinitum" 

	elseif ( button == 4 )

		PlaySound, "mysticism area"
		Player->PositionCell X_COORD, YCOORD, ZCOORD, ROTATION, "Uvirith's Grave"

		;^^^^Enter the coordinates you want the player to travel to^^^^

	endif

endif

End
MaMeeshkaMowSkwoz - choose your syllables
Bladed_Edge
Member
Posts: 4
Joined: Sun Jan 31, 2010 5:01 am
Location: Sterling, VA, USA

Thanks, TR Team

Post by Bladed_Edge »

Got it working the way I wanted it. Took a while to test the thing and fix some stupid errors I made.

Here's the working script if anybody's interested. Teleporter key to an .esp property which also adds teleportation to a great house stronghold once the PC gets one.

I suspect the STV == 0 and various setresets are superfluous in this version, but I'm not messing with something that I know works.

Code: Select all

Begin BDE_tport_Script2
;Author: MMMowSkwoz
;Modified: BladedEdge

short button
short MessageOn
short OnPCEquip
short STV

if ( OnPCEquip == 1 )

   Set OnPCEquip to 0
   Set MessageOn to 1 

	if ( GetJournalIndex "HT_Stronghold" > 90 )

     	MessageBox "Where would you like to go?", "Nowhere", "Ex Nihilo", "Habe Quiddam", "Ad Infinitum", "Uvirith's Grave" 
		Set STV to 1
		set messageOn to 1

	elseif ( GetJournalIndex "HH_Stronghold" > 90 )

		MessageBox "Where would you like to go?", "Nowhere", "Ex Nihilo", "Habe Quiddam", "Ad Infinitum", "Odai Plateau"
		Set STV to 2
		set messageOn to 1

	elseif ( GetJournalIndex "HR_Stronghold" > 90 )

		MessageBox "Where would you like to go?", "Nowhere", "Ex Nihilo", "Habe Quiddam", "Ad Infinitum", "Bal Isra"
		Set STV to 3
		set messageOn to 1

	else		

		MessageBox "Where would you like to go?" "Nowhere" "Ex Nihilo" "Habe Quiddam" "Ad Infinitum" 
		set messageOn to 1

	endif

endif


if ( MessageOn == 1 )

   set button to GetButtonPressed
   set MessageOn to 0

   if ( button == -1 )

      set MessageOn to 1

	elseif ( button == 0 )
		PlaySound, "Spell Failure Mysticism"
		set reset to 1
		return		
			
	elseif ( button == 1 )
		PlaySound, "mysticism area"
		Player->PositionCell 1487.713,227.348,0,270.0 "Habe Quiddam"
		set reset to 1

	elseif ( button == 2 )
		PlaySound, "mysticism area"
		Player->PositionCell 286.888,94.415,14.258,90.0 "Ad Infinitum"
		set reset to 1

	elseif ( button == 3 )
		PlaySound, "mysticism area"
		Player->PositionCell 185.098,-1793.876,464.000,270.0 "Ex Nihilo"
		set reset to 1

	elseif ( button == 4 )

		if ( STV == 0 )
			set reset to 1
			return

		elseif ( STV == 1 )
			PlaySound, "mysticism area"
			Player->PositionCell 85733,11396,1872,146 "Uvirith's Grave"
			set reset to 1

		elseif ( STV == 2 )
			PlaySound, "mysticism area"
			Player->PositionCell -35076,-35553,1870,183 "Odai Plateau"
			set reset to 1

		elseif ( STV == 3 )
			PlaySound, "mysticism area"
			Player->PositionCell -36154,78958,1708,86 "Bal Isra"
			set reset to 1

		endif

	endif

endif


End BDE_tport_Script2
MMMowSkwoz
Developer
Posts: 835
Joined: Mon Oct 27, 2008 11:18 pm
Location: London

Post by MMMowSkwoz »

Looks fine. You haven't declared the "reset" variable, so those lines are definitely redundant and can be deleted.
MaMeeshkaMowSkwoz - choose your syllables
Locked