Help with your scripting

Teleport script

Teleport script

Postby epsilonion » 12 Sep 2015, 21:55

I have been trying to help a mate get a teleport script working.

when the player enters a trigger box it should set the position of the player entity to x,y,z but does not want to play nice.
The position of x,y,z is taken from a entity in the scene (a tall cube) called "destination" tag "spawn1".

entity.setPosition( entity.getIDFromTag("Player"), x, y, z ); moves a cube but will not move the a player..


I have tried with the fpsSystem.setPosition(entity.getIDFromTag("Player"), x, y, z); hook but that just crashes skyline and in the api states that its for respawning after a KO.

scene and lua file.
teleport.zip
Teleport scene and lua files
(25.35 KiB) Downloaded 407 times


User avatar
epsilonion
Skyline Lead Moderator
Skyline Lead Moderator
 
Posts: 874
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative

Re: Teleport script

Postby SolarPortal » 12 Sep 2015, 22:31

i used this code and the FPS character moved to this location without any problems:

FPS Player tag = "Player"
Teleport location tag = "tag_s"

Code: Select all
function onKeyDown( key )
   if(key == "3")then
      x,y,z = entity.getPosition(entity.getIDFromTag("tag_s"));
      fpsSystem.setPosition(entity.getIDFromTag("Player"), x,y+2.0,z);
      sky.print("3 pressed")
   end
end


entity.setPostion will not work as it is for non physics based objects only.
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Teleport script

Postby epsilonion » 12 Sep 2015, 22:52

everytime I used the fpsSystem.setPosition it crashed on me lol.. :D
User avatar
epsilonion
Skyline Lead Moderator
Skyline Lead Moderator
 
Posts: 874
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative

Re: Teleport script

Postby SolarPortal » 12 Sep 2015, 23:21

i am wondering if the read access is having problems as this is another strange error crash.

I downloaded and tried your scene and replaced the line with:
Code: Select all
fpsSystem.setPosition(entity.getIDFromTag("Player"), x,y,z);


and again it worked fine. I am not sure what is causing this.

Q) Does this happen for anyone else in the community?

What you are doing with skyline is becoming more advanced and you will soon be programming full games ;)
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Teleport script

Postby epsilonion » 13 Sep 2015, 00:18

I think I need to reinstall its started with the errors when loading in scenes that should be hidden etc again no idea why..
Just bloody got all my models imported as well lol... :D

I am slowly working on an inventory as well and will be getting it working with the GUI system when I work it all out lol..
Oh on this note, while I remember... is there a hook for loading in textures? basically an example below for when inventory items are loaded in and a texture can be passed to the GUI for display etc.. etc..


item.name = "axe"
Item.texture = "textures/sample.jpg"
item.description = "hurts when hit with, cut trees to make wood"
item.strength = 80
item.damage = 30
User avatar
epsilonion
Skyline Lead Moderator
Skyline Lead Moderator
 
Posts: 874
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative

Re: Teleport script

Postby SolarPortal » 13 Sep 2015, 00:42

Just bloody got all my models imported as well lol... :D

If you back up your asset library to another location, then you shouldn't lose anything. When reinstalled simply add the assets you require again :)

I am slowly working on an inventory as well and will be getting it working with the GUI system when I work it all out lol..
Oh on this note, while I remember... is there a hook for loading in textures? basically an example below for when inventory items are loaded in and a texture can be passed to the GUI for display etc.. etc..

I am turning off now to rest ... all robot slaves to the machine need rest lol :P oh well, i shall test and see what you are after tomorrow and get back to you on this.

:D
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer


Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 3 guests

cron