PDA

View Full Version : putnpc3 (Nothing New)


TheStan
08-16-2008, 07:02 PM
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.


/**** 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(levelname, x, y, classes, vars, vals) {
with (findlevel(levelname)) {
with (putnpc2(x, y, "")) {
if (vars.type() == vals.type()) {
if (vars.type() == 3) {
if (vars.size() == vals.size()) {
for (v = 0; v < vars.size(); v++) {
this.(@ vars[v]) = vals[v];
}
}
}
else {
if (vars.type() == 1) {
this.(@ vars) = this.(@ vals);
}
}
}
this.joinedclasses = classes;
}
}
}

DrakilorP2P
08-16-2008, 07:10 PM
Requesting {{variable, value}, {variable, value}} pairs.

xXziroXx
08-16-2008, 07:12 PM
I don't get what it's supposed to do, I've always had a problem reading your codes. :frown:

Inverness
08-16-2008, 07:27 PM
Stan probably copied the separate vars and vals parameters from me. Though I have decided not to do that any longer.
I don't get what it's supposed to do, I've always had a problem reading your codes. :frown:If the parameter names and function name don't make it obvious enough the notes should.

xXziroXx
08-16-2008, 07:33 PM
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.

DrakilorP2P
08-16-2008, 07:34 PM
Stan probably copied the separate vars and vals parameters from me.

You mean "stole"?

Inverness
08-16-2008, 07:36 PM
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.

TheStan
08-16-2008, 07:45 PM
Requesting {{variable, value}, {variable, value}} pairs.

Would probably be more efficient...

You mean "stole"?

Nah, I picked up quite a few habits from Inver.