Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Sun Oct 21, 2018 9:07 am

All times are UTC




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu May 04, 2017 11:47 am 
Offline
Engineer
Engineer

Joined: Thu Nov 20, 2003 3:20 pm
Posts: 89
Hello,

I would like to have a building tile, where there are two adjacend buildings placed, both from same random pool of 4 versions of this sprite. I have tried following code, but NMLC doesn't allow me to compile.

Code:
random_switch(FEAT_HOUSES,SELF,rnd_streethouses_NW){
 1: s_streethouse1_NW;
 1: s_streethouse2_NW;
 1: s_streethouse3_NW;
 1: s_streethouse4_NW;
}

spritelayout l_streethouses_NW {
  ground { sprite: GROUNDSPRITE_CONCRETE; }
  building {
    sprite:  rnd_streethouses_NW;
    xextent: 8;
    yextent: 8;
    zextent: 16;
    xoffset: 0;
    yoffset: 4;
    zoffset: 0;
  }
  building {
    sprite:  rnd_streethouses_NW;
    xextent: 8;
    yextent: 8;
    zextent: 16;
    xoffset: 8;
    yoffset: 4;
    zoffset: 0;
  }
}


The NML compiller is reportin 1 ERROR and 1 WARNING:
* Block 'rnd_houses_NW' is not referenced, ignoring. - for line with random switch definition.
* Expected a reference to a spriteset. for line with sprite layour reference to sprite

I assume, that it means, I can't use rnd_switch once I am assigning sprites via sprite_layout, is that so?

Do you have any other idea, how to implement such a random sprite selection together with spritelayout?


Thank you very much.


Top
   
PostPosted: Tue May 30, 2017 10:13 am 
Offline
Transport Coordinator
Transport Coordinator

Joined: Mon Nov 07, 2011 7:32 pm
Posts: 330
Location: PL
MarkyParky wrote:
I assume, that it means, I can't use rnd_switch once I am assigning sprites via sprite_layout, is that so?

Do you have any other idea, how to implement such a random sprite selection together with spritelayout?

You can not assign switch or random switch to 'sprite' property. You can assign only static sprite or spriteset.
In your case you should define 4 spritelayouts (for 4 versions of your building) and use them in random switch triggered by 'default' callback.
Or, you can define one spriteset with 4 sprites (for 4 versions of your building) and use them in your spritelayout with manual selecting which sprite (building version) should be displayed (previously you should use STORE_TEMP(sprite_number, XXX) to select apropriate sprite):
Code:
spritelayout my_house_spritelayout {
    ground {
        [...]
    }
    building {
        sprite: my_house_spriteset(LOAD_TEMP(XXX));
        [...]
    }
}

_________________
Image


Top
   
PostPosted: Wed Jun 07, 2017 10:34 am 
Offline
Engineer
Engineer

Joined: Thu Nov 20, 2003 3:20 pm
Posts: 89
Thnx,

The second option seems fine, I'll try it.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2018 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2018.
Hosted by Zernebok Hosting.