Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Level Class Replacer (https://forums.graalonline.com/forums/showthread.php?t=84198)

[email protected] 02-14-2009 01:23 PM

Level Class Replacer
 
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-

HTML Code:

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

Quote:

Originally Posted by xfazex (Post 1470311)
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

Quote:

Originally Posted by xfazex (Post 1470324)
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

Quote:

Originally Posted by xfazex (Post 1470363)
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.


All times are GMT +2. The time now is 10:03 AM.

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