![]() |
Tile replacing
So say I want to replace all bushes and swamp in a level with normal grass tiles. Both bushes and swamp patches are comprised of 4 different tiles (8 in total) so using fill is not possible. I want to do this for several levels so using the level editor to replace them would be too time consuming. So I write a loop to check if each tile in a level is one of the 8 different tiles I want to replace, and if so it uses "tiles[x,y] =" to replace it. This works. The problem is that when I hit F4 and go back to the level editor, all the replaced tiles have reverted to their original form. Is there a way around this? If there isn't, there should be.
|
Update the board.
updateboard x,y,width,height; I haven't done anything of this sort in a while, but I am thinking at the end you can do (at the end): PHP Code:
PHP Code:
|
updateboard doesn't save the tiles into the level file. updateboard2 does.
|
I tried both updateboard and updateboard2 and nothing happened. I made a simple version of the script (intended to replace only one tile) and that didn't work either.
NPC Code: The tile is changed while I'm playing on the level, but still reverts when I go back to the level editor. |
Quote:
|
Quote:
-Create a dbnpc -Create a list of levels that you want to change, and set it to a string such as this.levels -Have the dbnpc warpto each level on creation with a for loop. -In every instant of the loop, have the dbnpc check for each tile on the level -If the tile is what you're searching for use tiles[tx,ty] to set the tile -Now you can either update the tile each time the dbnpc sets it by doing updateboard2 tx,ty,1,1; or you can have the dbnpc update the whole level at the end of each for loop instance by doing updateboard2 0,0,64,64; |
Quote:
Quote:
|
Wait, so there's no way for an offline NPC to make permanent changes to a level?
|
Negative.
|
Quote:
If nothing is working, try testing your scripts as an 'editnpc' one. |
Quote:
|
It would be nice if Stefan would tell us the mechanics behind how tiles are saved in text format. We could make a script to write directly to the level as text. :(
|
Quote:
Quote:
|
| All times are GMT +2. The time now is 04:02 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.