Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-17-2012, 05:41 PM
tstre tstre is offline
Era's Most Wanted
tstre's Avatar
Join Date: Nov 2010
Posts: 64
tstre has a little shameless behaviour in the past
NPC's

I need help!
Ok, so I deleted my whole server, but whenever I click on the NPC's folder, my RC disconnects. I cannot click on the npcs folder to delete them! That's the only things left on the server, and it's NPC's such as "npcs/npclocalnpc". I have to delete them 1 by 1 on client RC. Is there any type of script I can use to delete them fully? Without deleting them manually (1 by 1), Thanks!
__________________
Era's Most Wanted
Reply With Quote
  #2  
Old 03-17-2012, 05:47 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
Not really. You can't modify that folder via scripts serverside, and clientside you'd have to use client-RC stuff which is typically for privileged scripts only, I think.

Did you try using findNPC to find each of the local DB NPCs and then calling destroy() on them?

Alternatively you could give yourself partial folder rights like "rw npcs/localnpca*" and then "localnpcb" etc (doing this intelligently if a lot of them start with the same few characters).
__________________
Reply With Quote
  #3  
Old 03-17-2012, 05:58 PM
tstre tstre is offline
Era's Most Wanted
tstre's Avatar
Join Date: Nov 2010
Posts: 64
tstre has a little shameless behaviour in the past
Mind giving me a script real quick?
__________________
Era's Most Wanted
Reply With Quote
  #4  
Old 03-17-2012, 06:11 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by tstre View Post
Mind giving me a script real quick?
Quote:
Originally Posted by cbk1994 View Post
You can't modify that folder via scripts serverside
To call destroy() on them, simply do:
PHP Code:
function onCreated()
  
findNPC("InsertNameHere").destroy(); 
If that's what you were asking for. Nothing else to provide anyway though.
__________________
Reply With Quote
  #5  
Old 03-17-2012, 06:18 PM
tstre tstre is offline
Era's Most Wanted
tstre's Avatar
Join Date: Nov 2010
Posts: 64
tstre has a little shameless behaviour in the past
Didn't work, I used

function onCreated()
findNPC("npcs/localnpc").destroy();

(In the Control-NPC).
__________________
Era's Most Wanted
Reply With Quote
  #6  
Old 03-17-2012, 06:20 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 tstre View Post
Mind giving me a script real quick?
Try this. I can't guarantee it'll work if the levels have been deleted.

PHP Code:
// put this in a DB NPC
// DO NOT RUN THIS ON A SERVER WHERE YOU DON'T WANT TO DELETE ALL NPCS
function onCreated() {
  
temp.folder.loadFolder("npcs/npclocalnpc*"false);
  
  for (
temp.file temp.folder) {
    
temp.fileName removeEscapesFromFileName(temp.file);
    
temp.fileName temp.fileName.substring(3temp.fileName.length() - 7);
    
    
temp.npc findNPC(temp.fileName);
    
temp.npc.destroy();
  }

__________________
Reply With Quote
  #7  
Old 03-17-2012, 06:23 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
This should go through a kill everything.

PHP Code:
function onCreated() {
  
maxlooplimit 100000;
  
temp.lvls.loadfolder("levels/*.nw"1);
  for (
temp.lvltemp.lvls) {
    
temp.npcs findlevel(temp.lvl).npcs;
    for (
temp.npctemp.npcs) {
      
temp.npc.destroy();
    }
  }
  echo(
"EVERYTHING HAS BEEN DESTROYED");

Then you'll have to clearnpcs manually for your gmaps. I.e.

/clearnpcs yourworld.gmap
__________________
Quote:
Reply With Quote
  #8  
Old 03-17-2012, 06:26 PM
tstre tstre is offline
Era's Most Wanted
tstre's Avatar
Join Date: Nov 2010
Posts: 64
tstre has a little shameless behaviour in the past
So I should readd the levels first and then try the script?
__________________
Era's Most Wanted
Reply With Quote
  #9  
Old 03-17-2012, 06:30 PM
tstre tstre is offline
Era's Most Wanted
tstre's Avatar
Join Date: Nov 2010
Posts: 64
tstre has a little shameless behaviour in the past
Oh, thanks guys.
Chris, your's worked, thanks.
(I didnt try yours FP4, but thanks xP)
__________________
Era's Most Wanted
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 06:58 AM.


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