Aller au contenu

Photo

Need help - two-way teleport crystal


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
Jaqstar

Jaqstar
  • Members
  • 4 messages
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

#2
The Amethyst Dragon

The Amethyst Dragon
  • Members
  • 1 880 messages
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...).

#3
FunkySwerve

FunkySwerve
  • Members
  • 1 308 messages
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

#4
Jaqstar

Jaqstar
  • Members
  • 4 messages
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

#5
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
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.