View Single Post
  #1  
Old 08-16-2008, 06:02 PM
TheStan TheStan is offline
Stan?
Join Date: May 2008
Location: U.S.
Posts: 100
TheStan is on a distinguished road
Send a message via AIM to TheStan Send a message via MSN to TheStan
putnpc3 (Nothing New)

Just whipped up a quick little putnpc3() function to make it easier on folks who'd rather not make an npc in a level in the level editor etc. then upload etc.

PHP Code:
/**** Notes ****\
PARAMS:
  levelname - The level you wish for the npc to be placed at.
  x - The x coordinate the npc will be placed at.
  y - The y coordinate the npc will be placed at.
  classes - Supports both arrays and single strings. List of classes joined to the npc.
  vars - Supports both arrays and single strings. Variables you wish set to the npc.
  vals - Supports both arrays and single string. Values for the variables.
\***************/
public function putnpc3(levelnamexyclassesvarsvals) {
  
with (findlevel(levelname)) {
    
with (putnpc2(xy"")) {
      if (
vars.type() == vals.type()) {
        if (
vars.type() == 3) {
          if (
vars.size() == vals.size()) {
            for (
0vars.size(); v++) {
              
this.(@ vars[v]) = vals[v];
            }
          }
        }
        else {
          if (
vars.type() == 1) {
            
this.(@ vars) = this.(@ vals);
          }
        }
      }
      
this.joinedclasses classes;
    }
  }

Reply With Quote