Resource icon

Object Skins and the Altermap Framework v1.2

What permissions do you give others to modify and/or maintain your submission?
Modify: ASK ME - Maintain: YES - Others must ask me for permission before modifying my submission or use it in their own work, and I reserve the right to say no for any reason. I do, however, give permission for my entire submission to be maintained by others.
I made sure my file(s) follow the Submissions Guidelines
  1. Yes
I named my file(s) correctly (see Filename Conventions)
  1. Yes
kart0398.gif
kart0399.gif

These mapping utilities intend to bring a little more visual flair to your maps. The Altermap Framework allows maps to have different textures on Encore load or a different theme if a server requires it. Object skins and spawn skins can change the properties of an object to effectively make it something else for your map. There are also server tools for global changes across maps. Documentation is in the scripts themselves, but they will also be explained below.


Object skins (LUA_OBSK):
Gone are the days of fighting over thing slots, making your custom objects midtextures, or struggling to reinvent the wheel to make your own custom item box. Now you can simply override an object to turn it to your unique decoration. You don't even have to worry about manually cleaning up after yourself; the script will ensure that the objects you alter are back to normal afterwards.
  • Map Header Setup: Use Lua.ObjectSkin then a comma separated list.
  • Each object to change can have all of its properties modified. The order can vary, but:
  • Start off with your object type you want to modify starting with "MT_".
  • The following arguments should alternate until the end of the level header or you want to use a new object.
    • The first argument is the type of property to change: S_RAISESTATE, S_SPAWNSTATE, etc.. This should be written as the property appears in an object definition (e.g spawnstate)
    • Changing the spawn state will also alter the current state.
    • The second is the property's new value. Use _G[MT_Object] if the new value is an object.
    • Example: lua.objectskin = MT_RANDOMITEM,spawnstate,S_BSZFISH will make every item box in your map look like a fish. This will cause no issues as items are handled by the object, rather than the state.

Spawn skins:
A method of modifying simple objects like flowers and bushes into other simple objects. A spawn skin will change the sprite and frame of every affected object in your map. Load the object skin script before your custom states and sprites.
  • Lua.spawnskin merely changes the frame and sprite of an object on spawn.
  • Like object skin enter your parameters as a comma separated list.
    • The first argument is the object to look for.
    • The second is the new sprite prefix with SPR_ in the front.
    • The third is the new frame.
    • Example: lua.spawnskin = MT_BUSH,SPR_BSZ8,C will make any bushes that spawn in your map look like a fish.

Server Usage for Global Overrides:
  • obsk_add: Adds a global override to the server. It is formatted the same as the objectskin level header.
    • Example: obsk_add MT_RANDOMITEM,spawnstate,S_BSZFISH will make every map's item boxes be fish.
  • obsk_remove: Removes a global override from the server. You can specify each state for a desired object or omit it to clear all custom states.
    • Example: obsk_remove MT_RANDOMITEM,spawnstate,deathsound will clear only the spawnstate and deathsound overrides. obsk_remove MT_RANDOMITEM would clear all overrides for an item box.
  • obsk_clear: Removes all global overrides.
  • obsk_disable: Prevents global overrides from working when enabled. Level overrides cannot be disabled.
  • obsk_serverpriority: Makes global overrides load after map based ones if enabled.
  • obsk_fastload: Makes override changes immediate if enabled. May cause issues.

It is recommended to have these commands and desired parameters preloaded or from an easy to paste location instead of typing them in manually during the game.
It is ideal to execute the commands after your files are loaded so you can use custom sounds, states, or objects.


Altermap Framework (LUA_ALTM):
Altermaps are a means to give your map a different flavor which do not have to be restricted to Encore mode. Turn your desert map into a dessert map with some texture swaps and some optional lua programming! By default your alternate texture set will occur in Encore mode.

  • lua.altermap: Executes alternate map texture/brightness swaps if the the map detects it is in alternate mode. Set it to true or any other value.
    • call ALTERMAPDECLARATION with your map number in an external script after this one for a custom command name and custom altermap loading settings.
    • Example: ALTERMAPDECLARATION(1,"alterexample","Off") this gives MAP01 an altermap command of alterexample with the alternate mode only showing in Encore mode by default.
    • The command will default to altermap[mapnum] with the alternate only showing in encore mode.
  • lua.altermapsky: Sets the sky to the number defined when loaded into alternate mode.
  • lua.altermapexecute: A linedef tag to execute when in alternate mode.
  • lua.altermapbrightness: Increments all sector brightnesses by the number defined.
  • lua.altermapflats: A comma seperated list of flats to replace. The pattern is oldflat, newflat.
    • Use flatA,unusedflat,flatB,flatA,unusedflat,flatB for texture swaps.
  • lua.altermaptextures: Same usage as altermapflats but for textures.
  • lua.altermapencore: Enables an Encore mode hack which will force the map to load in its Encore style without the palette at the expense of the map not flipping. This will only occur if the unused style is shown in Encore with altermap command parameters 0 or 1.

Object/Spawn skin parameters, altermapflats, and altermaptextures allow more usage space by adding a number at the end and incrementing with each new line you need.
Example: lua.spawnskin,lua.spawnskin1,lua.spawnskin2,...

Map Utilities:
The lua linedef executor ALTERMAP can be used even if your map is not a proper altermap. By default it allows for global texture changes and brightness changes.
  • If the linedef has a backside and not Block Enemies checked then the text on the backside determines how to swap textures.
  • If the backside is SPRING for instance then texture swaps for altermapflatsspring and altermaptexturesspring in the level header are executed. The default altermapflats and altermaptextures are executed if the back side is omitted or there's no text on the back, however.
  • The x offset determines a global brightness change for the map. An x offset of -16 will make every sector in the map 16 units darker.
The global variable ISALTERMODE can also by used by your own lua scripts to determine if a map is in its alternate mode.

Examples on the MB:
  • Jam Jar's Egg Reverence uses a very early version of the object and spawn skin scripts to turn various flora into off-putting Eggman plants and BSZ fish into Modern Eggman inspired signs.
  • Abstraction Pack's Flesh Paradise was the basis for the Altermap Framework. It uses the script to turn the wicked meat palace into a more palpable happy castle with paradiseillusion enabled.

Example Wad (K_CBMapUtilShowcase.wad):
The example wad showcases the altermap framework and objectskins.​
The map changes between Spring, Fall, and Winter when the map is normally loaded. In Encore mode (or however you set the command "alterexample") the map will always be dreary and rainy. The item boxes are skinned to be MKSC item boxes which release rabbits when broken. There is also a Crawla in the map, but it is actually a 3CD Moon! Drive to the other end of the map to reload it.​

Usage permissions:
  • These scripts are not to be modified as it is would break other maps which use them. They are intended to be packaged into your own server or map file. The scripts which load first will take priority to prevent redundancy.
  • Any element from these scripts can by taken out and repurposed/modified for scripts not relating to the purpose of these scripts. Credit is appreciated in this case. As an example, the tableconcat and tableparse functions are free be taken out of either script and reused in other scripts to allow for longer level headers.
  • These scripts are free to be reused and modified to fit the needs of Vanilla SRB2. Link back to this page and credit me in some form if your version of the script is released on the MB without my collaboration.

Special thanks to Ashnal for the initial script rewrite back when this was limited only to Egg Reverence.
  • Cool!
Reactions: Lighto
Author
Chaobrother
Downloads
272
Views
1,626
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Chaobrother

Share this resource

Latest updates

  1. Altermap self conflict patch and LUA_BARR

    The mapping utilities have been updated to resolve a long self compatibility issue with the...
  2. Netgame Stability Patch

    This is a minor, but very important update that was sitting around on my hard drive for no...
Back
Top