Crystal Space
Welcome, Guest. Please login or register.
November 20, 2017, 02:52:05 am

Login with username, password and session length
Search:     Advanced search
9081 Posts in 2051 Topics by 80487 Members
Latest Member: Scarnati
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  NPC.. how?
« previous next »
Pages: [1] Print
Author Topic: NPC.. how?  (Read 2631 times)
Posts: 31

View Profile
« on: February 14, 2008, 04:33:55 pm »


it seems that I get used to CEL, but.. how can I programm selfacting entities?
All the things I've done so far, are entities, which react on keyborard input via SendMessage().
(Like it is done in the walktut sample) But I couldn't figure out, how Messages are sent and how
 I could sent something like an "Update"-message to a NPC.

hlp plz Smiley
« Reply #1 on: February 15, 2008, 05:26:34 pm »

Well, I don't know much about I.A., inferences, heuristics and so on and I don't know if CEL is offering something to help (depending the complexity you can search for algorithms on the net, like pathfinding and so on).
I find simple to use a states logic with "PcProperties".

You can store the actual state of the entity, like "walking", "waiting", "pissing" and program the actions for the times you set a new state:

// after telling an entity to walk
if npc1.oldstate="pissing" do
  Nothing, wait a moment just in case
else if npc1.oldstate=waiting do
end if

If you are doing something simple I think that the idea works.
« Last Edit: February 15, 2008, 05:38:54 pm by Inko I.A. » Logged
Posts: 31

View Profile
« Reply #2 on: February 15, 2008, 05:46:21 pm »

Thanks for the reply,
but I actually asked how I can tell a CEL entity to do the AI stuff, not how to programm the AI itself. (what I've already done several times in other languages)

A inputcontrolled entity works like that:

   if Message=this{
      do this
   }elseif Message=that{
      do that

Sendmessage is called, when I push a key or click a mouse button etc.
But I want to create an entity, which should fully work on it's own without pushing buttons.

« Reply #3 on: February 17, 2008, 02:29:20 pm »

I don't know how to send custom messages, never done it. Anyway, I think you can have all you need with timer, trigger and quest property classes.
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 5.16 seconds with 17 queries.