Map scripting is the use of the building blocks (entities) of logic in the map to create effects, objectives, game logic flow, etc. You can use map scripting to create complex scenarios (single and multiplayer). Some map script entities are not multiplayer-safe. Some are pure server-side but their effects are seen on the clients.You do not need to be a programmer to use map scripting, because its more like connecting blocks together than actually writing code. All map scripting is done visually with no code actually needing to be written. Instead, you place the script entities into the map like you would any other entity (such as player start point), and then open the script pairs window (windows->Script pairs) and alter the values in there to hook things up to each other. Examples of when you need to use map scripting
Map Script BasicsThere is no actual 'scripting' language in map script. Instead, entities are placed in maps, and then linked together like wiring a circuit, to produce the final effect. There are three types of script entities in Hyperbol: Sensors, Logic Components, and Actions. These enties are linked to each other by commands and targets. These can be thought of as the wiring between them. When a script entity 'activates' its target, it sends the target script entity a command of your choosing. For example, a sensor might send a "player start" entity a "disable" command. This would cause the player start to no longer be available to start at. SensorsA sensor is a script entity that starts the whole thing. Without a sensor, generally nothing interesting would ever happen. For example you can put a radius sensor in the map. This sensor would activate whenever something meeting your specified criteria passed within the specified radius of the sensor. So it senses things nearby. There are many types of sensors. Some entities have a sense component and also an action component to them, as they can chain react. Nothing happens unless a sensor triggers it. So somewhere along the chain there has to be a sensor to get the ball rolling. Some entities are sensors themselves - for example, the 'destroyable props' like the core in mining facility is a sensor, because it activates when it is destroyed, allowing it to start stuff happening when it explodes. The most used sensors are:
Logic ComponentsLogic Components are generally like filters. They don't do anything themselves, but they do logic instead. For example, a Counter. Whenever a counter is activated by something (perhaps a radius sensor), it increments its count. The counter will only activate its own target(s) when the count reaches a specified amount. This lets you count things such as destroyed buildings, time in areas, etc. Even though its activated, it does not activate its own targets until the count it's looking for is reached, thus acting like a filter The most common logic component (and often the only one used) is the multiplexer. A multiplexer, once it is activated by a sensor of some kind, will in turn, activate all its own targets. It can target up to four different other entities, and can delay between each. It is therefore used for things like cinematics. Multiplexers can be chained - so for example, you can have a series of multiplexers, each activating three other scripts, moving the camera around for example, and then the fourth one is simply the next multiplexer in the chain. ActionsActions are actual things that the game does. For example, an 'entity spawner' will create entities of your choosing when activated. So if you choose for it to expel time bombs, then whenever it is activated, it will expel a time bomb. You could make a trap system, for example, by hooking a radius sensor up to a plasma bolt entity spawner, aimed towards the sensor. Then any ship touching the sensor would have a plasma bolt expelled towards it. There are also actions which end the game, restart the map, show special effects, move the camera around, and pop up "story mode" dialog boxes to the player. A lot of actions are meant for tutorial/single player and will not work well in multiplayer. For example, disabling parts of the GUI would not be something that works Multiplayer, but some scripts have been specifically designed for multiplayer. Most of the cinematics, such as screen fades, camera movements, etc, do work. Most of the dialog boxes that pop up for story/tutorial mode do not. The most common actions are
OthersThere are other miscelaneous script entities, but those generally perform dual functions or simply are a certain projectile or deployed object. The "Destroyable Prop Object" is the most popular of those. This object shows up as a model of your choosing, and is destroyable or capturable by a team of your choosing. When destroyed, it plays effects of your choosing and changes its model to another destoyed model. It also activates its targets when it is repaired, dies, or any other state change, so it acts as both an action and as a sensor. Its one of the most useful objects in the game. Scripted turrets are in this same category and can have the same triggers. Important Script Pair FieldsThe most important type of field for map scripting is the targetname, command, and target fields. The map editor has a large amount of help built into it for every type of script entity. You can see this help whenever you choose a field or a script entity, in the window below the entity chooser, or in the script pairs window. targetnameThe targetname of an entity is its actual 'name' in the scripting engine. Anytime you need to refer to that entity by another entity, you use its target name. So for example if you fill in 'joe' as the targetname of an effects spawner, then any other sensor entity that needs to activate that effect spawner, would use the word 'joe' in the various fields that need to refer to it. Its essentially a label for the entity so that it can be referred to by other entities. Note that many entities can have the SAME targetname. You can make many effects spawners all called 'joe'. This is a good timesaver. targetsSensors and other things have targets. For example, a Destroyable Prop object (like the core in mining facility) has a 'DestroyedTarget', a 'RepairedTarget' and many others. A radius sensor just has a 'Target'. A multiplexer has many targets, like Target1, Target2, Target3, Target4. All of these fields are expecting you to fill in a targetname of an entity. So in the previous example, suppose you filled in 'joe' as the targetname for an effect spawner. That effect spawner's 'targetname' is now Joe. It is how you refer to it in all other entity target fields. So if you fill in 'Joe' in the Destroyable Prop Objects 'DestroyedTarget' field, then that effect spawner would activate whenever the prop is destroyed. Because you can have many entities with the same targetname, this means if you have not just one, but MANY effects spawners all called 'joe', they will ALL activate when 'Joe' is targetted. CommandsGenerally, for each 'target' field, there is a 'command' field. For example, the multiplexer has Target1, Target2, Target3, Target4. It also has Command1, Command2, Command3, Command4. Usualy this command is 'activate' and you can generally leave it that way. Its basically a short command that the target gets fed when it is activated. So if you target that effects spawner in the previous example, by using 'Joe' as the target, but you change the command field from 'activate' to 'hooray', then all of the entities with the targetname of joe will be told to 'hooray' instead of 'activate'. This can be very useful because there are entities which listen for specific commands. you can see the commands they respond to by viewing them in the 'create entity' window. It lists the commands for the entity you're about to create. Examples of often used commands
ExampleSo for example, lets make an effect show up whenever someone enters a particular radius. First, create or load a map that has walls/arena/starts/etc. that we can use to practice. 1. Add a "radius sensor" to your map (use the entity browser)
So now you have a radius Sensor that is targetting the effect spawner Action. Now whenever a player is in this radius, the effect will spawn every second. You could get quite complex here. Here are some other things you could do with this setup.
Entity NamesSome actions and sensors require entity names. For example, the entity spawner needs entity names to fire out, and the radius sensor needs entity names to filter (if you want to filter). Here are some entity names to start with (more are coming)
Other Important Entities
Important Models for Props and DestroyablesDestroyable objects and Props take one of the following as their models. note that it takes the full path, so for sky_nexus, you'd use data/models/sky_nexus/sky_nexus.vm2 and mexfile data/models/sky_nexus/sky_nexus.mex
|
Editing/Modding >