Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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 a jewel in the roughMysticalDragon is a jewel in the rough
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, 1030 views)
File Type: txt ai_variables.txt (881 Bytes, 1021 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
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:52 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.