Negative resources - condition to stop harvesters < 0 res

Information and discussion for custom maps and mods.
Post Reply
bodomalo
Posts: 37
Joined: Tue Feb 20, 2018 7:35 pm

Negative resources - condition to stop harvesters < 0 res

Post by bodomalo »

My mod has some crazy ideas, one of them is a unit seeding waste tiberium resource that gives negative credits when harvested. This should confuse players/harvesters.
So far this works.

But game will crash as soon as a player has a negative resource of less than -100, as then the shown playerresource-bar runs out of index. (negative index below 100). I guess it is just the resource bar that should not be rendeereed too low under zero.

Does someone have an idea how to solve that?

a) A condition that makes the refinery stop to accept any wast-tiberium if credits or resources are below 0

b) just do not display a negative resource-bar. But how?

c) The last idea is to just set the resource value to 0 instead of -10... this will just make harvesters collecting useless resources as long as the player does not recognize it. But I love the idea of having a negative resource (acutally it is dump-water from an RV thats seeded)

bodomalo
Posts: 37
Joined: Tue Feb 20, 2018 7:35 pm

Post by bodomalo »

ok, seems the negative index just came from the silo-storage bar on the building, that can't handle a negative image index...

there does not seem to be a way to fix that I guess :-(



mh, I can extend the silo.shp and add the empty silo a few times at the beginning. Then set the start point to for example 5. so far this seems to work...negative indices do not get below -3...resulting in index(2) then

SirCake
Posts: 393
Joined: Thu Feb 04, 2016 5:40 pm

Post by SirCake »

Hey bodomalo,

I have some similar ideas for d2kA and so delved into the topic previously. Unfortunately the resources code is hardcoded, so even a parallele resource type needs code(C#) changes in the base game libraries. (see traits: refinery, player.giveCash, player.giveResources, palyer.takeResources, player.takeCash). This means currently there is no way to distinguish beteen different resouce types in a harvester except for their value and pip color!

Also think It through: How does a player get rid of the waste in the harvesters when he has 0 cash to collect more cash to pay the waste fee? That would mean a frustrating hard lock if you run out of cash just as your harvesters are full of waste.
Zero value on the waste resources would leave the option of dumping the waste at least (so c) ). And you would still lose something if you do not micro your harvesters properly avioding all the c# logic issues.

If you really want it, I would advise manipulate player.giveResources and change it such that waste reduces cash/resources if they are not below 0 already.

Also try b) remove the resource bar. But I think that will only prolong the crash, not prevent it.

Check out Dune2k-Advanced on my moddb page!

bodomalo
Posts: 37
Joined: Tue Feb 20, 2018 7:35 pm

Post by bodomalo »

SirCake wrote: Hey bodomalo,


Also try b) remove the resource bar. But I think that will only prolong the crash, not prevent it.
So far I have added only a few more images to the silo and proc_bar (think 5 more ZERO images), and game does not crash even if credits are at -30.000

But I understand that having minus resource would be very frustrating while playing. So I might give it a value of 0
(the harvested ressource anway does not look like "Tiberium", those are just ugly potholes.

Player needs to build a "camper" unit and camp for some time near the oponents Tiberium field to spread that waste.
Maybe I even find a way to make a new weapon that can "destroy" waste (or tiberium). Not sure if tiberium can be destroyed by weapons. There is a "changeterrain" option on units.

Post Reply