Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Setting different tilesets (https://forums.graalonline.com/forums/showthread.php?t=134265185)

sssssssssss 12-07-2011 08:43 AM

Setting different tilesets
 
I can't believe I've forgotten this much, but here is the code first:
PHP Code:

//#CLIENTSIDE
function onPlayerEnters() {
// Set all Tilesets where needed
  
removeTileDefs("");
  
temp.haha= {
  
"world_bb01.nw","world_bb02.nw","world_bb03.nw",
  
"world_bc01.nw","world_bc02.nw","world_bc03.nw",
  
"world_bd01.nw","world_bd02.nw","world_bd03.nw",
  
"world_be01.nw","world_be02.nw","world_be03.nw"
  
};
  
//make haha tileset on world_aa01(top left) through
  //world_bf03(bottom right).
  
  
if (player.level.name in temp.haha) {
    
addTileDef("haha-tileset.gif""world_"1);
  }else{ 
    
addTileDef("regular-tileset.gif""world_"1);
  }
  


I can't even really think of a different way, but I know even I used to do it a different way. Obvously I need world_aa01 through world_bf03 one tileset and then the rest of world_ the regular tileset. Crappy doing it in onPlayerEnters too. :/

Gunderak 12-07-2011 08:59 AM

As I have learnt debugging is the key.
Have you tried something like this?
PHP Code:

//#CLIENTSIDE 
function onPlayerEnters() {
  
temp.haha = {
    
"world_bb01.nw""world_bb02.nw""world_bb03.nw",
    
"world_bc01.nw""world_bc02.nw""world_bc03.nw",
    
"world_bd01.nw""world_bd02.nw""world_bd03.nw",
    
"world_be01.nw""world_be02.nw""world_be03.nw"
  
};
  if (
player.level.name in temp.haha) {
    
player.chat "I am in the correct levels!";
  } else {
    
player.chat "I am not in the correct levels!";
  }


If all else fails, I know you probably shouldn't but do it on a one second timeout.

ff7chocoboknight 12-07-2011 04:13 PM

player.level.name?

DustyPorViva 12-07-2011 04:42 PM

PHP Code:

//#CLIENTSIDE
function onPlayerEnters() {
  
temp.haha= {
  
"world_bb01.nw","world_bb02.nw","world_bb03.nw",
  
"world_bc01.nw","world_bc02.nw","world_bc03.nw",
  
"world_bd01.nw","world_bd02.nw","world_bd03.nw",
  
"world_be01.nw","world_be02.nw","world_be03.nw"
  
};
  
//make haha tileset on world_aa01(top left) through
  //world_bf03(bottom right).
  
  
addTileDef("regular-tileset.gif""world_"1);
  for (
temp.temp.haha) {
    
addTileDef("haha-tileset.gif"temp.i1);
  }


Also, don't use GIF's, especially for tilesets... they have much larger file sizes for things like this than a PNG would, not to mention with a tileset you'll most likely run out of colors(256 max) and have permanent color-loss, which is VERY ugly in GIF.

sssssssssss 12-08-2011 08:18 AM

What I posted works, it's just bound to be taking more memory than I need. I was looking for someone to point me in a different direction of setting different tilesets on a gmap. I know it's probably not good to be user onPlayerEnters on a gmap, and there has got to be a better way of doing tilesets like I'm trying to do without using an array of levels, because I only know to use onPlayerEnters with the array, nothing else worked. Help plz. :(

Also we are using .gif because .png kept giving us problems lately. Not sure with exactly what, I just know because that is what I was told.

DustyPorViva 12-08-2011 08:23 AM

Quote:

Originally Posted by sssssssssss (Post 1676854)
What I posted works, it's just bound to be taking more memory than I need. I was looking for someone to point me in a different direction of setting different tilesets on a gmap. I know it's probably not good to be user onPlayerEnters on a gmap, and there has got to be a better way of doing tilesets like I'm trying to do without using an array of levels, because I only know to use onPlayerEnters with the array, nothing else worked. Help plz. :(

Also we are using .gif because .png kept giving us problems lately. Not sure with exactly what, I just know because that is what I was told.

Why constantly removetiledefs and then reload them every time the player enters a level? That's a fairly intensive process for the client. Set the tiledefs once for the appropriate levels and leave it at that.

sssssssssss 12-08-2011 08:32 AM

Quote:

Originally Posted by sssssssssss (Post 1676854)
What I posted works, it's just bound to be taking more memory than I need...I know it's probably not good to be user onPlayerEnters on a gmap, and there has got to be a better way of doing tilesets...

Quote:

Originally Posted by DustyPorViva (Post 1676857)
Why constantly removetiledefs and then reload them every time the player enters a level? That's a fairly intensive process for the client. Set the tiledefs once for the appropriate levels and leave it at that.

:) That's what I'm asking silly. I'm saying the way I have it sucks, what other way is there to accomplish this besides the way I'm doing it. I tried everything I have under onCreated but it didn't work.

I'd rather use some way for it onCreated to set it all once, but it seems it has to check the array every time on enters to use an array. I really don't like doing it that way, it's just been so long I don't remember how I used to do it.

DustyPorViva 12-08-2011 08:37 AM

Quote:

Originally Posted by sssssssssss (Post 1676859)
:) That's what I'm asking silly. I'm saying the way I have it sucks, what other way is there to accomplish this besides the way I'm doing it. I tried everything I have under onCreated but it didn't work.

I'd rather use some way for it onCreated to set it all once, but it seems it has to check the array every time on enters to use an array. I really don't like doing it that way, it's just been so long I don't remember how I used to do it.

Did you use the script in my post...? Just change the onPlayerEnters() to onCreated(), it doesn't really matter.

sssssssssss 12-08-2011 09:24 AM

Yeah, it wouldnt change correctly. If i started in one tileset, then walked to another, it wouldnt change to the main tileset like it was supposed to. Thats why I put onPlayerEnters, and it works, but I know it's the worst of all ideas.

Gunderak 12-09-2011 01:57 AM

Maybe setting a clientr variable to the tileset when you enter a level and then if that changes do the script?
I can't remember but to get the tileset I think it's GetTileDef();

xAndrewx 12-09-2011 08:48 AM

if you ever go classic, Skyld will run through your code to check for anything bad and advise. I wouldn't worry about process memory at such an early stage.

Gunderak 12-09-2011 09:48 AM

Yeah Capt. GScript will help ya most likely, I mean I tearms of pc graal it can handle alot of memory intensive codes but iDevices, I'm not so sure about.
So as Andrew said, don't worry about it too much.
Well unless you're trying to do a 0.05 second serverside timeout..

ff7chocoboknight 12-09-2011 04:15 PM

Quote:

Originally Posted by Gunderak (Post 1677020)
Yeah Capt. GScript will help ya most likely, I mean I tearms of pc graal it can handle alot of memory intensive codes but iDevices, I'm not so sure about.
So as Andrew said, don't worry about it too much.
Well unless you're trying to do a 0.05 second serverside timeout..

O_o

xAndrewx 12-09-2011 07:55 PM

Quote:

Originally Posted by Gunderak (Post 1677020)
Yeah Capt. GScript will help ya most likely, I mean I tearms of pc graal it can handle alot of memory intensive codes but iDevices, I'm not so sure about.
So as Andrew said, don't worry about it too much.
Well unless you're trying to do a 0.05 second serverside timeout..

ya and ignore this post. rofl

Gunderak 12-10-2011 03:37 AM

Well whoever neg repped me at least I am trying to help.

sssssssssss 12-11-2011 05:30 PM

The second part of my quest was if there was a different, or better way to make

PHP Code:

//make haha tileset on world_aa01(top left) through
  //world_bf03(bottom right). 

^- then the rest the set, default tileset, without making an array of all the levels world_aa01 through world_bf03. :/

fowlplay4 12-11-2011 07:39 PM

Just do:

addtiledef("haha.png", "world_", 1);

All levels with the world_ prefix will use the haha tileset. Then you can use:

addtiledef("default.png", "", 1);

As a catch all and have other levels use the default tileset instead unless there's a more specific tiledef for the levels the player is in.

sssssssssss 12-12-2011 12:43 AM

Its part of the gmap that has to change so if there is a way to make like world_af11 and up a tileset then below different that is what I need. I'm not asking for a handout either, I just have no idea how to do it and I've been searching a few days and found nothing. Was thinking looping it to catch but just havent tried yet.


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

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