How to program certain, fixed unit in Crate?

Dune2000, Dune 2000, D2K

Information and discussion for custom maps and mods.
Post Reply
Adrian
Posts: 135
Joined: Wed Feb 12, 2020 5:44 pm

How to program certain, fixed unit in Crate?

Post by Adrian »

How to program certain, fixed unit in Crate?
Do you know these little blue boxes in Dune2000? With different unexpected surprises: actions, units and so on.

For example — I want MCV in the crate.

Adrian
Posts: 135
Joined: Wed Feb 12, 2020 5:44 pm

Re: How to program certain, fixed unit in Crate?

Post by Adrian »

Something like an answer.

I made new object "crate2".
It inerits something from "crate" but it switch off many properties.
So this is variant of solution.

But I suppose it can be made another way.

Code: Select all

crate2:
	Inherits: crate
	Tooltip:
		Name: Crate2
	RenderSprites:
		Image: crate
	GiveUnitCrateAction@MCV1:
		#SelectionShares: 10
		Units: mcv
		TextNotification: Mobile Construction Vehicle
	-GiveUnitCrateAction@Trooper:  # switch off old properties
	-RevealMapCrateAction:
	-HideMapCrateAction:
	-GiveCashCrateAction@1:
	-GiveCashCrateAction@2:
	-GiveCashCrateAction@3:
	-ExplodeCrateAction@1:
	-LevelUpCrateAction:

Adrian
Posts: 135
Joined: Wed Feb 12, 2020 5:44 pm

Re: How to program certain, fixed unit in Crate?

Post by Adrian »

In original "crate" used another code for "mcv". And only for "mcv".
GiveBaseBuilderCrateAction

For other units:
GiveUnitCrateAction

Original code for "mcv".

Code: Select all

	GiveBaseBuilderCrateAction:
		SelectionShares: 0
		NoBaseSelectionShares: 9001
		Units: mcv
It does not work in my "crate2". I tried.
I don't know why. Maybe somebody knows?

And it works with this.
GiveUnitCrateAction
As in code in the message above.

Adrian
Posts: 135
Joined: Wed Feb 12, 2020 5:44 pm

Re: How to program certain, fixed unit in Crate?

Post by Adrian »

Another question.

How to switch off properties when I make inheritance?

For example. We have 3 "cash givings" in the Crate object:

GiveCashCrateAction@1
GiveCashCrateAction@2
GiveCashCrateAction@3

The code, for details
(it is not very important now).

Code: Select all

	GiveCashCrateAction@1:
		Amount: 750
		SelectionShares: 25
		UseCashTick: true
	GiveCashCrateAction@2:
		Amount: 1000
		SelectionShares: 50
		UseCashTick: true
	GiveCashCrateAction@3:
		Amount: 1500
		SelectionShares: 25
		UseCashTick: true
Actually, I can switch off them (in new object) by dint of "-".

-GiveCashCrateAction@1:
-GiveCashCrateAction@2:
-GiveCashCrateAction@3:

My aim.
I would like to switch off all them. At one line.

But if write
-GiveCashCrateAction:
it gives error
Exception of type `System.ArgumentException`: Collection must not be empty.

The same error with
-GiveCashCrateAction@1-3:

---------------------------------

So why do I need it, in general?

Of course, it is not difficult to write three lines.
But! This is not so easy, for example, for
GiveUnitCrateAction.

It is more than twenty properties!

GiveUnitCrateAction@LightInfantry:
GiveUnitCrateAction@Trooper:
GiveUnitCrateAction@Engineer:
GiveUnitCrateAction@Thumper:
GiveUnitCrateAction@Grenadier:

and many other.

Post Reply