Author Topic: Need help - two-way teleport crystal  (Read 413 times)

Legacy_Jaqstar

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
Need help - two-way teleport crystal
« on: November 07, 2010, 07:35:04 pm »


               Hey

I'm currently making a small module and want my players to utilise a crystal that enables them to teleport either to the "North Pole" or to the "South Pole".

I've been able to make my crystal use the "Cast spell: Unique power self" and then in the modules "OnActivateItem" place a script like the following:

if(GetTag(oActivated) == "Crystal")
    {
        object oTarget = GetWaypointByTag ("wp_tele_NorthPole");
        ApplyEffectToObject (DURATION_TYPE_INSTANT, EffectVisualEffect (VFX_DUR_GLOBE_INVULNERABILITY), oPC);
        AssignCommand (oPC,ActionJumpToObject(oTarget, FALSE));
    }

But my problem is to figure out how to let the item teleport the player to more than one location...
My crystal needs to give the player two options: Go to the North Pole or go the South Pole.

Do I need to put some kind of dialogue into the item or can I in some way add another  "Cast spell: Unique power self" on the item which is different from the first.

Please help me with some coding tips or post the code if you already have a script that does what I need.

Cheers,
Jaq
               
               

               
            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
Need help - two-way teleport crystal
« Reply #1 on: November 07, 2010, 07:57:22 pm »


               You could use any number of methods to set a local integer on the crystal itself to determine where it sends the user.

Let's say 1 (or almost anything else, since this could be the default) is for the north pole, 2 is for the south pole.

location lPole = GetLocation(GetWaypointByTag("wp_tele_NorthPole"));
int nStoredPole = GetLocalInt(oActivated, "destinationpole");
if (nStoredPole == 2)
   {
   lPole = GetLocation(GetWaypointByTag("wp_tele_SouthPole"));
   }
ApplyEffectToObject (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_DUR_GLOBE_INVULNERABILITY), oPC);
AssignCommand (oPC, JumpToLocation(lPole));

Using a stored integer, you could assign the destination through a conversation, through another scripted event, or even by using the crystal (perhaps having the crystal send the user the the north pole, then the south pole the next time it's used, the the north pole the next time...).
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Need help - two-way teleport crystal
« Reply #2 on: November 07, 2010, 07:57:24 pm »


               You can't add another Unique power - they'd both fire the same script, so there's no point. You CAN add a spell as well as a unique power, and modify the spell script to do something different. Or, you can simply have the crystal initiate a dialogue and give the player options for both north and south pole in that dialogue. Or, you can combine approaches, having a spell do the teleport (You'd have to edit the spell script, checking for GetSpellCastItem(), and comparing resrefs to make sure it's the crystal casting), while the unique power toggles between the two destinations, either by means of the unique power script setting a var on the crystal that is checked in the edited spell, or by means of setting such a variable in a conversation. If you're looking for simplicity, I would just have the item start a convo, and do everything from there.



Funky
               
               

               
            

Legacy_Jaqstar

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
Need help - two-way teleport crystal
« Reply #3 on: November 07, 2010, 08:20:35 pm »


               Thanks a bunch.

I'll let my item start a conversation and figure out how to teleport to the different locations through the dialogue.



Jaq
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Need help - two-way teleport crystal
« Reply #4 on: November 07, 2010, 08:25:48 pm »


               My thought is a little different.  Since the Item only goes to two different places, you could just have the item spawn in two different portholes. One called Notth Pole and the other called South Pole. Then let the player decide wich porthole he steps into.