Scripts / Player commands in lua?

Author
Message
Team wolf
7
Years of Service
User Offline
Joined: 26th Dec 2016
Location:
Posted: 18th Jan 2017 04:40
Are there any player commands in lua exept freeze unfreeze transport etc..
i want something like move speed,rotate player,move player etc have more control over the player like disabling the inputs and
move the player with lua.
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 18th Jan 2017 10:05
Those commands can be used to do just that.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Team wolf
7
Years of Service
User Offline
Joined: 26th Dec 2016
Location:
Posted: 18th Jan 2017 13:42
Mst of these are for the entityes i dont think the work on the player
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 18th Jan 2017 15:33
They sure do, bit of an extreme example but the second half of this video is entirely AI run using those very commands (no user input)
https://forum.game-guru.com/thread/207801?page=17#msg2563744
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Team wolf
7
Years of Service
User Offline
Joined: 26th Dec 2016
Location:
Posted: 18th Jan 2017 19:29
But how you do that?you cant tie a script to the player
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 18th Jan 2017 19:44
In third person you can, just add the script to the character then extract the character and attach it to the start marker.

Once you have a script you can take control of the player whenever you like that's how the moonlander demo works, I simply hide the player character whilst flying the LEM then show it again when landing and leaving the LEM. The script also takes care of the walking animation and triggers game events.
Been there, done that, got all the T-Shirts!
PM
Team wolf
7
Years of Service
User Offline
Joined: 26th Dec 2016
Location:
Posted: 24th Jan 2017 05:22
And how did he do that in first person mode?
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 24th Jan 2017 08:07
Check out the cutscene script.
Been there, done that, got all the T-Shirts!
PM
Mouaa
User Banned
Posted: 25th Jan 2017 12:22
@AmenMoses
Quote: "Once you have a script you can take control of the player whenever you like that's how the moonlander demo works, I simply hide the player character whilst flying the LEM then show it again when landing and leaving the LEM. The script also takes care of the walking animation and triggers game events."

Do you manage camera when you are in TPS character mode ? or do you use the default GG one ?

Quote: "Check out the cutscene script."

Where is this script ? I don't find it in Scriptbank folder ?

Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 25th Jan 2017 12:31
https://forum.game-guru.com/thread/216602#msg2562633

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
Mouaa
User Banned
Posted: 25th Jan 2017 13:30
Thanks.
But i don't understand where is the camera made or used inside all the code ?



Some basic explanation code about how is get the camera and how only mode and rotate it would be nice.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 25th Jan 2017 19:56


That's where the magic happens, because this runs every frame it effectively overrides any inputs from the player.
Been there, done that, got all the T-Shirts!
PM
Mouaa
User Banned
Posted: 25th Jan 2017 21:11
I thaught it was these

ResetPosition(e, cs.x, cs.y, cs.z)
ResetRotation(e, cs.tilt, cs.pan, 0)
TransportToIfUsed(e)

SetPlayerFOV(cs.fov)



Thanks AmenMoses.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 25th Jan 2017 21:39
That's a different way of doing the same thing which was required before Lee fixed things. The difference is that with one you need a separate entity which you move around and then transport the player to it whereas the other just moves the player directly.

Since the fixes both work equally well.
Been there, done that, got all the T-Shirts!
PM
Mouaa
User Banned
Posted: 26th Jan 2017 19:31
@AmenMoses
I have a level with the player FPS template, and i attached this little script to an entity on that level.
Why pressing Q qnd D keys doesn't overrides player FPS template inputs and moves the player on X axis ?


3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 26th Jan 2017 19:47

I can't see "g_KeyPressQ" in global, however I saw "g_KeyPressS = 0" twice.

Quote: "g_KeyPressS = 0
g_KeyPressS = 0"


3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 26th Jan 2017 19:59
Put a Prompt(Xmove) so you can check it is being called.

Been there, done that, got all the T-Shirts!
PM
Mouaa
User Banned
Posted: 26th Jan 2017 20:22 Edited at: 26th Jan 2017 20:31
I changed the script to that


Prompt command doesn't display anything when i run the game full screen.
g_KeyPressE should be recognized but nothing happens ?
Must script be attached to something special instead of an entity ?
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 26th Jan 2017 20:34 Edited at: 26th Jan 2017 20:36
Shouldn't that prompt be?:

Prompt( ""..Xmove )

Or is that just in the Text command?

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 26th Jan 2017 21:23
Check that the entity you have attached the script to is active.

.. simply appends one value to another so "Value=" .. val will append the string to the value of val as a string, if that makes sense.

When I first create a script I always place a Prompt or PromptLocal in there so I can be sure it is being executed.
Been there, done that, got all the T-Shirts!
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 26th Jan 2017 21:25
Quote: ".. simply appends one value to another so "Value=" .. val will append the string to the value of val as a string, if that makes sense."


Yup makes perfect sense, the .. denotes a new parameter, in the case of my line switching from prompting text to prompting a variable.

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 26th Jan 2017 21:31
I highly recommend getting the official Lua guide ISBN 978-85-903798-5-0.
Been there, done that, got all the T-Shirts!
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 26th Jan 2017 21:40
I have, I understand about 6 pages of it in total out of 366 lol

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 26th Jan 2017 21:53
I feel the same way about all the Blender books I have.
Been there, done that, got all the T-Shirts!
PM
Mouaa
User Banned
Posted: 26th Jan 2017 22:02
Quote: "Check that the entity you have attached the script to is active."

In properties, i have "Always Active ?" to YES.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 26th Jan 2017 22:09
And static = no?

And the script name is the same as the function names, I.,e. if you have a script called script.lua then the function names should be script_init and script_main?

If all that is fine and it still isn't running the script then I'm all out of ideas.
Been there, done that, got all the T-Shirts!
PM
Mouaa
User Banned
Posted: 26th Jan 2017 22:24 Edited at: 26th Jan 2017 22:46
Quote: "And static = no?"

Thanks for your help guys.

After testing, using that code the camera passes throught geometry, only collison on terrain ground is active, and player animations seems to be active and are playing with idle and walk.
Until GG becomes more flexible and allow full custom characters and code , i will stick with the FPS or TPS templates without weapons templates and using my own placed in front of player camera.
Mouaa
User Banned
Posted: 27th Jan 2017 10:33 Edited at: 27th Jan 2017 10:45
@AmenMoses
Is there a way to Unfreeze the player ?
Because using that sort of code , mouse look, directions move does not work because they override the FPS template.
And i would need the FPS template to return to normal idle,walk,run behaviour.



Does Player collision shape receive collision events when we use Freeze functions ?
For example if i use Freeze to climb a ladder, i would like ennemies to be able to fire at player while he is climbing.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 27th Jan 2017 15:14 Edited at: 27th Jan 2017 15:16
Just make the code conditional, as soon as you stop overriding the player goes back to normal.

Using this technique does mean you simply pass through objects because there is no collision feedback to Lua yet but you can still be shot at by AI.

When using this technique for cutscenes you can turn off the AI temporarily or add come conditional code to the AI scripts to stop them attacking the cutscene 'camera'.

The LEM demo cutscene script is my latest take on this sort of thing.
Been there, done that, got all the T-Shirts!
PM

Login to post a reply

Server time is: 2024-12-23 03:51:48
Your offset time is: 2024-12-23 03:51:48