Initializing the Baddy
The very first function called by a baddy should always be the function that will define all of its features.  Hence the name "Initialize".  I like to use showcharacter NPCs for my baddys since I totally suck at making graphics, and there is a whole array of images available for my use. Later I will illustrate a way to use arrays to keep track of sprites for a baddy that is not a showcharacter, and that does not use ganis.
Here is a generic Initialize function for a showcharcter NPC baddy
 
function Initialize(){ 
  showcharacter; 
  setcharprop #n,Baddy'sName
  setcharprop #2,Baddy'sShield
  setcharprop #1,Baddy'sSword
  setcharprop #3,Baddy'sHead
  setcharprop #C0,SkinColor
  setcharprop #C1,CoatColor
  setcharprop #C2,SleeveColor
  setcharprop #C3,ShoeColor
  setcharprop #C4,BeltColor
  hearts=LifeofBaddy
  this.speed=MovementSpeed
  swordpower=StrengthofBaddy
  this.attackdist= DistancetoAttack
  timeout=TimetillStart 
}
The stuff in Red has to be filled in with correct filenames or colors that the graal engine can recognize. 
Everything in Blue needs to be a numerical values.  As I explain the other functions you ought to get a better idea as to what to use for the value of these variables.  this.attackdist might be confusing, basically if it were set to 3, then the NPC will do its scripted attack when it is 3 tiles away from its designated target.
This will most commonly be placed under a "playerenters" flag to start the baddy in motion.
 
Previous Topic         Home           Next Topic