This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
crpl:crpltutorial:code_examples [2015/04/07 02:40] – Contributed 'GetClosestUnitToCoords' at the bottom. Telanir | crpl:crpltutorial:code_examples [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | < | ||
< | < | ||
====== Code Examples ====== | ====== Code Examples ====== | ||
+ | |||
Code examples contributed by map makers and coders alike. Feel free to submit your own - it will be much appreciated. | Code examples contributed by map makers and coders alike. Feel free to submit your own - it will be much appreciated. | ||
You can also view the scripts in any map: make a copy of the map you want to inspect, rename the copy " | You can also view the scripts in any map: make a copy of the map you want to inspect, rename the copy " | ||
+ | |||
+ | <wrap hi> | ||
===== Manage Treasure Chests in Credits Mission ===== | ===== Manage Treasure Chests in Credits Mission ===== | ||
Line 875: | Line 877: | ||
#If all units are outside of the maxDistance or none found returns integer value ' | #If all units are outside of the maxDistance or none found returns integer value ' | ||
: | : | ||
- | -> | + | asfloat |
- | -> | + | asfloat |
- | ->gcu_x | + | asfloat |
StackSize -> | StackSize -> | ||
Line 936: | Line 938: | ||
#Simple convenience method. Takes a unit and returns the coordinates. | #Simple convenience method. Takes a unit and returns the coordinates. | ||
#' | #' | ||
- | #Notation: n1 - y x | + | #Notation: n1 - x y |
#eg. < | #eg. < | ||
:UnitCoords | :UnitCoords | ||
Line 962: | Line 964: | ||
</ | </ | ||
< | < | ||
+ | |||
+ | |||
+ | ===CRPL generating CRPL=== | ||
+ | This CRPL will generate CRPL with custom program (if it is in the map scripts) | ||
+ | < | ||
+ | CreateUnit(" | ||
+ | AddScriptToUnit(< | ||
+ | </ | ||
+ | <sub> Stolen from Teknotiss(who took it from virgil), where pyramids make golems. I simply changed golem to unit. Added by cpaca, known as Karma' |