Product Chat / I found an easy way to make neutral enemies that follow you.

Author
Message
JeliLiam
9
Years of Service
User Offline
Joined: 26th Feb 2015
Playing:
Posted: 23rd Mar 2015 18:08
Hi there! As of right now there is no official way to make Ai friendly or neutral as far as i know. But there is a workaround.

Note that these npc's can not fight for you they will just follow you around.


So in order to do this you must spawn the character you desire. Then go to it's properties.


From there change the script to ai_zombiewalk.lua


Because the normal enemies have no zombie attack they will just follow you and do nothing. An easy way to make nuetral NPC's that follow you around!

You can also set them to be immobile making using them as background characters
FX 6300- R9 280X 3GB - 8 gig corsair vengeance
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 23rd Mar 2015 18:15
Nice work around, did you try the AI_neutral script yet?
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

JeliLiam
9
Years of Service
User Offline
Joined: 26th Feb 2015
Playing:
Posted: 23rd Mar 2015 18:17
@Pirate Myke

Yes, however with that they don't follow you around.

Now just to hope we can get a friendly script that attacks other enemies !
FX 6300- R9 280X 3GB - 8 gig corsair vengeance
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 23rd Mar 2015 18:22
It is all coming together. that ai_Neutral, must be for way point use then. I will have to open it and see, how it is constructed.
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

JeliLiam
9
Years of Service
User Offline
Joined: 26th Feb 2015
Playing:
Posted: 23rd Mar 2015 18:26
@Pirate Myke

Yeh they just stand around looking annoyed.

I used it to add a little humor to my game by making them stand in a long line to a toilet stall .

FX 6300- R9 280X 3GB - 8 gig corsair vengeance
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 23rd Mar 2015 18:27 Edited at: 23rd Mar 2015 18:32
what if i want zombie pets?

it's pretty simple to get the AI to follow you though
follow_player.lua

edit: stopped zombies from trying to attack - guess their animation is hard coded for some reason

nope ai_neutral is just for them to stand and look at you - shop keeper style
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
GoDevils
10
Years of Service
User Offline
Joined: 24th Sep 2014
Location: Arizona USA
Posted: 24th Mar 2015 04:51
Hi smallg

Every time I look at your code I learn something.

Could you explain the use of lines 14 and 16? I can't find any reference to AIEntityGoToPosition() or AIEntityStop(), in global.lua ??

Thanks smallg
Go Devils

"THERE IS NO SPOON"

AMD 6300 6 core 3.5 ghz, Windows 8.1, 8GB ram, GTX 650 2GB ram
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 24th Mar 2015 15:31 Edited at: 24th Mar 2015 15:32
Quote: "Could you explain the use of lines 14 and 16? I can't find any reference to AIEntityGoToPosition() or AIEntityStop(), in global.lua ??"


these are taken from the stock ai scripts
the name's are pretty good indication of what they do - first tells an object to go to a co-ordinate (x and z only but characters follow terrain by default so no need for y) and the second tells them to stop moving.
you need to use g_Entity[e]['obj'] rather than 'e' when using the commands though.

so in my case i tell them to go to the player's position and stop once they get near
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
tomjscott
User Banned
Posted: 24th Mar 2015 16:30
I had a custom NPC follow you around and fight for you as well in Rescue the Princess. It was an imp pet.
System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.0085
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 25th Mar 2015 00:09
It's the power of LUA commands - and with every new one added, the possibilities multiply
PC SPECS: Windows 7 Ultimate 64-bit, Intel Core i7 920 (PASSMARK:5008), NVIDIA Geforce 9600 GT GPU (PASSMARK:752) , 6GB RAM

GoDevils
10
Years of Service
User Offline
Joined: 24th Sep 2014
Location: Arizona USA
Posted: 25th Mar 2015 15:54
Thanks smallg...

I've just completed an entity movement script (for cars and trains) not using any AI commands. The script lets me pre-program up to ten steps the entity will perform (move to point, turn left, go to next intersection, wait for a specific time, and eventually return to beginning).

I've used it with characters, but I want to get to know how to use the AI system which I still do not fully understand. You've given me a place to start.

Thanks again
"THERE IS NO SPOON"

AMD 6300 6 core 3.5 ghz, Windows 8.1, 8GB ram, GTX 650 2GB ram

Login to post a reply

Server time is: 2024-11-23 07:40:36
Your offset time is: 2024-11-23 07:40:36