Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-07-2011, 08:43 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
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. :/
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #2  
Old 12-07-2011, 08:59 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
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.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #3  
Old 12-07-2011, 04:13 PM
ff7chocoboknight ff7chocoboknight is offline
Skyzer Zolderon
ff7chocoboknight's Avatar
Join Date: Dec 2006
Location: New Hampshire, United States
Posts: 725
ff7chocoboknight is a name known to allff7chocoboknight is a name known to allff7chocoboknight is a name known to allff7chocoboknight is a name known to all
Send a message via AIM to ff7chocoboknight Send a message via MSN to ff7chocoboknight
player.level.name?
__________________
Reply With Quote
  #4  
Old 12-07-2011, 04:42 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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.
Reply With Quote
  #5  
Old 12-08-2011, 08:18 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
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.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #6  
Old 12-08-2011, 08:23 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by sssssssssss View Post
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.
Reply With Quote
  #7  
Old 12-08-2011, 08:32 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Quote:
Originally Posted by sssssssssss View Post
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 View Post
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.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #8  
Old 12-08-2011, 08:37 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by sssssssssss View Post
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.
Reply With Quote
  #9  
Old 12-08-2011, 09:24 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
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.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #10  
Old 12-09-2011, 01:57 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
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();
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #11  
Old 12-09-2011, 08:48 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
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.
__________________
Reply With Quote
  #12  
Old 12-09-2011, 09:48 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
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..
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #13  
Old 12-09-2011, 04:15 PM
ff7chocoboknight ff7chocoboknight is offline
Skyzer Zolderon
ff7chocoboknight's Avatar
Join Date: Dec 2006
Location: New Hampshire, United States
Posts: 725
ff7chocoboknight is a name known to allff7chocoboknight is a name known to allff7chocoboknight is a name known to allff7chocoboknight is a name known to all
Send a message via AIM to ff7chocoboknight Send a message via MSN to ff7chocoboknight
Quote:
Originally Posted by Gunderak View Post
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
__________________
Reply With Quote
  #14  
Old 12-09-2011, 07:55 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Quote:
Originally Posted by Gunderak View Post
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
__________________
Reply With Quote
  #15  
Old 12-10-2011, 03:37 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Well whoever neg repped me at least I am trying to help.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #16  
Old 12-11-2011, 05:30 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
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. :/
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #17  
Old 12-11-2011, 07:39 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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.
__________________
Quote:
Reply With Quote
  #18  
Old 12-12-2011, 12:43 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
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.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
Reply


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 12:36 AM.


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