teleporting people from a specific spot

Moderator: Event DM

Post Reply
User avatar
JollyOrc
Elder Sage
Posts: 3984
Joined: Fri Jan 17, 2003 11:41 am
Timezone: Europe, CE(S)T
Location: Germany
Contact:

teleporting people from a specific spot

Post by JollyOrc » Thu May 22, 2003 9:08 am

Hi!

Scenario:

1) Person A pulls a lever

2) Whichever person standing on a special spot (eg a trapdoor) gets then teleported to a waypoint.

I guess it won't work with area transitions.

How do I do that ?
User avatar
Lafferty
Scholar
Posts: 1129
Joined: Tue Feb 11, 2003 5:08 pm
Location: look at my hands... they are HUGE. And they cant touch themselves...
Contact:

Post by Lafferty » Thu May 22, 2003 12:33 pm

Is the person pulling the chain (or whatever) the person that should be teleported or is the person to be teleported a different one?

If the person to be teleported is the same as the USER of a lever (or whatever) then its easy... im at work currently but i can send it to you later

If the person to be teleported should exclusively be determined by its position (like a platform) then what should happen if several persons are on that platform?
Tool for crafters Do you want some human to your salt? nomanisanisland.monolar.de
User avatar
Liartes
Sage
Posts: 2155
Joined: Mon Feb 24, 2003 6:19 am
Location: Arizona, USA (GMT -7)

Post by Liartes » Thu May 22, 2003 12:43 pm

I'm no scripter, but when multiple people are in the 'spot', give the last person that crossed over that 'spot's threshold a variable that states they are the one that gets to be teleported. The others would then have to walk off of it and then back on, taking turns.
User avatar
JollyOrc
Elder Sage
Posts: 3984
Joined: Fri Jan 17, 2003 11:41 am
Timezone: Europe, CE(S)T
Location: Germany
Contact:

Post by JollyOrc » Thu May 22, 2003 12:44 pm

I figured out by now how to teleport the operating PC (yes, that was easy), but I wanted to teleport another person than the user of the lever.

It should be a rather small platform, and due to the setting this happens in, it is nearly 100% certain that there is only one person on the specified spot.

The person to be teleported should be willing, so having to kludge it by giving it a special item that will be checked is acceptable, but unelegant.

If there are several persons....

..most consistent would be if they all get teleported, but I fear that this will be too complicated.
User avatar
Sindol
Team Member; Retired with Honors
Posts: 6479
Joined: Mon Jan 06, 2003 4:23 pm
Location: Nijmegen - Netherlands (GMT+1)
Contact:

Post by Sindol » Sat May 24, 2003 11:15 am

I don't know much about scripting, but if you could make the teleport origin a seperate area, you should be able to teleport everyone in that area, thus eliminating your targetting problem.

Might not be exactly what you want, but maybe it is worth keeping in mind anyway.
So much fun,
yet so little time to enjoy it.
- Sindol
Myk D'vor
Lord of Blithering Idiots
Posts: 111
Joined: Mon Feb 24, 2003 9:05 am

Post by Myk D'vor » Sun Jun 15, 2003 7:35 pm

This will take all PCs within 2 meters of the object with the tag "My_pressure_plate_tag" and teleport them to the waypoint with the tag "My_destination_waypoint". There should be some error checking done, and perhaps special effects added, but this is the gist of it.

Code: Select all

void main()
{
  object PressurePlate = GetObjectByTag("My_pressure_plate_tag");
  location lPlate = GetLocation(PressurePlate);
  object Destination = GetWaypointByTag("My_destination_waypoint");
  location lDest = GetLocation(Destination);
  int i = 1; //nth closest starts with 1
  float fDis = 0.0f;
  object obj;

  do
  {
    obj = GetNearestCreatureToLocation(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, lPlate, i);
    fDis = GetDistanceBetween(obj,PressurePlate);
    i++;
    if(GetIsObjectValid(obj) && fDis < 2.0) AssignCommand(obj,ActionJumpToLocation(lDest));
  } while(GetIsObjectValid(obj) && fDis < 2.0 && i<50);
}
Myk
User avatar
JollyOrc
Elder Sage
Posts: 3984
Joined: Fri Jan 17, 2003 11:41 am
Timezone: Europe, CE(S)T
Location: Germany
Contact:

Post by JollyOrc » Sun Jun 15, 2003 9:20 pm

ah... learned a new trick...

mmh... "GetNearestCreatureToLocation" how do they come up with these ideas....
Myk D'vor
Lord of Blithering Idiots
Posts: 111
Joined: Mon Feb 24, 2003 9:05 am

Post by Myk D'vor » Mon Jun 16, 2003 3:04 am

The NWN Scripting Lexicon

I swear by it.

Myk
Post Reply