Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #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
  #2  
Old 08-16-2008, 06:10 PM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Requesting {{variable, value}, {variable, value}} pairs.
Reply With Quote
  #3  
Old 08-16-2008, 06:12 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
I don't get what it's supposed to do, I've always had a problem reading your codes.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #4  
Old 08-16-2008, 06:27 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Stan probably copied the separate vars and vals parameters from me. Though I have decided not to do that any longer.
Quote:
Originally Posted by xXziroXx View Post
I don't get what it's supposed to do, I've always had a problem reading your codes.
If the parameter names and function name don't make it obvious enough the notes should.
__________________
Reply With Quote
  #5  
Old 08-16-2008, 06:33 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by Inverness View Post
If the parameter names and function name don't make it obvious enough the notes should.
Well, it's obviously a wrapper, however I don't get the reason for it. People should stop reinventing the wheel, when it can't get any better then it already is.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #6  
Old 08-16-2008, 06:34 PM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Quote:
Originally Posted by Inverness View Post
Stan probably copied the separate vars and vals parameters from me.
You mean "stole"?
Reply With Quote
  #7  
Old 08-16-2008, 06:36 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by DrakilorP2P View Post
You mean "stole"?
No, I don't. Because Stan learned a lot from me and I have no problem with him looking at my stuff.
__________________
Reply With Quote
  #8  
Old 08-16-2008, 06:45 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
Quote:
Originally Posted by DrakilorP2P View Post
Requesting {{variable, value}, {variable, value}} pairs.
Would probably be more efficient...

Quote:
Originally Posted by DrakilorP2P View Post
You mean "stole"?
Nah, I picked up quite a few habits from Inver.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 10:47 PM.


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