Scripts / LUA : Player ID for player position...

Author
Message
Mariokiki
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 1st Dec 2015 00:11
I'm beginner with the LUA system and I don't know all the functions...


How can I force the player's position using the command "SetPosition(e,x,y,z)"

I replaced the X,Y,Z variables by g_PlayerPosX,g_PlayerPosY,g_PlayerPosZ but I don't know to replace "e" as the player ID.

I tried SetPosition(g_Player,g_PlayerPosX,g_PlayerPosY,g_PlayerPosZ) but there is an error message...

What is the solution ?

Thanks !
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 1st Dec 2015 09:55
You can't, the only way to move the player right now is with TransportToIfUsed(e) and then type the name of the object in the ifused field, this will cause the player to be set at the origin points of the object (so turn off collision for the object too)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
Mariokiki
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 1st Dec 2015 13:44
Too bad !

You mean we can know the ID of all objects exept the main player object ?

Even using something like "SetPosition(PLAYER_ID,X,Y,Z)"

Do you imagine all we could do with that ? Even in DarkBasic Pro this command exists... Bouhhh !!!! (crying !)

I will wait for Lee do an update...

Thanks anymore...
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 1st Dec 2015 16:17
A lot of the scripting commands are being added in for more functionality. If you feel that this would be a show stopper in your game, then email Lee@thegamecreators.com and let him know. Maybe he can get it added if it is a simple add.

Thanks.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

Mariokiki
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 1st Dec 2015 16:42
Good idea !

Thanks !
PM
Ratall
16
Years of Service
User Offline
Joined: 29th Jun 2008
Location: Not Here
Posted: 2nd Dec 2015 07:13 Edited at: 2nd Dec 2015 07:15
If you look at twitch 19 https://www.youtube.com/watch?v=0hyqHPQx6qQ&feature=youtu.be&t=3m16s

You will see moving an object and using TransportToIfUsed(e) to keep the player on it . If you use a dummy object move it to where you want to go and transport to it is should provide a work around for what you want..

The entity number is displayed at the bottom of the screen in the editor.
Or you could save it to a global in the init part of the target entiies script. Then set the name of the Target in the if used field of the trigger script.

so in a target called Destination you attach a script with say


in the trigger_zone you would set ifused= Destination

and in its main you would have something like



As for the target Object I think you could use a light with all the values set to zero so it does not glow.
its just an idea of the top of my head Have yet to try it .I also think you have to set the target(Destination) as immobile but not sure about that also you may need resetPosition instead of setposition on some target entities.

If you look at the twitch you will see what got me think this way.

though I may be completely wrong which will not be the first time.
THE GLACIER IN THE MOUNTAIN MUST MELT BEFORE THE RICE IN THE VALLEY CAN GROW.

CPU:i7-4720HQ Mem: 16G Graphic: GTX 980M 8G and intel HD4600 OS: Windows10
PM
Mariokiki
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 2nd Dec 2015 13:14
Thank you for this tip !

I tried the method "TransportToIfUsed(e)" last night with my character (seen at 3rd person).
This works well... but as soon as the character approaches the platform, he is glued in the middle of the platform
and he can't unglued from the platform anymore...

It's really easier using the view in the first person, but I would like to make a maze-like level with traps, platforms, moving walls, etc..

I will not lose hope to get there !

Thanks a lot !

PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 2nd Dec 2015 13:30
It just feels more natural for me to have the player (of the game) make sure the character stays on the platform but if you really wanted to make it automatic than as you already saw you need to be specific about when to call the function... Maybe a button to allow the player to move freely again or once the platform is at a certain point (this can be easily set using a variable as a toggle)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
Mariokiki
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 2nd Dec 2015 16:53
Sorry Smallg,

I react like when I use Dark Basic Pro...

I succeeded to make platforms with horizontal and vertical movements in DBPro. I realized my own collision engine...

It's for this reason I would like this command to place the player everywhere I want...
With this, I would use the same method (or same logical) than DBPro.
And after I have everything I need to finalise my level.

You already gave us your system for moving walls, traps, ect... I'll use them !
I like the view in first person in a game, but for more fun, I need 3rd person view for my level...

Many thanks for your help !
PS : I sent a request to Lee last night, I cross my fingers to have a positive answer !!!
PM

Login to post a reply

Server time is: 2024-12-22 06:40:51
Your offset time is: 2024-12-22 06:40:51