Scripts / Need Some Help With Ai

Author
Message
Nevin
9
Years of Service
User Offline
Joined: 19th May 2015
Location: U.S.A
Posted: 14th Dec 2016 14:13 Edited at: 14th Dec 2016 14:16
Hello,

By default if you try and save your game in standalone, any ai walking on a waypoint NEXT to you will stop walking, so if you load your game, they will not follow the waypoints.

I thought this would be an easy fix, just put g_ on all the ai's variables and call it a day. That did not work. Edit: Might try g_ on the commends to

I could just not use waypoints, that will work. But for what i'm doing, I need to use waypoints to move ai, and can't have them walk random paths.

If I can't find a fix, I was thinking about trying to use placed objects for the paths, but really just wanted to find a fix for this. Did not want to have to make my own waypoints -_-
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 14th Dec 2016 15:16
Would be a good idea to provide the script or the name of it if its stock, also a video if possible - or few pictures (include the editor so we can see the waypoints).

Right now its not clear if you're referring to them stopping when you approach or if they are supposed to be starting the level near you and simply never move?
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Nevin
9
Years of Service
User Offline
Joined: 19th May 2015
Location: U.S.A
Posted: 14th Dec 2016 16:02
If you have a waypoint setup, ai will follow them points. All is good.

If you are in standalone. The ai still follows them points. All is good.

If you save in standalone and leave the game to the main menu, then load your game you just saved, whatever ai that was next to you ( on screen ), will not follow the waypoints. They will be stuck.
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 14th Dec 2016 18:22 Edited at: 14th Dec 2016 18:46
ah i see, because they are no longer near a waypoint node and so will be treated as having no path to follow.
edit; fixed for you, you were probably very close but you also need to make sure the values are not being overwritten when the init(e) is called after loading a game.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
Nevin
9
Years of Service
User Offline
Joined: 19th May 2015
Location: U.S.A
Posted: 14th Dec 2016 18:31 Edited at: 14th Dec 2016 18:38
Right! So, is it a good idea to say, mm if they cant find one, go home? would that work, they wont need a path to head to homepoint. I'll have to try to fix it sometime tonight or tomorrow. Just wanted to see if I could get away with someones fix for it

I have not played with pathfinding, I have added my on bits, but nothing that would interfere with the [ath finding part of the script
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 14th Dec 2016 18:48
see my edit, sounds like you know what you're doing when it comes to scripting so hopefully you can figure out how to fix your script from the changes i made to the original... if not let us know
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Nevin
9
Years of Service
User Offline
Joined: 19th May 2015
Location: U.S.A
Posted: 14th Dec 2016 19:42
This

if g_ai_soldier_pathindex[e] == nil then
g_ai_soldier_pathindex[e] = -1;
end

Duhh, this makes sense lol. Thanks so much!!
Nevin
9
Years of Service
User Offline
Joined: 19th May 2015
Location: U.S.A
Posted: 15th Dec 2016 22:49 Edited at: 15th Dec 2016 22:52
Okay, got it working today. First off, you helped a lot and thanks for that smallg, but one of the things I did to screw it up was

if g_ai_start_x[e] == nil then
g_ai_start_x[e] = g_Entity[e]['x']
g_ai_start_z[e] = g_Entity[e]['z']
AISetEntityControl(EntObjNo,AI_MANUAL);
end

This would have done the same thing I think, freeze the ai at some point.. B/c it's how it saves it's starting point! So I removed the g_ from ai_start(s), thanks to the script you gave. I fixed that and changed some other bits and it works great

Login to post a reply

Server time is: 2024-12-23 03:35:59
Your offset time is: 2024-12-23 03:35:59