Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-05-2008, 03:54 PM
DarkIceX DarkIceX is offline
(Developer)
Join Date: May 2002
Location: Canada
Posts: 125
DarkIceX is on a distinguished road
Trouble updating level tiles using script..

I'm trying to create a system which allows you to copy a level to your current level so that your level becomes a near exact replica (no NPCs)..

It's been done before, but It's good practice.

Anyways, I'm having a problem with the tiles resetting back to the normal tiles after a few minutes. The level is by default a level of all grass. When I copy a level, It'll update the board for a few minutes then pop back to all grass.

Wondering what's causing this.

NPC Code:

function onCreated()
{
setshape(1,32,32);
}

function onActionspy()
{
temp.levelname = params[0];
temp.y = 0;

for (temp.x = -1; temp.x < 65; temp.x++)
{
tiles[temp.x,temp.y] = findlevel(temp.levelname).tiles[temp.x,temp.y];
if (temp.x == 64 && temp.y < 64)
{
temp.x = -1;
temp.y++;
}
}
updateboard(0,0,64,64);

for (a: allplayers)
{
if (a.level.name == temp.levelname)
{
if (a.level.name == "") continue;
temp.players.add(a.account);
}
}
echo(temp.players.size() SPC "players in" SPC temp.levelname);
echo(temp.players);
echo("Getting player attributes");

for (p: temp.players)
{
if (findplayer(p).communityname == "")
{
temp.account = findplayer(p).account;
}
else temp.account = findplayer(p).communityname;
temp.x = findplayer(p).x;
temp.y = findplayer(p).y;
temp.head = findplayer(p).headimg;
temp.body = findplayer(p).bodyimg;
temp.shield = findplayer(p).shieldimg;
temp.colors_0 = findplayer(p).colors[0];
temp.colors_1 = findplayer(p).colors[1];
temp.colors_2 = findplayer(p).colors[2];
temp.colors_3 = findplayer(p).colors[3];
temp.colors_4 = findplayer(p).colors[4];
temp.colors_5 = findplayer(p).colors[5];
echo(temp.account @ ": (" @ temp.x @ "," @ temp.y @ ")" SPC temp.head @ "," SPC temp.body @ "," SPC temp.shield @ "," SPC temp.colors_0 @ "," SPC temp.colors_1 @ "," SPC temp.colors_2 @ "," SPC temp.colors_3 @ "," SPC temp.colors_4 @ "," SPC temp.colors_5);
}
echo("Attribute fetching completed for" SPC temp.levelname);
}

//#CLIENTSIDE

function onPlayerChats()
{
if (player.chat.starts("/spy"))
{
temp.level = player.chat.tokenize()[1];
player.chat = temp.level;
triggeraction(x,y,"spy",temp.level);
}
}



This may not be the best or most efficient way of doing it, but I'm still learning, so if you know a better way It'd also be appreiciated if you could point me in the right direction.

Thanks
__________________

Bloodvayne
Reply With Quote
 


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 05:12 PM.


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