Forum

> > CS2D > Scripts > [Script] Custom map editor saving
Forums overviewCS2D overview Scripts overviewLog in to reply

English [Script] Custom map editor saving

8 replies
To the start Previous 1 Next To the start

old [Script] Custom map editor saving

_oops
User Off Offline

Quote
Hello, I made a script that players able to do map editing in the game by using @cs2d cmd settile command.

IMG:https://i.imgur.com/6WY86jd.png


But I know that this is meaningless if script can not save edited data.

I searched for similar scripts - file cs2d MikuAuahDark: Map Protection v1.0 ,and someone uploaded old C4 server script previously but seems like it has been deleted ( here, this is file )
also I read about map format spec text file however, I couldn't find clear way to make new individual cs2d map file.

The way how I am thinking about make new individual map file is -
1. use cs2d lua cmd tile command to get frames with loop ( start with 0 to cs2d lua cmd map("xsize"), 0 to cs2d lua cmd map("ysize") )
2. Convert em into hexadecimal value
3. Save it as new map_name.map file

so.. question is
How can I write a map that currently running in server as new map file via lua?
Writing header ( Unreal Software's CS2D Map File (max) ), tiles and stuffs. any example or tips?

old Re: [Script] Custom map editor saving

Gaios
Reviewer Off Offline

Quote
I have written a map format in PHP and C#, same would go with Lua. You can contact me at discord Gaios#9324 so we can finish the project . Be aware that the Lua script that you have found may be outdated.
edited 1×, last 30.10.19 10:18:13 am

old Re: [Script] Custom map editor saving

_oops
User Off Offline

Quote
Eeee, I want save the map with lua, so about the before convert data into binary, I need to write basic header as string value ( Unreal Software's CS2D Map File (max) ) and.. What about unused string, integer values? Do I just add empty string value for fill the place of unused parts?
Little example would be thankful

old Re: [Script] Custom map editor saving

VADemon
User Off Offline

Quote
Yes, correct. You just write out values as-is and numbers in their proper binary format.
If there's something unused, it's probably best to write 0x00 - I think this is what CS2D does. You'll also need to work a lot inside a hex editor to make sure everything's alright.

old Re: [Script] Custom map editor saving

DC
Admin On Online

Quote
Yes, what user VADemon said. It's also mentioned in the file:
Quote
BYTE/SHORT/INT defaults to the value 0 (use default when -unused-)
STRING defaults to an empty string with linebreak (use default when -unused-)


It actually doesn't matter which value you write for the -unused- fields because they are not used at all. But they may be used in future so writing 0 / empty string makes it future proof.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview