M32 script examples

From EDukeWiki
Jump to navigation Jump to search
Build/Mapster32 Map Editing
Mapster32 Scripting

This page documents the semi-official scripted Mapster32 enhancements implemented in samples/a.m32.


state printlights

Calling this routine prints all Polymer SE lights in the current map formatted as expected by maphack files to the console, so that they can be copied and pasted from mapster32.log.


EVENT_PREKEYS3D

Various keys are overridden for special purposes in 3D mode when this event is enabled.

  • When aiming at a Polymer SE light, the following key bindings on the keypad become active:

/
*
-
7
8
9
+
4
5
6
1
2
3

.






KP 4,5,6,8
angle/horizon
KP 7,9
range (light distance)
KP+/-
spotlight cone radius
KP 1,2,3
RGB color (Shift inverts)





Also, various modifiers (usually Shift and/or Ctrl) affect in what increments these values are changed.

Finally, Alt-KP1 asks for RBG values and Alt-KP2 for a tile number used as light projection.


  • When aiming at a wall or a sector with r_pr_override* enabled (you have to enable them manually from the console), certain keys let you tweak the overridden parallax and specular parameters:

/
*
-
7
8
9
+
4
5
6
1
2
3

.






KP 8,5
parallaxscale
KP 4,6
parallaxbias
KP *,/
specularfactor
KP 7,9
specularpower

Both Ctrl and Alt multiply the increment by 10 (seperately).

  • When aiming on a sprite, Alt-KP1 queries you for the values of the x/y/zvel members.


Geometry manipulations

state rotselspr

Using this routine, you can rotate a collection of sprites around a pivot sprite by an arbitrary angle.

To use it, first select the sprites you want to rotate using RSHIFT. Next, bring the mouse pointer close to the sprite you wish to be the pivotal one so that it blinks. To carry out the rotation, enter the following command in the console:

do set dang <angle in BUILD units>, state rotselspr

where positive angle values specify clockwise rotation.


state duprot and state duplin in EVENT_ANALYZESPRITES

These routines permit you to duplicate a collection of sprites in a circular arc or a straight line, adding a z offset to each step. The main use of them is the construction of sprite stairways.

Their usage is documented as a tutorial in m32script_ex.map.



Miscellaneous functions

EVENT_INSERTSPRITE3D

When this event is enabled, inserting a LOCATORS sprite will auto-increment its lotag value by setting it to the maximum lotag value of all LOCATORS in its sector plus one.


EVENT_KEYS3D

This event defines a few convenience function for the SPACE key:

  • When hit on a door wall (but not a swinging door), its sound will play.
  • When hit an on SE7 (teleporter/water) or SE17 sprite, it will teleport you to the other location.