Script Effect Spell - Teleport to location X

Post » Mon Feb 22, 2010 3:58 am

Hmmm....Well, I am slowly becoming more and more familiar with scripting through these tidbits of information posted by you guys! Thank you a lot for that. Next step on this parade of scripting help would be to make a scripted effect spell.

It's simple, nothing too complex, however I do have ideas for it that COULD make it complex if you think you can take a crack at that.

The SIMPLE thing I want done is a spell that will teleport the player from anywhere to a specific map location. I know this could be achieved by using a x marker, but I do not know how to script the spell so when it is used it will move the player to that x marker.

now, if you want to take a crack at my more complex idea, I was wondering - first - if it is possible to script the spell so it only works in the Tamriel worldspace (to prevent cheating) or atleast prevent it from working in interiors. If this can be achieved mind helping me out, so I can see how it is done?

thank you thank you :)
User avatar
Eibe Novy
 
Posts: 3510
Joined: Fri Apr 27, 2007 1:32 am

Post » Sun Feb 21, 2010 11:19 pm

To stop it working in interiors use Player.IsInInterior == 0 as part of the If statement to stop it working in interiors. (Returns 1 if actor is in an interior).

For the spell, use a Player.MoveTo myMarkerRef.

If it is a spell onself then you might get away with removing the Player. parts from both.

These are always good places to check for functions:
http://cs.elderscrolls.com/constwiki/index.php/List_of_function_appearances_in_scripts
http://cs.elderscrolls.com/constwiki/index.php/Function

Begin ScriptEffectStart     If IsInInterior == 0          MoveTo myMarkerRef     EndifEnd

User avatar
D IV
 
Posts: 3406
Joined: Fri Nov 24, 2006 1:32 am

Post » Sun Feb 21, 2010 4:39 pm

You can also put in a check for whether the character is in the Shivering Isles - something to do with a variable called something like "SEWorld" or something, but that's about the extent of my knowledge on the subject.
User avatar
anna ley
 
Posts: 3382
Joined: Fri Jul 07, 2006 2:04 am

Post » Sun Feb 21, 2010 5:53 pm

player.GetInWorldSpace Tamriel is the easiest way to go about that, plus MoveToMarker. If you're only going to the one spot, not so bad.

What you want to do is create a spell/power that calls a Magic Effect script. Something like what Fillythebish posted, except with GetInWorldSpace Tamriel == 1 instead of IsInInterior.

The complex version, which lets you teleport from places like Pale Pass and mod worldspaces, but not Oblivion, SI, or quest worldspaces, might look like this:

scn AFKFrostcragTeleportSpellSCRIPTbegin ScriptEffectStart  if player.IsInInterior == 1    message "The powers of this spell will not work indoors."    return  elseif GetPlayerInSEWorld == 1    message "The powers of this spell will not work in the Shivering Isles."    return  elseif player.GetInWorldSpace BloatedFloatAtSea == 1 || player.GetInWorldSpace ICTempleDistrictMQ16 == 1|| player.GetInWorldSpace ICImperialPalaceMQ16 == 1    message "The powers of this spell will not work at this time."    return  elseif player.GetInWorldSpace CamoranParadise == 1 || player.GetInWorldSpace DABoethiaRealm == 1 || player.GetInWorldSpace DAPeryiteRealm == 1    message "The powers of this spell will not work in the realms of the Daedric Lords."    return  elseif player.GetInWorldSpace MQ10BrumaOblivionGate == 1 || player.GetInWorldSpace MQ14OblivionWorld == 1 || player.GetInWorldSpace MS13CheydinhalOblivionWorld == 1 || player.GetInWorldSpace MS14World == 1     message "The powers of this spell will not work in Oblivion."    return  elseif player.GetInWorldSpace OblivionMQKvatch == 1 || player.GetInWorldSpace OblivionRD001 == 1 || player.GetInWorldSpace OblivionRD002 == 1 || player.GetInWorldSpace OblivionRD003 == 1 || player.GetInWorldSpace OblivionRD004 == 1 || player.GetInWorldSpace OblivionRD005 == 1 || player.GetInWorldSpace OblivionRD006 == 1 || player.GetInWorldSpace OblivionRD007 == 1    message "The powers of this spell will not work in Oblivion."    return  else    message "The spell transports you instantly to Frostcrag Spire."    player.movetomarker FCSpireStarterMarker  endifend

User avatar
courtnay
 
Posts: 3412
Joined: Sun Nov 05, 2006 8:49 pm

Post » Mon Feb 22, 2010 4:36 am

thank you Dwip for that! :) very helpful!

you were explaining the "player.GetInWorldspace Tamriel" do you mean this is a way to make it work ONLY in the Tamriel worldspace? if so, is there way to script it so that a message will pop up if the player is not in Tamriel? Like on the Frostcrag script, if the player was in a specific worldspace that did not allow teleporting, then a message would come up.

Also - to prevent starting two topics - I could use a little bit more scripting help. Is there a way that on equipping something (onEquip) the item (a book) will be forced to be closed ("unequipped") unless the player has used an item before hand? (this does actually have to do with the teleportation, it's the steps to getting the spell)
User avatar
Beat freak
 
Posts: 3403
Joined: Thu Dec 14, 2006 6:04 am

Post » Mon Feb 22, 2010 1:22 am

Sure. Something to the effect of:

if player.GetInWorldSpace Tamriel == 1  player.movetomarker SomeRandomXMarkerSomewhereelse  message "You cannot teleport from here."endif


All you need is the else in there to run the message code if the player turns out to not be in Tamriel (player.GetInWorldSpace Tamriel comes back as 0). The more complex version of that, the Frostcrag script I posted, uses elseif and more worldspace checks to give customized messages for each different worldspace.

I THINK, and I heavily emphasize the THINK part of this, that you can do your book thing by doing something like:

begin OnEquipif SomeQuest.UsedItemVariable == 1  Activateelse  Returnendifend


Where SomeQuest is some quest where you're going to stash the variable UsedItemVariable, which you're going to set to 1 with an OnEquip block on the other item, or whatever makes sense to do to set that.

Note that the Return part of things may or may not be the proper way to do what you're after, depending on what precisely you're trying to do. I've never tried to close a book in quite that way, so I'm taking my best shot at 4:30 am. Somebody else may be able to give you a better answer than that.
User avatar
Bethany Watkin
 
Posts: 3445
Joined: Sun Jul 23, 2006 4:13 pm

Post » Mon Feb 22, 2010 2:23 am

eh, you know forget that second part, ha ha ha. I found an easier work-around...it's called: Forget the whole idea because it's dumb anyways.
but thank you for taking a crack at it!! :)

and thank you for the teleportation script!

lol, but here is another thing (a last minute change in a different script)
so yes...I am going off topic, but atleast there aren't two Ntom posts floating around.

I have a sword that you get by activating an item....however the sword's stats are static and I think players would more prefer it to not be, since, the sword was made as a super-powerful (but not godlike) weapon for a level 9. So, how would I go about that? the current script is:
scriptname CSbookScriptshort CSRandomRollbegin onEquip	Set CSRandomRoll to GetRandomPercent	if (CSRandomRoll <=100)	MessageBox "I pulled the sword out of the book. It seems most of the book is still legible"	Message "By pulling the sword out I have now been cursed. I must find a cure immediately!"	player.additem CSSSResolution 1	player.additem CSCurseBinder 1	Player.addspell CSCurse	removeme	; player.removeitem CSSwordInBook 1	return	endifend


could I just make a "leveleditem" and replace the "CSCurseBinder" (the sword) with the ID of the leveled item list? or would I have to go with a "if player is level x add item x, if player is level y add item x^2" sort of thing?
User avatar
Mr.Broom30
 
Posts: 3433
Joined: Thu Nov 08, 2007 2:05 pm


Return to IV - Oblivion