CRPL - is there a way to disallow tech (mortar, sprayer or cannon) in an area

BilboGCL · 1953

BilboGCL

  • Community Guild
  • *****
    • Posts: 485
Hi
is there a way to disallow tech in a specified area, I don't mean "destroy every cannon in this field" but "don't let me build or move a cannon in/to this area"?
As an alternative, can I remove techs?
I'm thinking of something like

- fight with everything you have
after clearing "starting battlefield"
- loose mortars, fight on with cannons
after clearing "second battlefield"
- loose cannons, fight on with mortars

--- Time to think before post... ---
With something like
Code: [Select]
GetAllUnitsInRange(50 50 20 1) 0 do
->unit
if(GetUnitType(<-unit) "PULSECANNON" eq)
Destroy(<-unit 1)
endif
loop
I'm able to let incoming units explode, but I still lack the possibility of disallowing to build a cannon.

Greetings from The Shire!



Hey, come to the dark side Discord, we have cookies!


GoodMorning

  • Community Guild
  • *****
    • Posts: 3456
  • (Pusillanimous)
You're using GAUIR, so it will pick up still-building units. Add an OperateWhilePaused, and you're set.

With that being said, be sure to mark it clearly. Also, there is a SetTechLimit command which will not affect existing units.

A narrative is a lightly-marked path to another reality.


BilboGCL

  • Community Guild
  • *****
    • Posts: 485
Ah, okay!
Atm, I don't get why I need OperateWhilePaused: As far as I see, no unit will ever move while the game is paused. What do I miss?

SetTechLimit will affect the forge, but looking that up in the CRPL-reference lead me directly to SetBuildLimit, the command I have overseen before asking ;)

Greetings from The Shire!

Hey, come to the dark side Discord, we have cookies!


GameGibu

  • Full Member
  • ***
    • Posts: 267
  • Last place, every time.
Just thought of a way to prevent units being placed/built in an area, but this would apply to all units, not specifically weapons or any subset thereof, so I cannot make any guarantee that this answers your question.

You could, in a range, get the coordinates of all tiles in range and use the command
Code: [Select]
<-x <-y dup2 GetCellOccupiedCount 1 add SetCellOccupiedCountfor each x,y in that range, then do the opposite when/if the core leaves/is deactivated/is destroyed.

Another thought just now, you could destroy specific units that are in build state if you call
Code: [Select]
<-unit Damage...I think, since any damage to an in-progress building causes immediate destruction. Except reading the top post again makes me realize that you are specifically not asking for this second approach.  ::) Duh.

Bringing you Custom maps since 2971!
☆CRPL Master☆


GoodMorning

  • Community Guild
  • *****
    • Posts: 3456
  • (Pusillanimous)
OWP will ensure that placed buildings explode before unpause, to allow the player to feel out the death-range if it's not clearly marked.

A narrative is a lightly-marked path to another reality.