View Single Post
  #1  
Old 03-09-2018, 02:06 AM
MysticalDragon MysticalDragon is offline
Global Administration
MysticalDragon's Avatar
Join Date: Oct 2002
Location: Lynn Ma
Posts: 883
MysticalDragon is just really niceMysticalDragon is just really nice
Send a message via AIM to MysticalDragon Send a message via MSN to MysticalDragon
Barebone Baddy System Event Based

On IOS Servers using timeouts is really bad, so its recommended to avoid them when possible.

Here is just a bare-bone version of something that can be turned into a baddy system. Instead of the traditional timeouts it uses scheduleEvents and is event based with using flags like players.

Both classes attached.


PHP Code:
ExampleLevel NPC
const INIT_STATE "float";
const 
GLOBAL_STATE "float";

function 
onCreated() {
  
this.join("ai_module");
  
this.join("ai_variables");
  
this.savelocally true;
  
_set("maxhealth"100);
  
temp.maxHealth this._get("maxhealth");
  
this._set("health"temp.maxHealth);
  
// this.globalState = GLOBAL_STATE ;
  // this.enterState(this.globalState);

  
changeState(INIT_STATE);
}

function 
ai_enter_float() {
  
this.ani "idle";
  
this.aiPeriod 1;
}

function 
ai_execute_float() {
  
//logic here move?
  
this.ani "move";

Attached Files
File Type: txt ai_module.txt (1.0 KB, 719 views)
File Type: txt ai_variables.txt (881 Bytes, 697 views)
__________________
~Delteria Support
~Playerworld Support
~PWA Chief
http://support.toonslab.com
[email protected]




Last edited by MysticalDragon; 03-09-2018 at 02:20 AM..
Reply With Quote