Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-08-2014, 10:28 PM
blackbeltben blackbeltben is offline
Registered User
Join Date: Aug 2011
Posts: 83
blackbeltben is on a distinguished road
Creating Levels via Script

I have been searching the forums, but can't seem to find any codes on it.

I want to create a new level that adds to the file browser and what not through a weapon..

PHP Code:
function onActionServerSide(){
 if (
params[0] == "create"){
  
//Make level with name set as params[1]
 
}
}
 

//#CLIENTSIDE
function onKeyPressed(codekey){
 if (
key == "p"){ 
  
triggerserver("weapon"this.name"create""level"@player.account@".nw");
 }



Through my research, the only thing I could seem to find on this is the copylevel() function..

NOTE:
The NPC server has all folder rights so that shouldn't be an issue
Reply With Quote
  #2  
Old 06-08-2014, 10:45 PM
Jakov_the_Jakovasaur Jakov_the_Jakovasaur is offline
Deleted by Darlene159
Jakov_the_Jakovasaur's Avatar
Join Date: Sep 2013
Location: Deleted by Darlene159
Posts: 360
Jakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud of
hello!

yes you can use copylevel, the first parameter is the level file name and the second parameter is both the path (from within the 'levels/' folder) and filename:

PHP Code:
//would create a copy of copytest.nw at 'levels/player/level_blackbeltben.nw'
copylevel("copytest.nw""player/level_" temp.pl.communityname ".nw"); 
you can then use deletelevel("level_blackbeltben.nw"); to delete it

you should definitely avoid passing player.account and the level name prefix as a parameter from clientside to serverside, as a hacker could easily modify that to someone elses account, or even change the file name structure to over-write a different level or non level file. it would also be much better to use the players community name where it exists as all new account names follow the 'Graal######' format
__________________
This signature has been deleted by Darlene159.
Reply With Quote
  #3  
Old 06-08-2014, 10:56 PM
blackbeltben blackbeltben is offline
Registered User
Join Date: Aug 2011
Posts: 83
blackbeltben is on a distinguished road
Quote:
Originally Posted by Jakov_the_Jakovasaur View Post
hello!

yes you can use copylevel, the first parameter is the level file name and the second parameter is both the path (from within the 'levels/' folder) and filename:

PHP Code:
//would create a copy of copytest.nw at 'levels/player/level_blackbeltben.nw'
copylevel("copytest.nw""player/level_" temp.pl.communityname ".nw"); 
you can then use deletelevel("level_blackbeltben.nw"); to delete it

you should definitely avoid passing player.account and the level name prefix as a parameter from clientside to serverside, as a hacker could easily modify that to someone elses account, or even change the file name structure to over-write a different level or non level file. it would also be much better to use the players community name where it exists as all new account names follow the 'Graal######' format

I've messed around with it a lot but I can't get any level to create in my file browser. And when I try to warp to it, it "doesn't exist"
Reply With Quote
  #4  
Old 06-08-2014, 11:05 PM
Jakov_the_Jakovasaur Jakov_the_Jakovasaur is offline
Deleted by Darlene159
Jakov_the_Jakovasaur's Avatar
Join Date: Sep 2013
Location: Deleted by Darlene159
Posts: 360
Jakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud of
try creating the level file manually and then seeing if deletelevel("filename-no-path.nw"); actually deletes it, if it does then you will know for sure its not a npcserver rights issue

also are both the current and new filenames + paths configured correctly as a level in folderconfig?
__________________
This signature has been deleted by Darlene159.
Reply With Quote
Reply


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:20 AM.


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