Page 1 of 1

How to program certain, fixed unit in Crate?

Posted: Fri Dec 20, 2024 10:10 am
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.

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

Posted: Sat Dec 21, 2024 6:29 pm
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:

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

Posted: Sat Dec 21, 2024 7:21 pm
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.

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

Posted: Sat Dec 21, 2024 8:26 pm
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.