Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Change tile from a different level (https://forums.graalonline.com/forums/showthread.php?t=134268626)

Angel_Light 08-15-2013 05:23 AM

Change tile from a different level
 
How can one change the tiles that a player currently is not in? I have a custom sword script and after cutting a bush I use scheduleEvent to eventually regrow the bush after awhile with all the data needed passed through the params.

snippet :
PHP Code:

for ( temp.0temp.4temp.++;) 
      
findLeveltemp.lvl).tilelayerstemp.layer].tilestemp.tX temp.2temp.tY inttemp.2)] = this.( @ temp.sag)[ temp.typ][ 1][ temp.c];
  
    
putleapstemp.ltptemp.tXtemp.tY);                  
    
findLeveltemp.lvl).tilelayerstemp.layer].updateboardtemp.tXtemp.tY22); 

if I stay on the level/gmap is works perfectly, if I go inside a house and the event is called while I'm inside, the tiles don't update and the bush doesn't "regrow".

Emera 08-15-2013 06:50 AM

Quote:

Originally Posted by Angel_Light (Post 1721740)
How can one change the tiles that a player currently is not in? I have a custom sword script and after cutting a bush I use scheduleEvent to eventually regrow the bush after awhile with all the data needed passed through the params.

snippet :
PHP Code:

for ( temp.0temp.4temp.++;) 
      
findLeveltemp.lvl).tilelayerstemp.layer].tilestemp.tX temp.2temp.tY inttemp.2)] = this.( @ temp.sag)[ temp.typ][ 1][ temp.c];
  
    
putleapstemp.ltptemp.tXtemp.tY);                  
    
findLeveltemp.lvl).tilelayerstemp.layer].updateboardtemp.tXtemp.tY22); 

if I stay on the level/gmap is works perfectly, if I go inside a house and the event is called while I'm inside, the tiles don't update and the bush doesn't "regrow".

Track any changes made through a variable and if a change has been made prior to the player entering the level, then do updateBoard from an NPC in that level?

Angel_Light 08-15-2013 07:31 AM

eh, current method I'm using is to just call a scheduleEvent and loop it every second or so to check if the player is in the same level or not.

Emera 08-15-2013 07:37 AM

Quote:

Originally Posted by Angel_Light (Post 1721742)
eh, current method I'm using is to just call a scheduleEvent and loop it every second or so to check if the player is in the same level or not.

Would this be the kind of thing you're looking for? I haven't tested it; just wrote it up in Notepad.

PHP Code:

//NPC1 test1.nw

function onPlayerEnters() {
  
temp.levelObject findLevel("test2.nw");
  
temp.levelObject.tiles[3232] = int(random(50100));
  
temp.levelObject.("changes_" player.account) = true;
}
  
//NPC2 test2.nw

function onPlayerEnters() {
  if (
level.("changes_" player.account) == true) {
    
updateBoard(323211);
    
level.("changes_" player.account) = null;
  }



Angel_Light 08-15-2013 08:47 AM

Kind of, but I'm trying access a level object directly from a player that isn't in that level. I believe when the player is not in a level/gmap, that data gets garbaged collected and dumped, so technically it doesn't exist. Surprisingly, my current method with the schedule event loop doesn't lag the player even if it has to draw a lot of stuff.


All times are GMT +2. The time now is 09:06 PM.

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