What is player's estatus?, how to make a Created 6 years ago2017-06-28 13:23:28 UTC by abbadon abbadon

Created 6 years ago2017-06-28 13:23:28 UTC by abbadon abbadon

Posted 6 years ago2017-06-29 09:24:52 UTC Post #335779
Hello!, here I am curling the curl again. Goofing with bot's code I start Thinking about how can I do so them, or a npc detects what the player's is doing or what Is its status; for example: I managed to make a npc detects how much ammo, or health, a player has, but, how can I make a npc knows if a certain command was executed (commands that can be executed vía console), and much more "curled" is how can I, once that command is detected, make the npc attacks what the player is attacking or to approach to the player's position, or to attack that player who has executed the command?
Posted 6 years ago2017-06-30 10:39:13 UTC Post #335824
The ClientCommand callback has the command that was called and I think which player - from that you should be able to get the player's position.
It's not so easy to get the monster that the player is attacking - at best you could probably get any monster in the player's field of view or a subset of the field of view.
I think one of Botman's bots has code to follow the player but I've never checked it out.
Posted 6 years ago2017-06-30 11:19:26 UTC Post #335825
Mmmm, do you have an example code? or point me to the right side, client or server. :)
Posted 6 years ago2017-07-06 09:21:06 UTC Post #335916
In the server code in the ClientCommand function is where you'd do the first bit.
The second bit you'd probably need to detect what monsters the player is attacking in some function that gets run every frame - probably StartFrame - and then do something with that in the monster AI, but I've never really played with monster AI so I'm not sure where you'd do that.
From memory Botman's Bot Number 10 has following but I've never used it.
Posted 6 years ago2017-07-06 10:21:12 UTC Post #335917
Ok. I´ll give it a try.

I have finally discarded the "attak-my-foe" part because it could be overkill for the AI calculations, and probably it will cause trouble with NULL pointers and all that stuff, remember that I am not a coder by any means, I struggled with that problem when in the first version of the modified bot#10 I´ve done If a monster was killed it resulted in continuous game crashes. :crowbar:

The "follow" option will work If I can make the bot detect if the proper command is executed... :\ so I must add that new command... :roll: I remember to have read a tutorial in Thewavelenght about adding new commands :rly:

Thanks! :)
Posted 6 years ago2017-07-08 06:08:45 UTC Post #335943
Yeah doing this kind of thing is pretty hard if you're not a strong C/C++ programmer.
Good luck anyway, and take advantage of the tutorials and free code out there.
You must be logged in to post a response.