View Single Post
  #2  
Old 10-15-2011, 01:29 AM
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
I don't think you understand what you're actually trying to do, what public functions are for, or how classes work.

Perhaps this is what you're trying to do:

Level NPC:

PHP Code:
function onCreated() {
  
this.quest_text "My name is bob";
  
join("icon");

class: icon

PHP Code:
function onPlayerTouchsMe() {
  
say2(this.quest_text);

A public function is for allowing other scripts to use the function remotely. I.e:

Level NPC A:

PHP Code:
function onCreated() {
  
this.level.cat this;
}

public function 
meow() {
  echo(
"Meow");

Level NPC B:

PHP Code:
function onCreated() {
  if (
this.level.cat == NULL) {
    
waitfor(this"LetCatLoad"0.05);
  }
  
temp.cat this.level.cat;
  
temp.cat.meow();

A class basically pastes code/functions into an NPC, onCreated is called in the class when it's joined.
__________________
Quote:
Reply With Quote