Scripts / A friendly AI script?

Author
Message
Beretta
9
Years of Service
User Offline
Joined: 8th Apr 2015
Location: United Kingdom
Posted: 8th Apr 2015 23:46
Hi,

Is there already a script that makes a AI character friendly?

I basically want to have a friendly soldier that can stay and follow using the use key.

Thanks.
HarlsonRS
9
Years of Service
User Offline
Joined: 2nd Apr 2015
Location: Berlin, Germany
Posted: 9th Apr 2015 00:44 Edited at: 9th Apr 2015 00:45
that has been asked like twice per day... i am sure if you just scroll down a bit, you will find a similar question...and the answer is: yeano... there is a way to make an NPC follow you, but he won´t fight with you, he´ll act more like a pet that does nothing

well, not YET at least, afaik the devs are working on stuff like "friendly/neutral/enemy" things....
PM
Beretta
9
Years of Service
User Offline
Joined: 8th Apr 2015
Location: United Kingdom
Posted: 9th Apr 2015 02:19
Well i had a quick browse before posting but didn't find anything, nonetheless, thanks for the reply
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 9th Apr 2015 07:57 Edited at: 9th Apr 2015 07:58
Beretta wrote: "Is there already a script that makes a AI character friendly?"

Go here to find more about ally and enemy:
https://forum.game-guru.com/thread/207801?page=5
Smile today, tomorrow could be worse

http://bestradiolarry.ro/fpsarea/

"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 9th Apr 2015 11:39
as Harlson says it's more of a pet than anything but here you go
pet.lua


life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 9th Apr 2015 15:51
Thank you. I know its not what they were looking for completely, but it does show the power of the scripting.
I need to browse thru the script board more.
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

3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 9th Apr 2015 18:14
Quote: "I need to browse thru the script board more."

Then you will know the power of smallg's scripts.

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

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

PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 9th Apr 2015 18:15
I already know the power he as shown, I need to learn it for myself, just so much that can be done.
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

Beretta
9
Years of Service
User Offline
Joined: 8th Apr 2015
Location: United Kingdom
Posted: 9th Apr 2015 19:21
@smallg Thanks
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 26th May 2015 18:58
wow this is great! thank you! is there also a way to make the AI follow without havig to trigger it?
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 26th May 2015 21:18
change the original state to follow should be enough

Quote: "function pet_init(e)
state[e] = "follow"
CharacterControlUnarmed(e)
end --init"
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 27th May 2015 13:10
thanks for being so fast can you tell me in wich line i have to change the script? only once in the script? sorry, i totally have no idea how this is working, i'm really stupid when it comes to coding.
i always have to rely on the patience of other people
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 27th May 2015 15:11
just look for the part i quoted above and you'll see it's slightly different (near the start/top of the script in the init(e) part)
state[e] = "stay"
becomes
state[e] = "follow"

life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 27th May 2015 18:07
ok, i think i got it now. i'm about to try it now...
i get "No function called ai_pet_main"
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 27th May 2015 22:27
its called pet.lua not ai_pet.lua
if you want to change the name you need to edit the function names too
function pet_init(e)
etc
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 27th May 2015 23:13
ah that was my mistake. i renamed it "pet.lua", game starts without error message and now when i go to the character there appears "stay?" when i press E there is "follow?". when i press E again there is "stay?" again but the AI does not follow me??

http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 28th May 2015 10:44
@ nuncio
You've to modify most lines than just "state[e] = stay", since this does no exist into the script, so the if statment does not accomplish.
In another word, when you said; If state[e] = "stay" then, this never go it, due to, state[e] = "stay" does not exists.
Sorry not a home now, can not give you a most elaborate answer.

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

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

PM
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 28th May 2015 12:05
^^thanks! sound logic but i think i'll give it up. coding totally does not work here. i don't get a single code working not even when you tell me what to write. i just copy the scripts that are posted here and i do what you tell me to do but somehow i'm doing it wrong.^
i mean smallg wrote a script and in the video you do see it work. i copied every line, copied the whole process and when i start it it doesn't work.
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 28th May 2015 16:19
Well, normally I do not want to give any script if I can not test it first.
I use firts smallg pet.lua script above.
Attached it to combat soldier, and ran it, and it work ok.
So, I notice the soldier should be facetting to the player to work.
Then try adding "LookAtPlayer(e)"



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

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

PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 28th May 2015 18:25
Quote: "^^thanks! sound logic but i think i'll give it up. coding totally does not work here. i don't get a single code working not even when you tell me what to write. i just copy the scripts that are posted here and i do what you tell me to do but somehow i'm doing it wrong.^
i mean smallg wrote a script and in the video you do see it work. i copied every line, copied the whole process and when i start it it doesn't work."


which character are you using out of interest? did you place him on the normal terrain?
my script works fine for me, with the second version they run up to find me if i place them a short distance away from me without me needing to do anything
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 28th May 2015 19:31
i did this with a custom character and he is standing on a paving slab 400x400 from the scenery folder. i will just try it on a blank terrain with a stock character!
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 28th May 2015 19:46
ah!! i just found the problem. the script does work fine on any character including custom characters from the character editor but it does not really work on the paving slabs! when on the paving slabs (in a clear new map) the characters don't really follow me. they move and walk but they are not chasing me. i just made a picture of it: the two custom characters follow me, the terrorists on the pavement ignore me after i triggered them.
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti

Attachments

Login to view attachments
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 28th May 2015 19:50
does the paving slab already have forcesimpleobstacle = 3?
try adding that to the fpe file and replacing them with new ones... they might be too high though, i dont know where the cut off is - ai is currently only really designed for terrain or stuff which is pretty much flat to the terrain.
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 28th May 2015 19:57
this is strange... i remember that i changed this manually but when i looked it up it was missing. could this be because of an update that the file might have been replaced? i just added forcesimpleobstacle = 3 again and i will try again!
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 28th May 2015 20:04
now it's working. this is really strange i thought i had updated the fpe file with forcesimpleobstacle = 3 but obviously not. thank you for making it work for me
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 4th Jun 2015 09:05
When you use SetCharacterToRun and Walk I'm curious how it knows which animation cycle to use? Does it reference the CSI animations in the FPE?
i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce 420 GT
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 4th Jun 2015 21:46
Quote: "When you use SetCharacterToRun and Walk I'm curious how it knows which animation cycle to use? Does it reference the CSI animations in the FPE?"


Please take a look at Uber Soldier Animations.txt file.

C:\Program Files (x86)\Steam\steamapps\common\Game Guru\Files\characterkit\bodyandhead

and Uber Soldier.fpe (entities/characters) reference the CSI animations, even csi_swing

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

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

PM

Login to post a reply

Server time is: 2024-12-22 01:12:36
Your offset time is: 2024-12-22 01:12:36