DJRavine's Codebook:

Post Reply 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Kobold] How to add an AI script to a Creature
02-27-2007, 03:32 AM (This post was last modified: 07-24-2007 04:01 AM by DJRavine.)
Post: #1
[Kobold] How to add an AI script to a Creature
[Kobold] How to add an AI script to a Creature

Take a look at your script, it contains all the information you need to know about getting an ai script to load.

Now, the other part is obviously the script file...

First, your going to want to import neccesary objects into your script, such as other scripts and mainly the lud core.

It should look something abit like...

from Ludmilla import *//core
import consts as co //import of global constants
reload(co) //reload those consts
from random import * // sys file for random variable generators
#from AIWraper.AIWrapper import * // this is commented out(no need for this in your script)
import packet_class as packet_builder //imports file and classifies it as "packet_builder"
reload(packet_builder) //reload that same file
Take note your only going to use packet_class if your attempting to send packets to and from the server/client

Next, your going to want to have your file be classified with a name...

Class AI_Vancleef:
Now, comes your script ai...i'm hoping you got that part down [Image: wink.gif]

Last comes the registering of the script...

It's going to look something like...

import ai.inst.Vancleef
    Van = ai.inst.Vancleef
    RegisterAIClass (639, Van.AI_Vancleef(), TRUE)
import is where you call the script to be brought up into action...

first comes import, then the folders to the file:

import ai.inst.
see that the folders are seperated by periods, and not slashes.

Now we get to the actual file:

import ai.inst.Vancleef
Punctuation matters [Image: tongue.gif]

Now we have the option to rename this import, for simplification...First comes the new name of the import, then the actual path to the file...

Next, we reload that.

Last, we register the ai to be used with a specific creature, this creature is defined by its creature_id found in the creatures_templ in your mysql db.

RegisterAIClass (639, Van.AI_Vancleef(), TRUE)
639 = the creature_id
Van = the renamed path to the file
AI_Vancleef() = what we classified the script in the beginning as, remember?[Image: tongue.gif]
Last, we put in a simple boolean string... true/false 0/1 that sorta thing...

Anyway, thats just the basics...And I hope i explained it well enough for you to get the gyst...

I'm not anywhere near perfect but this is abit of what i've learned through reading around and experimenting [Image: smile.gif]


[Image: DJRavine_userbar.gif]
[Image: djr_sig.png]
[Image: thedjravine.png]
"In a world of genocide... The pacifist must take control..." - DJRavine
Visit this user's website Find all posts by this user
Add Thank You Quote this message in a reply
Post Reply 

Share/Bookmark (Show All)
Facebook Linkedin Technorati Twitter Digg MySpace Delicious

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [KoBold v2] Setup Guide + PICTURES DJRavine 3 3,254 11-10-2008 04:54 PM
Last Post: OlloX3
  [KoBold v1] Setup Guide DJRavine 2 3,206 03-31-2008 10:32 AM
Last Post: marlox
  Kobold Announcer DarkNation 9 1,829 03-04-2007 04:13 AM
Last Post: »Yama«
  [Kobold] How To Configure Using DNS DJRavine 0 1,532 02-27-2007 03:49 AM
Last Post: DJRavine

Forum Jump:

Contact Us | | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication | CSS Validated!