Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Product Chat / Problems with "aimovetotarget" and my first Dark AI script :(

Author
Message
KingMassen
1
Years of Service
User Offline
Joined: 23rd Dec 2016
Location:
Posted: 7th Aug 2017 22:27
Ok I inserted this small piece of code to make the enemy hunt the player when he is far, melee him when he's close (after setting him as target of course):




The problem is that the enemy detects the player and moves towards him but stops when it reaches a certain distance and just remains idle ,until the player moves: when the player moves closer ,the enemy character starts to melee-attack him and when it moves further, it keeps moving towards him again and stops again ... this works whether the target is the player or another character entity ....

Also, I realised that waypoints can't work with Dark AI ,it makes the character movement un-synchronised with animation or footstep sounds

I attached a low-quality 13 Mb video to the thread to show how it works ...


That's the whole script for the entity if you wanna check it out:

Note1: the script is not finished yet ,so you will find some commented out lines and it should be enough to make the enemy moves through waypoints and attacks an enemy when he sees one

Note2: Ignore that "aiss" variable



Here's the full code for the MAIN AI parameter:




Any help would be appreciated ... seriously

Attachments

Login to view attachments
KingMassen
1
Years of Service
User Offline
Joined: 23rd Dec 2016
Location:
Posted: 9th Aug 2017 17:38
I think the 'aimovetotarget' moves the character towards the target till it reaches a certain distance
xlghostlx
5
Years of Service
User Offline
Joined: 6th Dec 2012
Location:
Posted: 9th Aug 2017 19:16
Sry im so bad with scripting! Wait for MC he will help u easy
ncmako
6
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 11th Aug 2017 03:29
KingMassen This is a hard one You have a lot going on in this script, do you really need DarkAI for this?
I watched the video, yes I can see the problem. Easy fix if it weren't for the DarkAI, it doesn't like waypoints for one,
and some of the animations I think are for "custom" characters? It doesn't match stock NPC's.
Exactly which character are you using to attack the player with ?
My games never have bugs. They just develop random features..
Lots and lots of random features...
KingMassen
1
Years of Service
User Offline
Joined: 23rd Dec 2016
Location:
Posted: 13th Aug 2017 23:30 Edited at: 13th Aug 2017 23:31
I played with the script a little by adding an "airotatetotarget" and "runfore" and it worked very well ,thank you ,guys

It seems that Dark AI is primarily designed for shooting characters rather than melee ones
ncmako
6
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 15th Aug 2017 10:56
KingMassen I found an old script I made for enemies to hunt and search for the player with melee-attack.
It uses the regular commands, but works fairly well. The character even follows player up stairs without waypoints
when "locked" on player. Uses "melee-attack" but easily changed. Works best indoors (when walls are present)
and lots of obstacles to search around. Just make a simple room with stairs and some crates/boxes and use one of the
"Unarmed" characters like ww2 zombie?
My games never have bugs. They just develop random features..
Lots and lots of random features...

Attachments

Login to view attachments
KingMassen
1
Years of Service
User Offline
Joined: 23rd Dec 2016
Location:
Posted: 15th Aug 2017 18:05
Wait a minute ... but there is no pathfinding in regular AI ... it just heads towards the player .... even if you use followplr command ,what if I want the character to go to certain place? Or attack another NPC? All of this is nearly impossible without the Dark AI pathfinding ...
KingMassen
1
Years of Service
User Offline
Joined: 23rd Dec 2016
Location:
Posted: 15th Aug 2017 18:17
Also, why are you using raycast as an action? Isn't it supposed to be a condition to check for any entities/geometry around the character?
ncmako
6
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 15th Aug 2017 23:24
KingMassen
Quote: "but there is no pathfinding in regular AI "

Do you mean like "waypoints"? Yes, regular ai uses waypoints better than DarkAI.
It can easily be activated with "plrdistwithin" or "plrcanbeseen"..ect it's your choice.
Quote: "what if I want the character to go to certain place?"

Give the character first a "settargetname=x" & "settarget" then when activated "movetotarget=1"

Quote: "Or attack another NPC? "

Yes, most easily done with DarkAI, but with a clever script when another NPC is near, again "settartget" & "movetotarget"

Quote: "why are you using raycast as an action? "

It's not needed really in this script. I used it at first to help with checking around obstacles (boxes and such)... to help in finding a way around.
If you add to this line, when near walls or boxes the npc can turn or move away. But I deleted most of it and went with "pivotrandom"
Play with the "pivotrandom=25" settings. Npc uses that more to help find the player.
My games never have bugs. They just develop random features..
Lots and lots of random features...
KingMassen
1
Years of Service
User Offline
Joined: 23rd Dec 2016
Location:
Posted: 17th Aug 2017 05:00
The problem with "movetotarget" command is that it doesn't pathfind ,it just heads towards the target entity ,I tried it (maybe that's why they developed the Dark AI addon) ..

Also, the problem with waypoints is that I can't really use them for pathfinding lol you can't give a name or label to each waypoint path, you can't check whether the waypoints are near to player or not ...

Anyway, I got my melee script working ,it behaves really correctly ,thank u all for helping
Michael11
2
Years of Service
User Offline
Joined: 21st Jan 2016
Location: Russia
Posted: 8th Nov 2017 18:18
I using ModelPack 53 and I have this problem too...
BlackIceMod v10

Login to post a reply

Server time is: 2018-11-17 12:52:56
Your offset time is: 2018-11-17 12:52:56