Core CRPL that is triggered by runners

Started by Tyler21, March 03, 2015, 12:15:49 PM

Previous topic - Next topic

Tyler21

Greetings!

I am close to fininshing my first map, but my skills in CRPL are still very poor, so I want to ask your help.
I'd like to create a core that can detect nearby runners and will execute further commands upon detection. Something similar to the IsCreeperInRange command.
I have already searched this forum but could not find anything useful and I assume that there is no built-in command for that. Do you have any suggestions how to implement this? Is there a way to identify unique runners instead of the runner nests? Or are the runners hard-coded?

Thanks!

p.s. I just registered today and this is my first post on the CW forum ever, even though I am a huge fan of CW since 2009.
"Enjoyment appears at the boundary between boredom and anxiety, when the challenges are just balanced with the person's capacity to act."
― Mihaly Csikszentmihalyi

Check my collection of the 30 most difficult and challenging maps in Colonial Space!

warren

#1
Runners count as units. You can use GetEnemyUnitsInRange to see them then filter using GetUnitType. As units, you can track them individually by memorising their unit ID.

Edit: if they don't show up in GetEnemyUnitsInRange, they will with GetAllUnitsInRange.

Here is a quick code. May contain bugs:


CurrentCoords 8 FALSE GetAllUnitsInRange 0 do
  ->unit
  <-unit GetUnitType "RUNNER" eq if
    @activate
  endif
loop

Tyler21

Thanks for the quick reply! It works perfectly!
"Enjoyment appears at the boundary between boredom and anxiety, when the challenges are just balanced with the person's capacity to act."
― Mihaly Csikszentmihalyi

Check my collection of the 30 most difficult and challenging maps in Colonial Space!