Teleport Script
#1
Hi

What is wrong in this script ?

Код:
Script #Teleport1
(
 if
 (
   IsEqual( GetLeverState(GetObject(1918)) , 1 )  //  object to use to open teleport
 )
 then
 (
   KillScript(  )
   CreateParticleSource( 7, 142.8, 38.7, 1.5, 0.75, "Portal" )  //  teleport animation
 )
)

Script #Teleport2
(
 if
 (
   IsLess( GetX( this ) , 135.6 )
   IsLess( GetY( this ) , 30.39 )
   IsGreater( GetX( this ) , 150.91 )
   IsGreater( GetY( this ) , 45.83 )
   IsEqual( GetLeverState(GetObject(1918)) , 1 )
 )
 then
 (
   KillScript(  )
   SwitchLeverState(GetObject(1918), 0 )
   CreateParticleSource( GetObjectId( this ), GetX( this ), GetY( this ), GetZValue( GetX( this ), GetY( this ) ), 1, "Teleport" )
   CreateFX( GetX( this ) , GetY( this ) , GetZValue( GetX( this ), GetY( this ) ), 15, 30, "Toolszombi.wav" )
   CreateParticleSource( GetObjectId( GetObject(999451) ), GetX( GetObject(999451) ), GetY( GetObject(999451) ), GetZValue( GetX( GetObject(999451) ), GetY( GetObject(999451) ) ), -1, "Teleport" )
   CreateFX( GetX( GetObject(999451) ) , GetY( GetObject(999451) ) , GetZValue( GetX( GetObject(999451) ), GetY( GetObject(999451) ) ), 15, 30, "magicTeleportstart.wav" )
   Sleep( 15 )
   SetCP( this, GetX( GetObject(999451) ) , GetY( GetObject(999451) ) , 0 )
   ConsoleString("tp2 - Ok")
 )
)

i need teleport to object 999451 location when i enter place:
Код:
  (
   IsLess( GetX( this ) , 135.6 )
   IsLess( GetY( this ) , 30.39 )
   IsGreater( GetX( this ) , 150.91 )
   IsGreater( GetY( this ) , 45.83 )
   IsEqual( GetLeverState(GetObject(1918)) , 1 )
 )

can you tell me what is wrong in this scrip that it's not working ?
i look into one of ei-mod .mob file and i copied the teleport scrip from them and it's not working in my map :/

plz help
Ответ
#2
How do you execute this script? Where are your functions called from? What are you passing to #Teleport2 function as an argument?

And first of all, check your script on syntax. Add a ConsoleString() command to WorldScript(), and look at the console in the game. If the syntax is wrong, there would be no string in the console, and if it's right, the passed string should be printed.
Duty is everything, the greatest of joys, the deepest of sorrows.
Ответ
#3
I use MobSurgeon v.0.3.7.16

My map script :

Код:
GlobalVars (
 NULL : object,
 VSS#i#val : object,
 i : object
)

DeclareScript VTriger#2#1 (  this : object )
DeclareScript #Teleport1 (  this : object )
DeclareScript #Teleport2 (  this : object )
DeclareScript VTriger#2#2 (  this : object )

Script VTriger#2#1
(
 if
 (
 )
 then
 (
   KillScript(  )
   QStart( "z31q1" )
   QObjSeeUnit( "GetObject(1000324)" )
   QObjKillUnit( "GetObject(1000324)" )
   QFinish(  )
   ConsoleString("Mission - Work")
 )
)

Script #Teleport1
(
if
(
  IsEqual( GetLeverState(GetObject(1918)) , 1 )  //  object to use to open teleport
)
then
(
  KillScript(  )
  CreateParticleSource( 7, 142.8, 38.7, 1.5, 0.75, "Portal" )  //  teleport animation
  ConsoleString("Object - Work")
)
)

Script #Teleport2
(
if
(
  IsLess( GetX( this ) , 135.6 )
  IsLess( GetY( this ) , 30.39 )
  IsGreater( GetX( this ) , 150.91 )
  IsGreater( GetY( this ) , 45.83 )
  IsEqual( GetLeverState(GetObject(1918)) , 1 )
)
then
(
  KillScript(  )
  SwitchLeverState(GetObject(1918), 0 )
  CreateParticleSource( GetObjectId( this ), GetX( this ), GetY( this ), GetZValue( GetX( this ), GetY( this ) ), 1, "Teleport" )
  CreateFX( GetX( this ) , GetY( this ) , GetZValue( GetX( this ), GetY( this ) ), 15, 30, "Toolszombi.wav" )
  CreateParticleSource( GetObjectId( GetObject(999451) ), GetX( GetObject(999451) ), GetY( GetObject(999451) ), GetZValue( GetX( GetObject(999451) ), GetY( GetObject(999451) ) ), -1, "Teleport" )
  CreateFX( GetX( GetObject(999451) ) , GetY( GetObject(999451) ) , GetZValue( GetX( GetObject(999451) ), GetY( GetObject(999451) ) ), 15, 30, "magicTeleportstart.wav" )
  Sleep( 15 )
  SetCP( this, GetX( GetObject(999451) ) , GetY( GetObject(999451) ) , 0 )
  ConsoleString("Teleport - Work")
)
)

Script VTriger#2#2
(
 if
 (
 )
 then
 (
   KillScript(  )
   ActivateTrap( Pyramid, 0 )
 )
)

WorldScript
(
 Sleep( 2 )
 VTriger#2#1( NULL )
 #Teleport1( NULL )
 #Teleport2( NULL )
 VTriger#2#2( NULL )
 ConsoleString("WorldScript - Work")
)

and
world script is working
mission script is working
object script is working

only teleport isn't working(i enter good place)

and i don't know what i need to add/modify in script

can you open my eyes plz Smile


Файлы вложений Эскизы(ов)
   
Ответ
#4
#Teleport2 function is meant to get an argument when it is called. For example, you could write #Teleport2(GetLeader()) - then it would call function #Teleport2 with the Leader (aka Hero) as it's argument, so in the function's body "this" will be assumed as "Hero".

Calling #Teleport2(NULL) teleports a NULL-object somewhere, but NULL object is virtual, so you won't see anything changing. You should pass something to the #Teleport2 func.

If you want to teleport somebody, who had just switched the lever, you should call #Teleport2 in the #Teleport1 func, but you should get a target-object first. For example, you could determine who is near the Lever and teleport them all.
Duty is everything, the greatest of joys, the deepest of sorrows.
Ответ
#5
Thank you for help!
Teleport is working Smile)

i wrote simple script due to your help:

Код:
DeclareScript #TeleportTarget (  this : object )

(...)

Script #TeleportTarget
(
 if
 (
 )
 then
 (
   KillScript(  )
   For( VSS#i#val, Heroes )
   (
     #Teleport2( VSS#i#val )
     ConsoleString("Target - Work")
   )
 )
)

(...)
WorldScript
(
Sleep( 2 )
#TeleportTarget( NULL )
)

thanks for help ALtair Smile)
all is working great Smile
Ответ
#6
Hi

Telepor is working ...
but now, another problem, this teleport is working only for server admin, not for other players, maybe u know why ?
Can u help me second time ? Smile

Script:
Код:
GlobalVars (
NULL : object,
VSS#i#val : object,
i : object,
Heroes : group
)

DeclareScript VTriger#2#1 (  this : object )
DeclareScript #Teleport1 (  this : object )
DeclareScript #TeleportTarget (  this : object )
DeclareScript #Teleport2 (  this : object )

Script VTriger#2#1
(
if
(
)
then
(
  KillScript(  )
  QStart( "z31q1" )
  QObjSeeUnit( "GetObject(1000324)" )
  QObjKillUnit( "GetObject(1000324)" )
  QFinish(  )
  ConsoleString("Mission - Work")
)
)

Script #Teleport1
(
if
(
 IsEqual( GetLeverState(GetObject(1918)) , 1 )  //  object to use to open teleport
)
then
(
 KillScript(  )
 CreateParticleSource( 1, 337.8, 233.8, 18, 0.5, "PortalStar" )
 CreateParticleSource( 2, 341.7, 233.7, 18, 0.5, "PortalStar" )
 CreateParticleSource( 3, 339.8, 235.5, 18, 0.5, "PortalStar" )
 CreateParticleSource( 4, 86.4, 193.6, 12.5, 0.5, "PortalStar" )
 CreateParticleSource( 5, 88.35, 195.5, 12.5, 0.5, "PortalStar" )
 CreateParticleSource( 6, 90.3, 193.5, 12.3, 0.5, "PortalStar" )
 CreateParticleSource( 7, 339.8, 233.7, 16.5, 0.75, "Portal" )
 ConsoleString("Object - Work")
)
)

Script #TeleportTarget
(
 if
 (
 )
 then
 (
   KillScript(  )
   For( VSS#i#val, Heroes )
   (
     #Teleport2( VSS#i#val )
     ConsoleString("Target - Work")
   )
 )
)

Script #Teleport2
(
if
(
 IsLess( GetX( this ) , 341.6 )
 IsLess( GetY( this ) , 235.39 )
 IsGreater( GetX( this ) , 337.91 )
 IsGreater( GetY( this ) , 231.83 )
 IsEqual( GetLeverState(GetObject(1918)) , 1 )
)
then
(
 KillScript(  )
 SwitchLeverState(GetObject(1918), 0 )
 CreateParticleSource( GetObjectId( this ), GetX( this ), GetY( this ), GetZValue( GetX( this ), GetY( this ) ), 1, "Teleport" )
 CreateFX( GetX( this ) , GetY( this ) , GetZValue( GetX( this ), GetY( this ) ), 15, 30, "Toolszombi.wav" )
 CreateParticleSource( GetObjectId( GetObject(999451) ), GetX( GetObject(999451) ), GetY( GetObject(999451) ), GetZValue( GetX( GetObject(999451) ), GetY( GetObject(999451) ) ), -1, "Teleport" )
 CreateFX( GetX( GetObject(999451) ) , GetY( GetObject(999451) ) , GetZValue( GetX( GetObject(999451) ), GetY( GetObject(999451) ) ), 15, 30, "magicTeleportstart.wav" )
 Sleep( 15 )
 SetCP( this, GetX( GetObject(999451) ) , GetY( GetObject(999451) ) , 0 )
 ConsoleString("Teleport - Work")
)
)

WorldScript
(
Sleep( 2 )
VTriger#2#1( NULL )
#Teleport1( NULL )
#TeleportTarget( NULL )
ConsoleString("WorldScript - Work")
)
Ответ
#7
You call #TeleportTarget as soon as level starts, so there are no other clients on the map at that moment. If you want to teleport the overall Heroes party on some event, write a script, which will contain event-handling. For example, if you want to teleport the party when somebody switches a lever, write a script, which would check lever state and call #TeleportTarget routine when the lever state changes.
Duty is everything, the greatest of joys, the deepest of sorrows.
Ответ
#8
You are great! Smile Smile

Thanks for help. Smile
Ответ


Перейти к форуму:


Пользователи, просматривающие эту тему: 1 Гость(ей)