Scripts / Using new AI commands

Author
Message
Gtox
3D Media Maker
10
Years of Service
User Offline
Joined: 5th Jun 2014
Location: South Africa
Posted: 19th Apr 2017 15:53
With the old system, I could move a character towards the player like this:

What is the equivalent way of doing this with the new AI? Being able to control speed with the new fpe speed setting is pretty useful, as there was a pretty low limit with speed with the old system.
Also, does the MoveWithAnimation function do anything?
i5 2500k 3GB GTX1060 8GB RAM Windows 10
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 19th Apr 2017 19:26 Edited at: 19th Apr 2017 19:28
you have to think of the characters as having 2 "bodies" now, 1 is the visual body the player sees (this is controlled with MoveForward etc) and the other is the physical body that is moved in the background by the engine to determine pathing and collision (this is controlled with the AI commands).

so firstly you move the AI (same as before still works fine).
then you move the visual body with MoveForward() etc (the actual speed value you use is best as the variable that returns the 'speed' setting in the properties, you can find this is the AI scripts).
then finally there's a new command to sync the 2 together (i can't remember exactly but again you can find it at the bottom of the ai modules)
if you look at the last page in my thread i have a few new AI scripts that will demo it better

MoveWithAnimation does work apparently though i've not got any models that need it so i'm not speaking from experience - however to use it you need a model that actually moves forward while animating (i.e. the model actually moves away from it's origin point while animating without any other input from GG, thinking about it i believe you actually have some fish that do it?)
i believe you use it like
MoveWithAnimation(e,animation_number)

sorry it's a bit vague but i dont have GG here but i know you're quite capable so i hope it helps
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Gtox
3D Media Maker
10
Years of Service
User Offline
Joined: 5th Jun 2014
Location: South Africa
Posted: 19th Apr 2017 20:27
OK, I misunderstood MoveWithAnimation, I thought it would be useful . I'll have a look at your thread.
i5 2500k 3GB GTX1060 8GB RAM Windows 10
Gtox
3D Media Maker
10
Years of Service
User Offline
Joined: 5th Jun 2014
Location: South Africa
Posted: 19th Apr 2017 20:52
So it seems to be working for me, using this code (if anyone's interested).


I'm still not convinced about the use for the MoveWIthAnimation command - to do what I did with the fish you just need to play the animation. To be able to move an entity while playing an animation using a single command would be much more useful.
Thanks for your help again, smallg.
i5 2500k 3GB GTX1060 8GB RAM Windows 10
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 20th Apr 2017 00:35 Edited at: 20th Apr 2017 00:40
the difference is that with the way Lee has it set up is that you could still avoid obstacles and such even with models that move during their animation whereas without it you will clip through obstacles and then port back to the "hidden" ai's position on looping the animation, so it is a nice feature if you have models that really must move with their animations.

you could always build the process in your script into 1 function/command and call it with the one line if you wanted anyway... something like this

MoveForwardWhileAnimating(e,g_PlayerPosX,g_PlayerPosZ,5) --call this line in your script (5 is the animation number to play)

then in the global have the function (or at the bottom -outside- of any scripts that need it)

untested but should work fine.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Gtox
3D Media Maker
10
Years of Service
User Offline
Joined: 5th Jun 2014
Location: South Africa
Posted: 20th Apr 2017 06:51
Yep, works fine. Another useful function, thanks.
i5 2500k 3GB GTX1060 8GB RAM Windows 10

Login to post a reply

Server time is: 2024-12-23 05:49:00
Your offset time is: 2024-12-23 05:49:00