Lua script for map

Hey!
I've got an idea for a new map/mode which looks easy to do. But to do it I need to know if its possible to link a lua script to a specific map? This mode/map would be an arena with 2 entrances at opposite sites. One for corruptrons and one for player's crystal. Waves of enemies will spawn as in invasion (cuz I want to do it on invasion). Players will have starting army and their goal is to survive as much as they can. After few waves he could receive new units via lua script.

I think its good improvement for CS, maybe you should make that as an official mode?

Comments

  • ShatojonShatojon Administrator Developer Backer Wiki Editor
    Hey Kuzynn!

    Sounds fun. :) I'm going to poke around the studio to get you an answer.

    Sit tight!
  • Hi Kuzyn,

    So from what I understand, you want to create a modded version of invasion in a custom map, is that correct? If that is the case, you cannot exactly "link" a lua script to a specific map, but rather create a custom game mode that you then modify to your liking, which you can then design for a specific map.

    If you're not familiar with the procedure to create a custom game mode, I'll be happy to help you with that and the mod idea you have in mind.
  • Garou1337 said:

    Hi Kuzyn,

    So from what I understand, you want to create a modded version of invasion in a custom map, is that correct? If that is the case, you cannot exactly "link" a lua script to a specific map, but rather create a custom game mode that you then modify to your liking, which you can then design for a specific map.

    If you're not familiar with the procedure to create a custom game mode, I'll be happy to help you with that and the mod idea you have in mind.

    If you can write something about this, I'll be very happy ^^Anyway I think that could be a great and simple addition to Castle Story.
    • Arena map (like colosseum made with stone bricks, without exits).
    • Starting point for player and enemy spawn.
    • No respawns for player.
    • Every wave of x waves player gets a random unit or a choice what he wants.
    • Player can't build etc. just fight.
    • The goal is to survive the highest wave.
    • Player lose when lost all units.
    So it's like invasion but just about fighting. Just a small addon.
    Also, the idea can be expanded to have something like few arenas connected and with every x lvls the new part is open and now you have to defend from 2 sides etc.
  • Alright, well first, are you familiar with the LUA programming language? Or programming in general?
    A couple things in your mod idea would require you to go in the game modes files and modify part of the user interface, for example to give the option to the player to choose a unit at the end of a wave.

    But first, you would have to create a new custom game mode:
    - Choose a gamemode amongst the ones listed there, for example, Invasion. Copy the entire folder and rename it. It has to be in the actual "Castle Story\Info\Lua\Gamemodes" path where you put it to work.
    - Go inside it and open the "meta" file.
    - Give a new codename like "CODENAME": "invasion2",
    - Give it a new display name, just so you can spot it in the gamemode choices while you've got your map selected.
    - After that, go in the "Preset" folder.
    - pick one to be a new preset for your gamemode (you can deleta the other presets, or modify several of them if you so choose). Make sure you change the codename so it matches the codename you have given to your gamemode earlier:
    "CODENAME" : "invasion2_default",
    "__DISPLAYNAME" : "Default",

    You now have created a new gamemode that you can modifiy to your liking. if you look around in the files that are at the root of your new gamemode (where you find meta, factions, RaidPresets, etc), you'll find some files that you can easily modify to change the gamemode experience.

    The config file lets you modify several parameters like the starting time of day, the wave number, wave intervals, whether you can dig the ground or not and the Bricktrons you start with. The RaidPresets file will let you customize the enemy waves that come knocking at your door.

    For the map, well, it's simple enough. Make the map to your liking in the World Editor and save it. Since your game mode works on the same principles as Invasion, you can put just the necessary markers in to satisfy the Invasion criteria.

    After that, go in your map in SandBox and build any stone blocks that you want to build your colosseum. When done, save your game. If you go in the folder where your saved games are, you'll be able to open the one which corresponds to the game that you just played (castlestory-game\Info\Saves\YourGame). It should contain a "PlacedBlocks" JSON file. Copy it and put it in your map folder (castlestory-game\Info\UGC\Maps\YourMap), basically putting the blocks as a permanent feature of the map.

    Once you've got that we can look at putting in more specific features. Let me know if you have trouble with the aforementioned steps.
  • I will try that, thanks =)
  • @Garou1337
    Okay, I've got the map and mode. Could you explain me how to do:
    - spawn friendly knight/archer/arbalest etc. at home crystal after X wave
    - do not let corruptrons destroy blocks/structures (crystal destroyable)
Sign In or Register to comment.