This shows you the differences between two versions of the page.
cw4:4rpl_tools [2024/02/18 20:50] – Updated sound players (fixed incorrect sound orders) Vertu | cw4:4rpl_tools [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 583: | Line 583: | ||
$rmb:1 # right click button | $rmb:1 # right click button | ||
- | Once | ||
- | @MakeSoundList | ||
- | endOnce | ||
- | if (GetMappedKey(" | + | if(< |
+ | |||
+ | if (GetMappedKey(" | ||
+ | 2 -> | ||
Mod(< | Mod(< | ||
< | < | ||
Line 593: | Line 593: | ||
endIf | endIf | ||
- | if (GetMappedKey(" | + | if(GetMappedKey(" |
+ | 2 -> | ||
Mod2(< | Mod2(< | ||
< | < | ||
Line 600: | Line 601: | ||
if (GetMouseButtonDown(< | if (GetMouseButtonDown(< | ||
- | PlaySoundAtPosition(< | + | PlaySoundAtPosition(< |
endif | endif | ||
:Once | :Once | ||
-1 ->index #So we start at 0, not 1. | -1 ->index #So we start at 0, not 1. | ||
+ | @MakeSoundList | ||
: | : | ||
Line 825: | Line 827: | ||
$rmb:1 # right click button | $rmb:1 # right click button | ||
- | Once | + | if(< |
- | @MakeSoundList | + | |
- | CreateUnitOnTerrain(" | + | |
- | false | + | |
- | Getpause | + | |
- | endOnce | + | |
SetUnitPosition(< | SetUnitPosition(< | ||
- | if(GetMappedKey(" | + | if(GetMappedKey(" |
+ | 2 -> | ||
Mod(< | Mod(< | ||
< | < | ||
Line 839: | Line 838: | ||
endIf | endIf | ||
- | if(GetMappedKey(" | + | if(GetMappedKey(" |
+ | 2 -> | ||
Mod2(< | Mod2(< | ||
< | < | ||
Line 866: | Line 866: | ||
:Once | :Once | ||
-1 ->index #So we start at 0, not 1. | -1 ->index #So we start at 0, not 1. | ||
+ | @MakeSoundList | ||
+ | CreateUnitOnTerrain(" | ||
+ | false -> | ||
+ | Getpause ->pause | ||
: | : | ||
Line 2208: | Line 2212: | ||
#By Vertu | #By Vertu | ||
- | $HEIGHT:100.0 #Float or Integer | + | $HEIGHT:3000.0 #Float or Integer |
- | $RAND_MAX:8 #Integer | + | $RAND_MAX:15 #Integer |
- | $RAND_MIN:-8 | + | $RAND_MIN:25 #Integer |
+ | $STEP: | ||
+ | $$BUFFER:2 | ||
- | if(GetKey(" | + | if(< |
+ | |||
+ | if(GetKey(" | ||
+ | true -> | ||
GetSelectedUnits ->units | GetSelectedUnits ->units | ||
do(GetListCount(< | do(GetListCount(< | ||
GetUnitPosition(< | GetUnitPosition(< | ||
- | SetUnitPosition(< | + | SetUnitPosition(< |
GetTerrain(GetUnitCell(< | GetTerrain(GetUnitCell(< | ||
GetUnitPosition(< | GetUnitPosition(< | ||
Line 2222: | Line 2231: | ||
SetUnitOccupiesLand(< | SetUnitOccupiesLand(< | ||
else | else | ||
- | if(< | + | if(< |
endif | endif | ||
loop | loop | ||
endif | endif | ||
- | if(GetKey(" | + | if(GetKey(" |
+ | true -> | ||
GetSelectedUnits ->units | GetSelectedUnits ->units | ||
do(GetListCount(< | do(GetListCount(< | ||
GetUnitPosition(< | GetUnitPosition(< | ||
- | SetUnitPosition(< | + | SetUnitPosition(< |
GetTerrain(GetUnitCell(< | GetTerrain(GetUnitCell(< | ||
GetUnitPosition(< | GetUnitPosition(< | ||
Line 2236: | Line 2246: | ||
SetUnitOccupiesLand(< | SetUnitOccupiesLand(< | ||
else | else | ||
- | if(< | + | if(< |
endif | endif | ||
loop | loop | ||
endif | endif | ||
- | if(GetKey(" | + | if(GetKey(" |
+ | true -> | ||
GetSelectedUnits ->units | GetSelectedUnits ->units | ||
do(GetListCount(< | do(GetListCount(< | ||
GetUnitPosition(< | GetUnitPosition(< | ||
- | SetUnitPosition(< | + | SetUnitPosition(< |
GetTerrain(GetUnitCell(< | GetTerrain(GetUnitCell(< | ||
GetUnitPosition(< | GetUnitPosition(< | ||
Line 2250: | Line 2261: | ||
SetUnitOccupiesLand(< | SetUnitOccupiesLand(< | ||
else | else | ||
- | if(< | + | if(< |
endif | endif | ||
loop | loop | ||
endif | endif | ||
- | if(GetKey(" | + | if(GetKey(" |
+ | true -> | ||
GetSelectedUnits ->units | GetSelectedUnits ->units | ||
do(GetListCount(< | do(GetListCount(< | ||
GetUnitPosition(< | GetUnitPosition(< | ||
- | SetUnitPosition(< | + | SetUnitPosition(< |
GetTerrain(GetUnitCell(< | GetTerrain(GetUnitCell(< | ||
GetUnitPosition(< | GetUnitPosition(< | ||
Line 2264: | Line 2276: | ||
SetUnitOccupiesLand(< | SetUnitOccupiesLand(< | ||
else | else | ||
- | if(< | + | if(< |
endif | endif | ||
loop | loop | ||
endif | endif | ||
- | if(GetKey(" | + | if(GetKey(" |
+ | true -> | ||
GetSelectedUnits ->units | GetSelectedUnits ->units | ||
do(GetListCount(< | do(GetListCount(< | ||
GetUnitPosition(< | GetUnitPosition(< | ||
- | SetUnitPosition(< | + | SetUnitPosition(< |
GetTerrain(GetUnitCell(< | GetTerrain(GetUnitCell(< | ||
GetUnitPosition(< | GetUnitPosition(< | ||
Line 2278: | Line 2291: | ||
SetUnitOccupiesLand(< | SetUnitOccupiesLand(< | ||
else | else | ||
- | if(< | + | if(< |
endif | endif | ||
loop | loop | ||
endif | endif | ||
- | if(GetKey(" | + | if(GetKey(" |
+ | true -> | ||
GetSelectedUnits ->units | GetSelectedUnits ->units | ||
do(GetListCount(< | do(GetListCount(< | ||
GetUnitPosition(< | GetUnitPosition(< | ||
- | SetUnitPosition(< | + | SetUnitPosition(< |
GetTerrain(GetUnitCell(< | GetTerrain(GetUnitCell(< | ||
GetUnitPosition(< | GetUnitPosition(< | ||
Line 2292: | Line 2306: | ||
SetUnitOccupiesLand(< | SetUnitOccupiesLand(< | ||
else | else | ||
- | if(< | + | if(< |
endif | endif | ||
loop | loop | ||
endif | endif | ||
if(GetKey(" | if(GetKey(" | ||
+ | true -> | ||
GetSelectedUnits ->units | GetSelectedUnits ->units | ||
do(GetListCount(< | do(GetListCount(< | ||
Line 2306: | Line 2321: | ||
SetUnitOccupiesLand(< | SetUnitOccupiesLand(< | ||
else | else | ||
- | if(< | + | if(< |
endif | endif | ||
loop | loop | ||
endif | endif | ||
- | if(GetKey(" | + | if(GetKey(" |
+ | true -> | ||
GetSelectedUnits ->units | GetSelectedUnits ->units | ||
do(GetListCount(< | do(GetListCount(< | ||
Line 2318: | Line 2334: | ||
SetUnitPosition(< | SetUnitPosition(< | ||
loop | loop | ||
+ | endif | ||
+ | |||
+ | if(< | ||
+ | false -> | ||
+ | < | ||
endif | endif | ||
Line 2338: | Line 2359: | ||
New towers will be constructed if they can connect to: existing riftlab, m-rift, pylons, energy pods and towers. | New towers will be constructed if they can connect to: existing riftlab, m-rift, pylons, energy pods and towers. | ||
+ | |||
+ | To run the console script, simply let it run continuously. | ||
<hidden click here for source code> | <hidden click here for source code> | ||
Line 2344: | Line 2367: | ||
# AutoTowerGrid | # AutoTowerGrid | ||
# by Kalli | # by Kalli | ||
+ | # Script is to run continuously in the console! | ||
$pacMode:0 # Makes all units built by the pilot unselectable and undeletable by the player | $pacMode:0 # Makes all units built by the pilot unselectable and undeletable by the player | ||
Line 2916: | Line 2940: | ||
The snapping tool makes use of a unit for highlighting the nearest buildable cell, so it's a cpack instead of a script : [[https:// | The snapping tool makes use of a unit for highlighting the nearest buildable cell, so it's a cpack instead of a script : [[https:// | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Make Units Unselectable ===== | ||
+ | |||
+ | You can make friendly/ | ||
+ | |||
+ | The $ variables are now set so that friendly (=human) units are set unselectable and undestroyable, | ||
+ | |||
+ | Enemy (=creeper) units are always undestroyable. Changing this setting with 4rpl does nothing, but also doesn' | ||
+ | |||
+ | The script can be used from the console, or be added as a global script to a cpack. If used as a global script, then the script must run while paused. It will only apply to units that exist at map start. | ||
+ | |||
+ | <hidden click here for source code> | ||
+ | |||
+ | <code 4rpl MakeUnitsUnselectable.4rpl> | ||
+ | |||
+ | # MakeUnitsUnselectable | ||
+ | |||
+ | # The script can be used from the console, or be added as a global script to a cpack. | ||
+ | # If used as a global script, then the script must run while paused. It will only apply to units that exist at map start. | ||
+ | |||
+ | $applyToFriendlyUnits: | ||
+ | |||
+ | $applyToEnemyUnits: | ||
+ | |||
+ | $applyToAllUnits: | ||
+ | |||
+ | $makeUnitsSelectable: | ||
+ | $makeUnitsDestroyable: | ||
+ | |||
+ | :once | ||
+ | GetMapSize 2 div -> | ||
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | 0 -> | ||
+ | else | ||
+ | < | ||
+ | endif | ||
+ | |||
+ | # The position is the center of the map. The max possible range for units within the map boundaries is (512/2^2 + 128/ | ||
+ | "" | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | loop | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Set terrain higher than 20 ===== | ||
+ | A console script that lets you place terrain higher than 20. Details below. | ||
+ | <hidden click here for source code> | ||
+ | Notes about terrain higher than 20:\\ | ||
+ | * There is a limit to how high terrain can be before it causes an overflow and crashes your game should the script try to make that terrain height. I have limited the script to a height of 100 to be safe, I have not tested when this crash occurs but I do know it does. Terrain higher than 100 gets excessive anyways. | ||
+ | * The game was not built to account for terrain higher than 20, this means Creeper will not render at the top of the terrain but at a height of 20 (the maximum terrain height) should Creeper be on terrain higher than 20. | ||
+ | * The build system does not detect terrain higher than 20, you have to point your mouse down as if it was a height of 20 in order to place units on that terrain. Obviously the best workaround to this is using top-down view. | ||
+ | * The game doesn' | ||
+ | * The surfaces of various terrain higher than 20 will have **<fc # | ||
+ | * I recommend only using terrain higher than 20 for visual effect rather than gameplay due to Creeper not rendering at the surface of the terrain. Best to make it impossible for Creeper to reach such areas. | ||
+ | <code 4rpl SetTerrainAbove20.4rpl> | ||
+ | # SetTerrainAbove20 | ||
+ | #By Vertu. | ||
+ | |||
+ | $HEIGHT: | ||
+ | |||
+ | $$BUFFER:2 | ||
+ | |||
+ | if(< | ||
+ | |||
+ | if(< | ||
+ | GetPointerTerrainCoords ->y1 ->x1 | ||
+ | if(IsV2InMap(V2(< | ||
+ | true ->phase2 | ||
+ | Trace4(" | ||
+ | else | ||
+ | Trace(" | ||
+ | endif | ||
+ | else | ||
+ | if(< | ||
+ | GetPointerTerrainCoords ->y2 ->x2 | ||
+ | if(IsV2InMap(V2(< | ||
+ | false ->phase2 | ||
+ | Trace4(" | ||
+ | else | ||
+ | Trace(" | ||
+ | endif | ||
+ | endif | ||
+ | endif | ||
+ | if(GetKeyDown(" | ||
+ | <-y2 1 add <-y1 do | ||
+ | < | ||
+ | while I J GetTerrain < | ||
+ | SetTerrainInRange(I J < | ||
+ | endwhile | ||
+ | loop | ||
+ | loop | ||
+ | ClearTraceLog | ||
+ | Trace4(< | ||
+ | Height set to " < | ||
+ | EditAddUndo(0) | ||
+ | endif | ||
+ | |||
+ | if(GetKeyDown(" | ||
+ | ClearTraceLog | ||
+ | Trace4(< | ||
+ | Height set to " < | ||
+ | GetPointerTerrainCoords ->posZ ->posX | ||
+ | FloodFillTerrain(< | ||
+ | do(GetListCount(< | ||
+ | EV2(< | ||
+ | while <-cellyX <-cellyZ GetTerrain < | ||
+ | SetTerrainInRange(< | ||
+ | endwhile | ||
+ | loop | ||
+ | Trace3(" | ||
+ | EditAddUndo(0) | ||
+ | endif | ||
+ | |||
+ | if(GetKey(" | ||
+ | < | ||
+ | ClearTraceLog | ||
+ | Trace4(< | ||
+ | Height set to " < | ||
+ | < | ||
+ | endif | ||
+ | if(GetKey(" | ||
+ | < | ||
+ | ClearTraceLog | ||
+ | Trace4(< | ||
+ | Height set to " < | ||
+ | < | ||
+ | endif | ||
+ | |||
+ | :Once | ||
+ | < | ||
+ | "Key binds: | ||
+ | SpaceBar to specify coordinates, | ||
+ | |||
+ | PageUp and PageDown to increase and decrease set terrain height. | ||
+ | |||
+ | Pressing Keypad0 will conduct a flood-fill to set terrain to specified height." | ||
+ | Trace(< | ||
+ | Trace3(" | ||
+ | -1 ->x1 | ||
+ | -1 ->x2 | ||
+ | -1 ->y1 | ||
+ | -1 ->y2 | ||
+ | </ | ||
+ | |||
+ | </ | ||
---- | ---- | ||
Line 3282: | Line 3463: | ||
<fs large> | <fs large> | ||
< | < | ||
- | V3(cos(RandFloat | + | V3(cos(RandFloat RandInt(0 7) +) <-RADIUS * <-cellX + < |
</ | </ | ||
<fs large> | <fs large> | ||
< | < | ||
- | V2(cos(RandFloat | + | V2(cos(RandFloat RandInt(0 7) +) <-RADIUS * <-cellX + sin(RandFloat RandInt(0 7) +) <-RADIUS * <-cellZ +) -> |
</ | </ | ||
Line 3306: | Line 3487: | ||
if(GetEditMode !) | if(GetEditMode !) | ||
GetUnitPosition(self) -> | GetUnitPosition(self) -> | ||
- | SetUnitPosition(self V3(cos(RandFloat | + | SetUnitPosition(self V3(cos(RandFloat RandInt(0 7) +) 45 * < |
endif | endif | ||
</ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | ---- | ||
+ | ===== Random X-Z position along the circumference of a circle ===== | ||
+ | |||
+ | <hidden click here for source code> | ||
+ | This is a simple piece of trigonometry that is able to pick a random position along the circumference of a circle on the X-Z plain with a definable radius. This is useful in the event you wish to introduce circles into your 4RPL code's behavior.\\ | ||
+ | Uses [[4rpl: | ||
+ | Note: Floats will work for the radius.\\ | ||
+ | \\ | ||
+ | < | ||
+ | RandFloat RandInt(0 7) + ->angle | ||
+ | V3(cos(< | ||
+ | </ | ||
</ | </ | ||