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 02-14-2009, 01:23 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
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);
}
Reply With Quote
  #2  
Old 02-14-2009, 04:31 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've used my script to do the same
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #3  
Old 03-01-2009, 05:00 PM
xfazex xfazex is offline
Registered User
Join Date: Feb 2009
Location: Eastern Shore, Maryland USA
Posts: 81
xfazex is an unknown quantity at this point
Send a message via AIM to xfazex Send a message via MSN to xfazex Send a message via Yahoo to xfazex
Is there anything else to this script other than a WNPC?
Reply With Quote
  #4  
Old 03-01-2009, 05:44 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 xfazex View Post
Is there anything else to this script other than a WNPC?
It's most likely not a WNPC, but a database NPC.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #5  
Old 03-01-2009, 06:03 PM
xfazex xfazex is offline
Registered User
Join Date: Feb 2009
Location: Eastern Shore, Maryland USA
Posts: 81
xfazex is an unknown quantity at this point
Send a message via AIM to xfazex Send a message via MSN to xfazex Send a message via Yahoo to xfazex
Yeah I have no idea how to do that lol
Reply With Quote
  #6  
Old 03-01-2009, 09:22 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 xfazex View Post
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.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #7  
Old 03-01-2009, 09:24 PM
xfazex xfazex is offline
Registered User
Join Date: Feb 2009
Location: Eastern Shore, Maryland USA
Posts: 81
xfazex is an unknown quantity at this point
Send a message via AIM to xfazex Send a message via MSN to xfazex Send a message via Yahoo to xfazex
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)
Reply With Quote
  #8  
Old 03-01-2009, 10:46 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by xfazex View Post
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
__________________
Reply With Quote
  #9  
Old 03-03-2009, 05:06 AM
xfazex xfazex is offline
Registered User
Join Date: Feb 2009
Location: Eastern Shore, Maryland USA
Posts: 81
xfazex is an unknown quantity at this point
Send a message via AIM to xfazex Send a message via MSN to xfazex Send a message via Yahoo to xfazex
I know how to use RC, just not this script.
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 12:34 AM.


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