Jump to content

Script to check if player is in ANY of the following worldspaces


Recommended Posts

I've been looking at the script for Teleport to Frostcrag Spire - Spell and Item by mightylink

 

 

ScriptName aamlfrostcragspellScript

Begin ScriptEffectStart
if player.GetInWorldspace Tamriel == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
else
Message "The Stone of Recall cannot shine in dark times..."
endif
End

Begin GameMode
if player.GetInWorldspace Tamriel == 1 && player.IsInCombat == 0
player.MoveTo aamlstoneofrecallmarker
PlaySound SPLIllusionCast
else
endif
End

 

The stone or spell will only work if the player is in the Tamriel worldspace and outside combat. I was wondering how a script would work that so long as the player were in any worldspace where the sky is visible (anywhere that weather can happen) and also out of combat, that the spell would execute? I was wanting to figure this out myself, but I don't know if I want to take 6 months of reading the construction set encyclopedia and learning code to figure out that it's impossible... Does OBSE use a parameter like OR, or is there some other way to chain the commands that would make it happen? If there is a simple parameter, if I could get an example for two worldspaces or three, then I'll do all the rest of them...

Link to comment
Share on other sites

Oh, I found something on this site's page on Oblivion scripting:

 

 

ElseIf can be used to check another comparison if the first comparison is false:

If Player.GetItemCount Gold001 > 10Message “You have more than ten gold pieces.”ElseIf Player.GetItemCount Gold 001 == 1Message “You have exactly one gold piece.”ElseIf Player.GetItemCount Gold 001 == 2Message “You have exactly two gold pieces.”EndIf

 

Would I be able to use ElseIf to do what I proposed?

Link to comment
Share on other sites

Okay... so...

 

I've got the spell to work, and changed the destination to the FrostcragSpire02 cell, which is where I am usually going (to make potions and store ingredients), and I've included all the worldspaces that have a view of the sky that are not part of special quests or located in any type of Oblivion plane (my reasoning being that these effects depend on the energies of Aetherius to work, so the sky must be visible):

 

 

ScriptName aamlfrostcragspellScript

Begin ScriptEffectStart
if player.GetInWorldspace Tamriel == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace AnvilWorld == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace AnvilCastleCourtyardWorld == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace AnvilWorld == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace BravilWorld == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace BrumaWorld == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace CheydinhalWorld == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace AnvilWorld == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace ChorrolWorld == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace ICArboretumDistrict == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace ICArenaDistrict == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace ICElvenGardensDistrict == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace ICImperialPalace == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace ICImperialPrisonDistrict == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace ICMarketDistrict == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace ICTalosPlazaDistrict == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace ICTheArcaneUniversity == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace KvatchEast == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace KvatchEntrance == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace KvatchPlaza == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace LeyawiinWorld == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace PalePassWorld == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
elseif player.GetInWorldspace SkingradWorld == 1 && player.IsInCombat == 0
Message "The Stone of Recall shines brightly..."
else
Message "The Aetherial energies are too weak here..."
endif
End

Begin GameMode
if player.GetInWorldspace Tamriel == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace AnvilWorld == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace AnvilCastleCourtyardWorld == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace AnvilWorld == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace BravilWorld == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace BrumaWorld == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace CheydinhalWorld == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace AnvilWorld == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace ChorrolWorld == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace ICArboretumDistrict == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace ICArenaDistrict == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace ICElvenGardensDistrict == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace ICImperialPalace == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace ICImperialPrisonDistrict == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace ICMarketDistrict == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace ICTalosPlazaDistrict == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace ICTheArcaneUniversity == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace KvatchEast == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace KvatchEntrance == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace KvatchPlaza == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace LeyawiinWorld == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace PalePassWorld == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
elseif player.GetInWorldspace SkingradWorld == 1 && player.IsInCombat == 0
player.MoveTo FCLivingAreaMarker02
PlaySound SPLIllusionCast
endif
End

 

It's pretty awesome so far, I haven't tested every area but I've tested a half dozen.

 

However, there is a separate script for the Stone of Recall, which is the other way to teleport to Frostcrag. I tried modifying that script in a similar manner as the spell, though it uses pop-up dialogue with buttons to confirm the procedure. I thought this is actually superior to the spell as it precludes the mistake of accidentally triggering the teleport with the confirmation dialogue:

 

 

ScriptName aamlfrostcragstoneScript

Short controlvar
Short button

Begin OnAdd
player.addspell aamlrecallspell
End

Begin OnDrop
player.removespell aamlrecallspell
End

Begin OnEquip
if player.GetInWorldspace Tamriel == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
elseif player.GetInWorldspace AnvilWorld == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
elseif player.GetInWorldspace AnvilCastleCourtyardWorld == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
elseif player.GetInWorldspace BravilWorld == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
elseif player.GetInWorldspace BrumaWorld == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
elseif player.GetInWorldspace CheydinhalWorld == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
elseif player.GetInWorldspace ChorrolWorld == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
elseif player.GetInWorldspace ICArboretumDistrict == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
elseif player.GetInWorldspace ICArenaDistrict == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
elseif player.GetInWorldspace ICElvenGardensDistrict == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
elseif player.GetInWorldspace ICImperialPalace == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
elseif player.GetInWorldspace ICImperialPrisonDistrict == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
elseif player.GetInWorldspace ICMarketDistrict == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
elseif player.GetInWorldspace ICTalosPlazaDistrict == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
elseif player.GetInWorldspace ICTheArcaneUniversity == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
elseif player.GetInWorldspace KvatchEast == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
elseif player.GetInWorldspace KvatchEntrance == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
elseif player.GetInWorldspace KvatchPlaza == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
elseif player.GetInWorldspace LeyawiinWorld == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
elseif player.GetInWorldspace PalePassWorld == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
elseif player.GetInWorldspace SkingradWorld == 1 && player.IsInCombat == 0
MessageBox "Return to Frostcrag Spire?", "Yes", "No"
else
Message "The Stone of Recall cannot be used here..."
endif
End

Begin MenuMode
Set button to GetButtonPressed
if player.GetInWorldspace Tamriel == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace Tamriel == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
elseif player.GetInWorldspace AnvilWorld == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace AnvilWorld == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
elseif player.GetInWorldspace AnvilCastleCourtyardWorld == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace AnvilCastleCourtyardWorld == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
elseif player.GetInWorldspace BravilWorld == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace BravilWorld == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
elseif player.GetInWorldspace BrumaWorld == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace BrumaWorld == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
elseif player.GetInWorldspace CheydinhalWorld == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace CheydinhalWorld == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
elseif player.GetInWorldspace ChorrolWorld == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace ChorrolWorld == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
elseif player.GetInWorldspace ICArboretumDistrict == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace ICArboretumDistrict == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
elseif player.GetInWorldspace ICArenaDistrict == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace ICArenaDistrict == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
elseif player.GetInWorldspace ICElvenGardensDistrict == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace ICElvenGardensDistrict == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
elseif player.GetInWorldspace ICImperialPalace == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace ICImperialPalace == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
elseif player.GetInWorldspace ICImperialPrisonDistrict == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace ICImperialPrisonDistrict == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
elseif player.GetInWorldspace ICMarketDistrict == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace ICMarketDistrict == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
elseif player.GetInWorldspace ICTalosPlazaDistrict == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace ICTalosPlazaDistrict == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
elseif player.GetInWorldspace ICTheArcaneUniversity == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace ICTheArcaneUniversity == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
elseif player.GetInWorldspace KvatchEast == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace KvatchEast == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
elseif player.GetInWorldspace KvatchEntrance == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace KvatchEntrance == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
elseif player.GetInWorldspace KvatchPlaza == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace KvatchPlaza == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
elseif player.GetInWorldspace LeyawiinWorld == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace LeyawiinWorld == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
elseif player.GetInWorldspace PalePassWorld == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace PalePassWorld == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
elseif player.GetInWorldspace SkingradWorld == 1 && player.IsInCombat == 0 && ( button == -1 )
Return
elseif player.GetInWorldspace SkingradWorld == 1 && player.IsInCombat == 0 && ( button == 0)
PlaySound SPLIllusionCast
player.MoveToMarker FCLivingAreaMarker02
EndIf
End

 

Unfortunately this will only work once, but the text in the upper left corner of the screen will say "This item cannot be equipped" or some such, even as the effect triggers and the loading screen takes the player to the dictated location. If it is used a second time, it causes a CTD...

 

I've been wracking my brain for hours and hours on end getting this changed out and I just can't figure it out. Anyone with more experience in the logic and flow side of scripts might be able to tell me what's going on?

Edited by DarkEra99
Link to comment
Share on other sites

OK, so apparently instead of chaining ElseIf statements, one can also use the || operator to create "or" comparisons, but now I'm stuck with the problem that the CS can't compile script lengths longer than 512 characters. This comparison will be very long, what with the various worldspaces I'm trying to plug into it...

Link to comment
Share on other sites

  • Recently Browsing   0 members

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