Author Topic: Teleport/Blink type script  (Read 328 times)

Legacy_Tyes

  • Newbie
  • *
  • Posts: 18
  • Karma: +0/-0
Teleport/Blink type script
« on: September 14, 2010, 03:38:47 pm »


               Hey everyone.
Looking for any potential assistance with my latest toolset dilemma.
I have been building a module for a few people, that has been requested by them, and one of the most commonly used scripts needed by players seems to be misfiring.
I'm no scripter myself, and I can't even remember how I had the original script set up, but any help would be appreciated.
The script is meant to be a blink/teleportation type script, and by using the item it is activated from, it will send the user to that spot, much like the dm quick jump. The issue I was having before was that it only ran on the last instance of the item spawned, and none of the others. I would like it to run from each item without an issue. I believe it's possible... I just have no idea how to do it myself.

Here is the script as it currently is, being run from the module onactivateitem event script.

object oStone = GetObjectByTag(br_blink);
object oActivated = GetItemActivated();
object oUser = OBJECT_SELF;

           if (oActivated == oStone)
       {
           vector vVector = GetPosition(oUser);
           float fZ = GetFacing(oUser);
           location lLocat = GetItemActivatedTargetLocation();
           vector vVectorb = GetPositionFromLocation(lLocat);
           object oArea = GetArea(oUser);
           location lBlink = Location(oArea, vVectorb, fZ);
           effect eVis = EffectVisualEffect(VFX_IMP_PULSE_HOLY);
           ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oUser);
           AssignCommand(oUser, JumpToLocation(lBlink));
       }
               
               

               
            

Legacy_Invisig0th

  • Sr. Member
  • ****
  • Posts: 279
  • Karma: +0/-0
Teleport/Blink type script
« Reply #1 on: September 14, 2010, 04:31:25 pm »


               Remove the first line (object oStone = ....) and change this:

   if (oActivated == oStone)

To this:

   if (GetTag(oActivated) == "br_blink")

GetObjectByTag() isn't useful here. In cases where there are multiple objects with that same tag, it just grabs the first one it finds -- which often is not the one you wanted.

Hope this helps!
               
               

               


                     Modifié par Invisig0th, 14 septembre 2010 - 03:34 .
                     
                  


            

Legacy_Tyes

  • Newbie
  • *
  • Posts: 18
  • Karma: +0/-0
Teleport/Blink type script
« Reply #2 on: September 14, 2010, 09:31:57 pm »


               Thanks, that was just the ticket, works like a charm now. '<img'>