Quote:
Originally Posted by Televangelist
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();
}
}