I'm working on a CRPL feature that would involve Digitalis never decaying due to a lack of support from an emitter or suitable CRPL core. Of course, the easiest (naive) method would be to spam the entire digitalis growth area with invisible digitalis-supporting CRPL cores (which, if I am not mistaken, do not spawn in digitalis by themselves). This seems suboptimal to me.
Instead, what I tried to do was to have a master core create supporting cores whenever it detected unsupported digitalis anywhere on the map. It is easy to code the supporting core.
Spoiler
# DigiSupport.crpl
once
Self CONST_SUPPORTSDIGITALIS TRUE SetUnitAttribute
Self "main" "NONE" SetImage
Self CONST_DESTROYMODE 0 SetUnitAttribute
Self CONST_TAKEMAPSPACE FALSE SetUnitAttribute
Self CONST_NULLIFIERDAMAGES FALSE SetUnitAttribute
Self CONST_SNIPERTARGET FALSE SetUnitAttribute
Self CONST_BEAMTARGET FALSE SetUnitAttribute
Self CONST_COUNTSFORVICTORY FALSE SetUnitAttribute
Self CONST_CREATEPZ FALSE SetUnitAttribute
endonce
CurrentCoords GetDigitalis eq0 if
Self 0 Destroy
endif
But finding appropriate times to create them is a challenge. I attempted using IsDigitalisConnected (http://knucklecracker.com/wiki/doku.php?id=crpl:docs:isdigitalisconnected) in something like this:
I J IsDigitalisConnected not if
"CRPLCORE" I J CreateUnit ->unit
<-unit "DigiSupport.crpl" AddScriptToUnit
endif
However, what happened was that every tile with digitalis ended up with a DigiSupport core.
(I've mentioned this in another unrelated thread)
I am
not looking for a way to fix the multitude of DigiSupport cores. I am looking for alternate ways to support all the digitalis on the map.
Does anyone have any ideas?
(If I'm not supposed to post two topics so quickly, sorry.)
As long as core doesn't have any script but all other than "supports digitalis" one are unchecked, it shouldn't lag :)
(Master script should set correct settings to all other cores)
Please reply with test map if it doesn't work correctly :)
Quote from: Builder17 on September 10, 2018, 02:29:24 PM
As long as core doesn't have any script but all other than "supports digitalis" one are unchecked, it shouldn't lag :)
It will if you're placing thousands of cores. Even by itself, a core is a pretty heavyweight object compared to a map cell.