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 08-15-2013, 05:23 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
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".
__________________
Deep into the Darkness peering...
Reply With Quote
  #2  
Old 08-15-2013, 06:50 AM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by Angel_Light View Post
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?
__________________
Reply With Quote
  #3  
Old 08-15-2013, 07:31 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
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.
__________________
Deep into the Darkness peering...
Reply With Quote
  #4  
Old 08-15-2013, 07:37 AM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by Angel_Light View Post
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;
  }

__________________
Reply With Quote
  #5  
Old 08-15-2013, 08:47 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
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.
__________________
Deep into the Darkness peering...
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 03:41 AM.


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