PDA

View Full Version : Level Class Replacer


02-14-2009, 01:23 PM
So- I saw Ziro's post regarding his text replace, I made one similar to this when working on Era Dev, this one just replaces the classes mentioned though-


function onCreated() {
temp.folder.loadfolder("levels/world/overworld/*.nw", 0);
echo("Scanner: Started at" SPC timevar2);
this.onScan(temp.folder);
}
function onScan(folder) {
for (temp.s = 0; temp.s < 50; temp.s++) {
if (temp.s > temp.folder.size()) break;

temp.level = temp.folder[temp.s];
temp.data.loadlines("levels/world/overworld/" @ temp.level);
temp.count = 0;
for (temp.l: temp.data) {
temp.t = temp.l.tokenize();

if (temp.l.pos("tree") >= 0)
temp.data[temp.count] = "this.join(\"env-tree\");";
if (!temp.l.starts("NPC")) {
if (temp.l.pos("shrub") >= 0)
temp.data[temp.count] = "this.join(\"env-tree_shrub\");";
elseif (temp.l.pos("parkbench") >= 0)
temp.data[temp.count] = "this.join(\"env-parkbench\");";
elseif (temp.l.pos("smoke") >= 0)
temp.data[temp.count] = "this.join(\"particle-graysmoke\");";
elseif (temp.l.pos("wire-fence") >= 0)
temp.data[temp.count] = "this.join(\"env-fence_wire\");";
elseif (temp.l.pos("barrel") >= 0)
temp.data[temp.count] = "this.join(\"env-barrel\");";
elseif (temp.l.pos("hydrant") >= 0)
temp.data[temp.count] = "this.join(\"env-hydrant\");";
elseif (temp.l.pos("mailbox") >= 0)
temp.data[temp.count] = "this.join(\"env-mail_box\");";
elseif (temp.l.pos("box") >= 0)
temp.data[temp.count] = "this.join(\"env-box\");";
}

temp.count++;
}
temp.data.savelines("levels/" @ temp.level, 0);
echo("Scan: Replaced" SPC temp.level @ "!");
temp.folder.delete(temp.s);
}
if (temp.folder.size() > 0)
scheduleevent(1, "Scan", {temp.folder});
else
echo("Scanner: Finished at" SPC timevar2);
}

xXziroXx
02-14-2009, 04:31 PM
I've used my script to do the same :D

xfazex
03-01-2009, 05:00 PM
Is there anything else to this script other than a WNPC?

xXziroXx
03-01-2009, 05:44 PM
Is there anything else to this script other than a WNPC?

It's most likely not a WNPC, but a database NPC.

xfazex
03-01-2009, 06:03 PM
Yeah I have no idea how to do that lol

xXziroXx
03-01-2009, 09:22 PM
Yeah I have no idea how to do that lol

It's the icon left from the weapon NPC's icon on RC. Green dragon head one.

xfazex
03-01-2009, 09:24 PM
So that doesn't need to be assigned to anyone right? Like a weapon needs to be assigned to a character? (Or automatically when they connect by editing the server NPC)

cbk1994
03-01-2009, 10:46 PM
So that doesn't need to be assigned to anyone right? Like a weapon needs to be assigned to a character? (Or automatically when they connect by editing the server NPC)

If you're new to using RC/NC, this might help:

http://www.youtube.com/watch?v=Fa40kRUBqI0

xfazex
03-03-2009, 05:06 AM
I know how to use RC, just not this script.