Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Generating A Level (https://forums.graalonline.com/forums/showthread.php?t=134263129)

Astram 05-05-2011 10:39 PM

Generating A Level
 
Can someone help me create a level out of another level template?
Like something along the lines of
PHP Code:

createlevel("templatelevel","newlevelname"); 

Please help x_x

DustyPorViva 05-05-2011 10:42 PM

serverside copylevel(level,newlevel);

Astram 05-06-2011 04:00 AM

Quote:

Originally Posted by DustyPorViva (Post 1647830)
serverside copylevel(level,newlevel);

Then why doesnt this work?
PHP Code:

function onActionServerSide()
  {
    if (
params[0] == "makehouse")
    {
    
clientr.phouse2 1;
    
copylevel("toad-level1.nw","house1_"@params[1]@"_outside.nw");
    }
  }
//#CLIENTSIDE
function onCreated()
  {
  if (
clientr.phouse2 == NULL)
    {
    
triggerserver("gui",this.name,"makehouse",player.account);
    }
  } 


cbk1994 05-06-2011 04:04 AM

Make sure the NPC-server has proper rights, and specify the destination path.

Quote:

Originally Posted by scripthelp
Script help for 'copylevel':
copylevel(str, str) - parameters are the source level filename and the destination filename; the destination is relative to the levels/ folder

Also, never accept the player's account as a parameter from a trigger. You can access it directly on serverside.

Astram 05-06-2011 09:58 PM

Quote:

Originally Posted by cbk1994 (Post 1647900)
Make sure the NPC-server has proper rights, and specify the destination path.



Also, never accept the player's account as a parameter from a trigger. You can access it directly on serverside.

Sorry, Im new to scripting. Can you give me an example? :confused:

cbk1994 05-06-2011 10:11 PM

Quote:

Originally Posted by Astram (Post 1648005)
Sorry, Im new to scripting. Can you give me an example? :confused:

PHP Code:

function onActionServerSide(temp.cmd) {
  if (
temp.cmd == "createHouse") {
    if (
player.clientr.phouse2 == null) {
      
copyLevel("toad-level1.nw""world/phouse/house_" player.account ".nw");
      
// no "levels/" in the path
    
}
  }
}

//#CLIENTSIDE
function onPlayerChats() {
  if (
player.chat == "create house") {
    
triggerServer("gui"this.name"createHouse");
  }


and then give the NPC-server the rights

Quote:

rw levels/world/phouse/house_*.nw
Haven't tested but it should work.

Astram 05-06-2011 11:12 PM

That doesnt work...

cbk1994 05-06-2011 11:14 PM

Quote:

Originally Posted by Astram (Post 1648018)
That doesnt work...

If you actually care about getting this script to work you're going to have to provide more information than that.

Astram 05-06-2011 11:36 PM

Didnt Work
 
Quote:

Originally Posted by cbk1994 (Post 1648020)
If you actually care about getting this script to
work you're going to have to provide more information than that.

Well I added the NPC Server the rights. But nothing happened. And I made the folder rights

cbk1994 05-06-2011 11:47 PM

Quote:

Originally Posted by Astram (Post 1648024)
Well I added the NPC Server the rights. But nothing happened. And I made the folder rights

Did you add the weapon to yourself? What did you say to use it? Did your player have player.clientr.phouse2 already set? Did you try adding echoes on serverside?

Astram 05-07-2011 12:19 AM

Its an onCreated() event.
I changed the clientr. variable name.
I have the weapon.
And no I didnt add Echos

Astram 05-07-2011 06:40 AM

I got it... Appearently, like my other scripts. It starts working randomly...


All times are GMT +2. The time now is 12:23 PM.

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