User Tools

Site Tools


cw4:cpack:docs:23977d46-b69d-431a-82e1-f4013f889c5a

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
cw4:cpack:docs:23977d46-b69d-431a-82e1-f4013f889c5a [2021/04/11 00:00] – Updated for script version 1.4.2 qoplecw4:cpack:docs:23977d46-b69d-431a-82e1-f4013f889c5a [2024/03/19 19:03] – [Move.4rpl] improved clarity of startRotation. LiteralNoob
Line 51: Line 51:
 Script vars: Script vars:
  
-  * baseMoveSpeed: The maximum speed the player can hit, in cells per update. High values will lead to clipping.+  * moveSpeed: The maximum speed the player can hit, in cells per update. High values will lead to clipping.
   * accelTime: The number of updates it takes for the player to reach full speed from a standstill.   * accelTime: The number of updates it takes for the player to reach full speed from a standstill.
   * decelTime: The number of updates it takes for the player to stop from full speed.   * decelTime: The number of updates it takes for the player to stop from full speed.
Line 58: Line 58:
   * collisionThreshold: The highest terrain difference that the player can walk over.   * collisionThreshold: The highest terrain difference that the player can walk over.
   * startX, startZ: The cell coordinates of the player's spawn and respawn point.   * startX, startZ: The cell coordinates of the player's spawn and respawn point.
-  * startRotation: The direction that the player points when they spawn, in degrees. 0 faces them in the positive Z direction.+  * startRotation: The direction that the player points when they spawn, in degrees. 0 faces them in the positive Z direction. Clock-Wise rotation.
   * stunDuration: How many updates the player stays stunned for. Consecutive stuns do not stack.   * stunDuration: How many updates the player stays stunned for. Consecutive stuns do not stack.
  
Line 71: Line 71:
   * startingWeapons: A string containing a list of the weapons that are unlocked upon starting the level, separated by commas. Order doesn't affect this.   * startingWeapons: A string containing a list of the weapons that are unlocked upon starting the level, separated by commas. Order doesn't affect this.
   * weaponOrder: A list of all weapons that are in the level, in order of their hotkeys. Changing the order of this will rearrange the weapon hotkeys.   * weaponOrder: A list of all weapons that are in the level, in order of their hotkeys. Changing the order of this will rearrange the weapon hotkeys.
- 
-==== Totems.4rpl ==== 
- 
-Makes all totems charge in a way usable in a first-person level. Rules are as follows: 
- 
-  * Totems will gain charge at an increasing rate while the player is within 15 cells. 
-  * Partially charged totems will stop charging when the player is outside that radius, but will not lose charge. 
-  * Totems will lose charge when there is creeper on the center cell of the unit. 
-  * Disabled totems ("unit: off") will not charge, and any existing ammo will be removed. 
- 
-There are no script vars. 
  
 ==== Vanilla Weapons.4rpl ==== ==== Vanilla Weapons.4rpl ====
Line 103: Line 92:
   * useWallOverride: Whether to use a 2000 terrain override on cells with terrain 19 and 20. If it's on, updates all cells on game start or compile.   * useWallOverride: Whether to use a 2000 terrain override on cells with terrain 19 and 20. If it's on, updates all cells on game start or compile.
   * wallUpdateRate: How often the wall overrides should be updated during game time. 1 checks the whole map every frame (not recommended), 90 checks over it every 3 seconds, and so on. Has no effect if useWallOverride is 0. Setting to 0 disables the updates, so the overrides will not change if terrain changes.   * wallUpdateRate: How often the wall overrides should be updated during game time. 1 checks the whole map every frame (not recommended), 90 checks over it every 3 seconds, and so on. Has no effect if useWallOverride is 0. Setting to 0 disables the updates, so the overrides will not change if terrain changes.
 +  * chargeTotems: Makes all totems charge in a way usable in a first-person level. Rules are as follows:
 +    * Totems will gain charge at an increasing rate while the player is within 15 cells.
 +    * Partially charged totems will stop charging when the player is outside that radius, but will not lose charge.
 +    * Totems will lose charge when there is creeper on the center cell of the unit.
 +    * Disabled totems ("unit: off") will not charge, and any existing ammo will be removed.
   * selectionMode: Controls selection and building behavior for hybrid levels. The options are: \\ 0: Default behavior \\ 1: Disables building in first person mode \\ 2: Disables building in and out of first person \\ 3: Same as 1, but also overrides selecting units \\ 4: Same as 2, but also overrides selecting units   * selectionMode: Controls selection and building behavior for hybrid levels. The options are: \\ 0: Default behavior \\ 1: Disables building in first person mode \\ 2: Disables building in and out of first person \\ 3: Same as 1, but also overrides selecting units \\ 4: Same as 2, but also overrides selecting units
   * selectableWhitelist: A comma separated list of [[4rpl:commands:unit_types|unit types]] that are still selectable when unit selection is turned off by the script. The DPS monitor is internally added to this list.   * selectableWhitelist: A comma separated list of [[4rpl:commands:unit_types|unit types]] that are still selectable when unit selection is turned off by the script. The DPS monitor is internally added to this list.
 +  * buildWhitelist: A comma separated list of unit types that are still buildable when building is turned off by the script.
  
 ===== 4RPL Extensions ===== ===== 4RPL Extensions =====
Line 140: Line 135:
 | Initialize  | Whenever a weapon pack is initialized at the start of the game, before its weapons are added to the weaponAttributes table.  | One weapon added by that script, which the script is also registered as.  | | Initialize  | Whenever a weapon pack is initialized at the start of the game, before its weapons are added to the weaponAttributes table.  | One weapon added by that script, which the script is also registered as.  |
 | DamagePlayer  | Call to damage the player by a fixed amount. Negative values will heal the player.  | The amount to damage the player  | | DamagePlayer  | Call to damage the player by a fixed amount. Negative values will heal the player.  | The amount to damage the player  |
-| AddText  | Call to display text on the bottom of the screen. Must be called every update while the text is shown. Calling it several times in one update adds a separate line for each. Useful for letting the player know something minor, or for debugging.  | The text to display  |+| AddText  | Call to display text on the bottom of the screen. Must be called every update while the text is shown. Calling it several times in one update adds a separate line for each. Useful for letting the player know something minor, or for debugging.  | The text to display. If calling from a script that runs while paused, add "WP:" before the text to display.  |
  
 ==== Interacting with Weapon Attributes ==== ==== Interacting with Weapon Attributes ====
Line 364: Line 359:
 \\ ==== Overriding Movement ==== \\ ==== Overriding Movement ====
  
-Player movement is fairly limited by defaultwith the most obvious example of this being the inability to move vertically. To move the player with a script while having the crosshair and other bits and bobs following, the basic formula is as follows: +Writing to the playerPos global will teleport the player. If high FPS is ona tween frame will be added to make movement smoother. To disable that, set the W component of the vector (the 4th one) to true. To snap the height to the terrainset the Y component to anything less than -100.
- +
-  * Register for MSG_FrameAdvance +
-  * Use the RplCam control APIs to move the camera inside that messagemultiplying the passage of time by *frameToUpdate to make sure it works at the same speed both with and without high FPS +
-  * Save the RplCam position to *playerPos and the RplCam forward to *playerForward+
  
 As soon as you stop changing the camera position, normal movement will return. As soon as you stop changing the camera position, normal movement will return.
Line 378: Line 369:
 === Unlocking a weapon === === Unlocking a weapon ===
  
-  GetRegisteredScriptVar("Player" "unlockedWeapons") "weaponName" AppendToList+<code 4RPL>GetRegisteredScriptVar("Player" "unlockedWeapons") "weaponName" AppendToList</code> 
 + 
 +=== Changing the Respawn Point === 
 +<code 4RPL>SetRegisteredScriptVar("Move" "checkpoint" <-cellX <-cellZ FC)</code>
  
 <=[[cw4:custom| Index]] <=[[cw4:custom| Index]]
  
  
cw4/cpack/docs/23977d46-b69d-431a-82e1-f4013f889c5a.txt · Last modified: 2024/03/19 19:06 by LiteralNoob