ID:1916874
 
Code:
no exact code at the moment


So, Im here again and this time, I'm sure my issue is pretty simple, but the answer is probably complicated.

Now, Ive been working on NPC intelligence, randomizers for npc generation, and as i continue coding a game project that I have taken over since last year, I find myself returning to this little thought.

NPCs using techniques/skills/verbs, or otherwise ranged combat. Now, Im sure I could have an easy way for npcs to 'fire' projectiles once in a while, but i dont want that. I want them to be able to use techniques and verbs in game, and be able to code a pretty simple way to allow this.

Now, I know that many Naruto games have this kind of system, but ive never really gotten a good look at their system.

I also looked for 'NPC Ranged Combat' and this was sitting at the bottom, I feel for this guy that he never really got an answer from the people here:

'Well, I've figured how to do melee combat with NPCS, but range combat escapes me. I tried to modify a couple different melee systems, but they failed. I am totally stumped. Another thing is I am trying to have the NPC walk around when a target is not in range. If I did not the walk part, I'd probally be home free already, but, meh. The part that really complicates my predicament is that I have several checkers, that check several mob/vars to see if the mob is to be shot at or not. I know how to implement these, but I am not sure where to'
What exactly are you asking?

If you want NPCs to use the same skills that players use, those skills had to be programmed in such a way that allows for client independence. For example, the skills should be usable by any player or NPC type, without using usr or client. Then, you would make the NPC use the skill the same way a player would.

For example,
// call some_skill.Use(some_mob) to make some_mob use some_skill
skill/proc/Use(mob/User)

// when someone uses the punch skill, tell the world
skill/punch/Use(mob/User)
world << "[User] punches!"

// demo startpoint
mob/Login()
// initialize a punch skill
var skill/punch/punch_skill = new

// you punch
punch_skill.Use(src)

// some npc appears
var mob/npc/some_npc = new

// the npc punches
punch_skill.Use(some_npc)

i think all I have is usr, and that's pretty easy to switch to src.

but I also need them to able to use these when a hostile mob comes into view(like the player), and that's uaully when the code for launching ranged attacks goes out the window, and most code ive found runs them straight into the opponent, rather than say, trying to dodge.

now, im not saying I need a code to make them dodge, im sure ill work more on pathing in my own crazy time, I just want them to be able to recognize the threat while theyre walking around, get into a position, and use the verb.

hope that helps clear up my exact issue at the point.
I would suggest just going a lot of independent research on AI theory for games. It's a very broad topic but can really help you figure out exactly how you want to structure it. Once you know how it's structured, programming it is easy.
heh, well, not exactly the answer I wanted to hear, I guess then its back to solo work, and NPC pathing, thanks anyway.
In response to Bloody m
There's only so much we can do to help. AI is so specific to a game's development that it would be hard for any of us to be able to give you accurate feedback without understanding exactly what you want out of your AI.