Scripts / Character movement

Author
Message
Gtox
3D Media Maker
9
Years of Service
User Offline
Joined: 5th Jun 2014
Location: South Africa
Posted: 2nd Aug 2014 11:21
I've been concentrating on modelling, so I haven't paid too much attention to scripting yet. What is the LUA command to get a character to move from Point A to Point B ( or just to move, not necessarily from point A to B)? I'm trying to test walking and running animations, so I'd like to create some scripts to get the character to move around. Also, can the movement speed be varied?
Gtox
3D Media Maker
9
Years of Service
User Offline
Joined: 5th Jun 2014
Location: South Africa
Posted: 2nd Aug 2014 13:41
I found the relevant commands in the 'LUA Scripting commands and structure' thread, but it's not working for me. I'm guessing that I've got the entity index wrong. With the script that I made, the entity is supposed to animate when you get within a certain distance, and then move. I also included a prompt ("working") so that I could see roughly what's happening. However, when I get within the required distance, the "working" prompt appears, but the animation only plays when leave the area.
Gtox
3D Media Maker
9
Years of Service
User Offline
Joined: 5th Jun 2014
Location: South Africa
Posted: 2nd Aug 2014 13:58
Never mind, got it working (sort of). I had IsImmobile set to 1. Unfortunately, changing it to 0 causes the entity to float a few metres up in the air. Also, is there a way to get the animation to play while the entity moves? At the moment, the character moves and then the animation plays.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 2nd Aug 2014 18:11
can u not tell reloaded it is a character - ischaracter = 1 - in the .fpe file
then use waypoints (the waypoint code can be found in the AI scripts) or AIEntityGoToPosition(e,x,z) to control it?

haven't got anything with animations to test this for you but otherwise maybe just telling it to move smaller distances would help?

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Gtox
3D Media Maker
9
Years of Service
User Offline
Joined: 5th Jun 2014
Location: South Africa
Posted: 2nd Aug 2014 19:09
Thanks Smallg. I've got the character to move and to animate - I'm now trying to get it animate whilst moving.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 2nd Aug 2014 19:22
here we go i tested it with a door and it works now



life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Gtox
3D Media Maker
9
Years of Service
User Offline
Joined: 5th Jun 2014
Location: South Africa
Posted: 2nd Aug 2014 23:52
Thank you very much, that worked a treat. You're an absolute star! One final thing (hopefully) - do you know how to increase the movement speed? I added a ModulateSpeed command (just before the MoveForward command), but that had no effect on the speed and also stopped the animation from playing.
Thanks again for your efforts.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 3rd Aug 2014 17:33
chsnge the value (10) here to something bigger to make it travel further
Quote: " MoveForward(e,10);"

to increase the animation speed use
Quote: "SetAnimationSpeed(e,v)"


life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Gtox
3D Media Maker
9
Years of Service
User Offline
Joined: 5th Jun 2014
Location: South Africa
Posted: 3rd Aug 2014 18:56
Worked perfectly - thank you very much, once again.

Login to post a reply

Server time is: 2024-05-03 07:58:14
Your offset time is: 2024-05-03 07:58:14