View Single Post
  #9  
Old 08-31-2014, 11:41 PM
MysticalDragon MysticalDragon is offline
Global Administration
MysticalDragon's Avatar
Join Date: Oct 2002
Location: Lynn Ma
Posts: 883
MysticalDragon is a jewel in the roughMysticalDragon is a jewel in the rough
Send a message via AIM to MysticalDragon Send a message via MSN to MysticalDragon
Quote:
Originally Posted by callimuc View Post
You have like a template level. You always load that one file as a text (using loadLines() or whatever you want to use) and have the script look for a certain warp you want to manipulate (lets say the format is 'LINK 30 30 some_level.nw' ; I'm not too sure didn't check it). After you've found that / them, you simply alter the Level name like:

PHP Code:
temp.newlevel "new_level.nw";
temp.line yourFoundLINKLocationInsideTheFile.tokenize();
//          LINK             x                y                levelname
temp.line temp.line[0SPC temp.line[1SPC temp.line[2SPC temp.newlevel 
and save those edited lines via saveLines() as a new level. Make sure to keep your level template unedited - it's a template

TBH I've never really tried editing the links directly like that, but that's the way that I can think of right now. Probably would end up changing it all again
Like Callimuc said, here is a piece that might help from Instance System from Novo. A tad was changed by me below.

We actually find the links using a identifiable name such as original. All our instance levels are levelname-original.nw.
to get the copy_id, we calculate each instance created (Ex: this.copy_counter.(@temp.id) ++;//temp.id would be the instance type)
PHP Code:
  temp.original_level levelname-original.nw;
  
temp.lines.loadlines("levels/instance/"temp.original_level);
  
temp.newlines = new[0];
  for (
temp.linetemp.lines) {
    
temp.original_pos temp.line.pos("original");
    while (
temp.original_pos != -1) {
      
temp.line temp.line.substring(0temp.original_pos) @ temp.copy_id temp.line.substring(temp.original_pos strlen("original") - 2);
      
temp.original_pos temp.line.pos("original");
    }
    
temp.newlines.add(temp.line);
  } 

And what this does is it copys the x and y coordinates of your original level, and renames the copied level as well as the links.
__________________
~Delteria Support
~Playerworld Support
~PWA Chief
http://support.toonslab.com
[email protected]



Reply With Quote