Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: Shockblast DX on February 20, 2021, 05:54:37 PM

Title: Request: Unpassable Terrain Level Script
Post by: Shockblast DX on February 20, 2021, 05:54:37 PM
I'm looking for some help in making a script that makes Level 10 terrain unpassable to Creeper. I'm messing with a map idea, and using the void, as close as it is,  isn't functionally or aesthetically useful. I also do not mess with CRPL that often, so I don't know where I'd start doing it myself, so I'd rather ask the experts.
Title: Re: Request: Unpassable Terrain Level Script
Post by: GoodMorning on February 22, 2021, 03:12:27 AM
Here you are, if I recall my commands correctly:


once
    MapHeight 0 do
        MapWidth 0 do
I J dup2 GetTerrain 10 eq 2100 mul 1 sub SetTerrainOverride
loop
loop
endonce


Edit: Using 2148 was a poor move, it can cause pseudoterrain to overflow and look like a deep pit.
Title: Re: Request: Unpassable Terrain Level Script
Post by: TrickyPlayer on May 05, 2021, 10:28:45 AM
Quote from: GoodMorning on February 22, 2021, 03:12:27 AM
Edit: Using 2148 was a poor move, it can cause pseudoterrain to overflow and look like a deep pit.
You can have negative terrain overrides then? Never expected that to work, might be very interesting for me if it works. I mean, I could also just make all the other terrain higher but that doesn't really feel the same, you know? What do you mean by pseudoterrain by the way?
Title: Re: Request: Unpassable Terrain Level Script
Post by: GoodMorning on May 12, 2021, 02:13:41 AM
There's a Creeper-anticreeper conversion caused by a bug-turned-feature, with 32-bit ints overflowing. It was used in a lot of CW2 custom maps and is intentionally added into the later games.

Terrain overrides apparently work by overriding the normal terrain when calculating Creeper flow. This is pseudo-terrain. At the time, shields also added their own smaller amount of pseudo-terrain (they're now field-based as of a later update). So there was a chance for the terrain to "convert" from very high to very low by integer overflow.

A negative terrain override is clamped to 0. Achieving that overflow-effect is now also much harder, perhaps not doable.

Using terrain overrides, you can get the effect of a 1000-high plateau and a 1000-deep pit by making your "normal" land height 1000 by override. But then terps aren't effective without more scripting which causes lag.