View Single Post
  #10  
Old 08-20-2011, 09:43 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Televangelist View Post
Sweet! So when onCreated is called, the NPC could read from SQL what the current 'state' of everything is, to know whether they should be milling about peacefully, running for their lives, etc.?

(Also, I'm eagerly eagerly awaiting new episodes of Community)
You could also use a DB-NPC and flags. I've also written a simple ActiveRecord implementation in GS2 here: http://forums.graalonline.com/forums...hp?t=134262561

It really just depends how complicated your data is though.

What you're wanting to do is very possible though. I.e:

PHP Code:
function onCreated() {
  
loadState();
}

function 
loadState() {
  
this.npcs_town SQL.getNPCsTown(this.npc_id);
  
onStateUpdated();
}

function 
onStateUpdated() {
  
temp.town Towns.getTown(this.npcs_town);
  if (
temp.town.isOnFire()) {
    
panic();
  }

__________________
Quote:
Reply With Quote