Is there a way to see, if a Bertha has hit next to a CRPL core?

Started by BilboGCL, September 08, 2017, 10:16:04 AM

Previous topic - Next topic

BilboGCL

Hi,
I'm looking for a method to detect, if an emitter has been hit by a Bertha and to establish some punishment for that. As a pseudo-code I'd see a core like this:

- Area 5x5 around the core, this core right under an emitter
- If Bertha hits, either spit a lot of creeper in this area OR set a new emitter on a random place on the map *eg*

If anyone has an idea (or, as I'm a CRPL-noob even better, a code-snippet) you'd made an old hobbit happy!

Greetings from The Shire!

Edit: Why the heck didn't I read the formerly post - sorry for double-posting, mods, you may delete this post!
Hey, come to the dark side Discord, we have cookies!

Builder17

Previous post is about removing bertha shells before these land, not double post IMHO.

Detecting big changes in creeper height around emitter might work.

Eg: there was 60 creeper while ago under emitter, then it decreases to 0 when bertha hits.

Edit: Code is untested.

Spoiler


once
   Self CONST_NULLIFIERDAMAGES FALSE SetUnitAttribute
   Self CONST_COUNTSFORVICTORY FALSE SetUnitAttribute
   Self CONST_SUPPORTSDIGITALIS FALSE SetUnitAttribute
   Self CONST_TAKEMAPSPACE FALSE SetUnitAttribute
   Self CONST_CREATEPZ FALSE SetUnitAttribute
   Self "main" "None" SetImage
   
endonce

CurrentCoords GetCreeper 5 lt if
   CurrentCoords 20 SetCreeperNoLower
endif

[close]

Karsten75

Only caveat with the "big change" method is that a singularity field may effect such a change...

You guys might want to make a wishlist for "Game next" - in that case I'd put on that list that  (at least major) weapons should expose their target to nRPL, as well as "shot fired", eg.

GoodMorning

A Bertha shell does 100 damage to the impacted Creeper. I would take 95 as the threshold, and experiment with the Singularity interaction.

V has mentioned some unspecified big changes approaching for the next game in scripting. Starting a wishlist now is possibly a useful way to go, since it's much easier to build things in than it is to add them later. Which board, K75?
A narrative is a lightly-marked path to another reality.

Builder17

1. Singularity can be disabled from forge limits, but map maker decides about that.

2. Could BilboGCL reply back to this thread?

BilboGCL

Sorry for the late reply!

The code snippet you've added checks if the creeper is lower than 5 and releases creeper if so, so it is an emitter and does not really help. But nevertheless I thank you.

The idea with loosing a lot of creeper per frame could help but offers several pitfalls:

- singularity weapon
- a dozen of more or less synced mortars could do the same damage (correct me if I'm wrong)
- a massive(!) airstrike by strafers might trigger this effect, too.

I wanted to establish an emitter that can't be fought by a Bertha, but it should be possible to fight it with conventional weapons, I don't want to punish high firepower but

And for my skills in CRPL: The easy script for the hornet (map "catch me if you can") took me one and a half hour, so you see that I really have to think what and how to do ;)

So, if there isn't a way to check for berthas, I have to forego and think of other meannesses *eg*

Greetings from The Shire!

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

Karsten75

Within the limits of CW3 CRPL, we're on the right track. I don't rightly recall as I type this, but a precautionary check on quantity of Aether might tell you if the Singularity weapon was fired. You can check for the presence of Mortars and calculate max damage of that many mortars.  Strafers and blasters are essentially ineffective against a 100+ emitter. Strafers deal as much damage as Blasters.

SO you'll not get a perfect solution, but you may get a workable solution.  Someone might micro-manage around all of these checks, but it would be a PITA. Eg, they could just apply the Aether to upgrades - but you could limit upgrade capability for those selections that are unlimited.


Postscript (There was CRPL in the wasp map??  ???

BilboGCL

OK, but I think until I'm able to do so, I have to learn a bit more of CRPL, so I think I have just to use it more often - learning by doing normally works for me.

Not in "The Wasp" map but in the hornet map ("Catch me if you can"), and you can't oversee it!

Greetings from The Shire
Hey, come to the dark side Discord, we have cookies!

GoodMorning

So far as I know, Aether-related mechanics are not exposed to CRPL. A Singularity is a unit that can be detected, though.

I What with the Mortar targeting algorithm, it's unlikely in the extreme that the specific cell this script inspects would be hit that hard. 90 Creeper damage at once doesn't tend to happen in a single frame without special effort.

I'd place a half-dozen copies of the script, looking only at their own cell and spaced around the Emitter.
A narrative is a lightly-marked path to another reality.

BilboGCL

OK, I have tried it and ... I failed!

This was my code:
Spoiler
once

# no idea if it is necessary, but declaring doesn't hurt
0 ->new
0 ->old
endonce

# look for the current depth of creeper at the position of the core
# and store the value in the variable new
CurrentCoords getCreeper ->new   

# check if new is lower than (old - 90) 
<-new <-old 90 sub lt if

# if so, give a lot of creeper to that position
CurrentCoords 2000 SetCreeper
endif

# store the value of new in old
<-old ->new
[close]

When I tried
<-new (<-old 90 sub) lt if
the result was always true :O

To be honest, I even don't see the difference in the two if-lines, by my current (missing) knowledge they should do exactly the same.

Sorry for the newbie questions, but somehow I'm lost in the use of variables with rpl

Greetings from The Shire!
Hey, come to the dark side Discord, we have cookies!

GoodMorning

First, it breaks because you are assigning old to new on the last line, not new to old.

Second, the effect of that warp notation is to reverse the order of arguments to the lt.

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

BilboGCL

Yeah - it helped a lot - no idea what I thought about that last line, stupid me ;)

However, right now I don't get the effects of the wrapped notation, but atm no need to try explaining it to me ;)

Now I have all I need, Thanks a lot

Greetings from a happy hobbit!
Hey, come to the dark side Discord, we have cookies!

GoodMorning

It's a short explanation, and it may help someone else; I'll put it here in case:

Warp notation, the short form
This...

AAA ( BBB )

...becomes this...

BBB AAA


So if AAA is a function call and BBB is the arguments, what warp notation does is allow you to write...
function ( arg1 arg2 arg3 )
...and have this converted into the stack-based form...
arg1 arg2 arg3 function
...without you having to think backwards.
[close]

When comfortable with the rest of it, most people seem to drop the warp notation.
A narrative is a lightly-marked path to another reality.

BilboGCL

OK, thanks, I think I got it!

Btw: If anyone else uses the script: Don't use digitalis, at least test it very carefully! In my test cases, digitalis brought the creeper away from the core a bit too fast, bad surprise! And if you place it right under a high value emitter, you might have problems if you run it in test-mode (not-finalized map) after clearing creeper from the menu...

Greetings from The Shire!
Hey, come to the dark side Discord, we have cookies!