(Question) BaseBuildings leave Husks

Is it possible to make basebuildings leave husks?

Information and discussion for custom maps and mods.
Post Reply
User avatar
Petrenko
Posts: 156
Joined: Fri Apr 08, 2011 5:36 pm

(Question) BaseBuildings leave Husks

Post by Petrenko »

Greetings,

is it possible to make basebuildings, like the silo, to leave husks after they have been destroyed?

I already added a husk actor. added a husk sequence. and added the line

LeavesHusk:
HuskActor: SILO.Husk

to the silo actor.

i copied almost everything from the oilderrick husk (v19.husk - found it in - tech.yaml)
i not only copied. i adopted for example the sequence numbers etc.

i tried to set the hulk as

Inherits: ^CivBuilding
Inherits: ^Building

but it did not work

for now i got this exception log when trying to run.

System.InvalidOperationException: Trait prerequisites not satisfied (or prerequisite loop) Actor=silo.husk Unresolved=DeadBuildingStateInfo Missing=HealthInfo

i tried to give prerequisites to the hulk and i also tried to set -prerequesite: to the husk
i haven't tried anything to the health problem yet. suggestions would be great.

but i think it could be solved by deleting the -health: from the husk actor.

another question is: where do i add the sequence? the husk-sequence for the oilderrick is in sequences/map/yaml but do i have to add my own sequence there? does it matter at all?

ehm... i guess it got a bit complicated so i will add my "code" add now:

so this is out of the structures.yaml

SILO:
Inherits: ^Building
Valued:
Cost: 450
Tooltip:
Name: Tiberium Silo
Icon: siloicnh
Description: Stores processed Tiberium
Buildable:
Queue: Defense
BuildPaletteOrder: 20
Prerequisites: anypower
Owner: gdi,nod
CashTrickler: 21 (this is something i added for another mod. don't bother)
Building:
Power: -10
Footprint: xx
Dimensions: 2,1
Capturable: true
BaseNormal: no
Health:
HP: 100
RevealsShroud:
Range: 4
RenderBuildingOre:
StoresOre:
PipCount: 5
PipColor: Green
Capacity: 1000
-RenderBuilding:
-EmitInfantryOnSell:
LeavesHusk:
HuskActor: SILO.Husk

SILO.Husk:
Inherits: ^CivBuilding
-DeadBuildingState:
-Health:
RenderBuilding:
Palette: staticterrain
WithFire:
DeadBuildingState:
Zombie: true
Building:
Footprint: xx
Dimensions: 2,1
Tooltip:
Name: Destroyed Silo
Icon: siloicnh

this is my sequence/map.yaml

silo.husk:
idle:
Start: 10
fire-start: flmspt
Start: 0
Length: *
fire-loop: flmspt
Start: 50
Length: *

v19:
idle:
Start: 0
Length: 14
Tick: 120
damaged-idle:
Start: 14
Length: 14
Tick: 120
dead:
Start: 28

thanks in advance for any suggestion or solution!

User avatar
Sleipnir
Posts: 878
Joined: Wed Apr 10, 2002 11:52 pm
Contact:

Post by Sleipnir »

The simplest (but buggy) way of keeping husks around is to change the DeadBuildingState definition in the ^Building definition in defaults.yaml to

Code: Select all

	DeadBuildingState:
		Zombie: true
This method doesn't work very well because actors retain a lot of the behavior they had when they were alive, and units will interact badly with them. It looks cool though!
Petrenko wrote: System.InvalidOperationException: Trait prerequisites not satisfied (or prerequisite loop) Actor=silo.husk Unresolved=DeadBuildingStateInfo Missing=HealthInfo
This is thrown because your husk actor has DeadBuildingState, which requires Health. It doesn't make sense for a husk (or an actor that spawns a husk) to have this trait, so you should remove it from both actor definitions. In your husk rules you do remove it, but then add it back. Remove that line and it should work.

A couple more comments on your rules:

Code: Select all

	CashTrickler: 21
This should be

Code: Select all

	CashTrickler:
		Amount: 21
You can also change other properties Period (default 50), ShowTicks (default true), TickLifetime (default 30), TickVelocity (default 1).

Code: Select all

WithFire: 
This causes the husk to render the flame spurt from the oil derrick (using the sequences fire-start and fire-loop). This probably isn't what you want for a normal silo.


Now for sequences. We have some documentation on the sequences code at https://github.com/chrisforbes/OpenRA/w ... ialization but this is targeted at people developing the code, so may not be very useful to you.
The key point with sequences is that by default it will look for a .shp file named the same as the sequence definition, unless you override it. Change the idle: line in your silo.husk sequence to idle: silo to tell the game to use silo.shp instead.

raminator
Posts: 106
Joined: Tue Mar 15, 2005 6:31 pm
Location: Stuttgart

Post by raminator »

got a question too...
would it be possible to make husks (building/vehicle) captureable??
like that big units in cnc3?

User avatar
Sleipnir
Posts: 878
Joined: Wed Apr 10, 2002 11:52 pm
Contact:

Post by Sleipnir »

With minimal code changes, yes.
The capturable flag is currently a property on the Building trait - that will first need to be split off into its own trait if you want vehicle husks to be capturable.

You will then want to create a trait which implements INotifyCapture and replaces the husk with its corresponding non-husk actor.

User avatar
Petrenko
Posts: 156
Joined: Fri Apr 08, 2011 5:36 pm

Post by Petrenko »

Thanks for the quick answer, i love this forum.

I will now try to apply the changes.

Also thanks on the cashtrickler!


P.S. :
Is it possible to open a topic for small code-based changes?
(something like "simple-tweak-list)



Edit:

Alright i changed the defaults and added:

DeadBuildingState:
Zombie: true

Then i added these to remove the behaviours of my silo:
-EmitInfantryOnSell:
-AppearsOnRadar:
-RepairableBuilding:
-Buildable:
-MustBeDestroyed:
-GivesExperience:
-Sellable:
-CashTrickler:
-RevealsShroud:
-Power:
-StoresOre:

Result:
The Cashtrickler and the StoresOre is still active.
On top of this i can't destroy my building.
I added health to it. And i also removed it. No difference.

Question:
Is it possible to tell a sequence to stop after a certain time? So it would just stay a few seconds there and then disappear?

My goal was to let the buildings stay a bit longer, not to fill a map with destroyed buildings.

Thanks in advance!

User avatar
Sleipnir
Posts: 878
Joined: Wed Apr 10, 2002 11:52 pm
Contact:

Post by Sleipnir »

@Petrenko: Those are the problems that i mentioned with Zombie: true - remove that from ^Building and things should work.

@raminator: I went ahead and added capturable husks to cnc for the next release. They may or may not be added to ra.

User avatar
Petrenko
Posts: 156
Joined: Fri Apr 08, 2011 5:36 pm

Post by Petrenko »

Alright thanks,

i think i will study how to make sequences last longer and i think i'm going to open a little "tweak-list"

For example i would add how to use the cashtrickler correctly^^

And i'm going to "annoy" people in the developer-chat to learn other small tweaks.

Thanks so far!

raminator
Posts: 106
Joined: Tue Mar 15, 2005 6:31 pm
Location: Stuttgart

Post by raminator »

great =)

Post Reply