Dune2k Aircraft Modding

Bomber landing locks modded repair/reload pad

Information and discussion for custom maps and mods.
Post Reply
diegonv40
Posts: 1
Joined: Thu Apr 18, 2024 6:01 pm

Dune2k Aircraft Modding

Post by diegonv40 »

Hi. I have been modifying some d2k files and have added a selectable ornithopter bomber that drops two bombs and lands and reloads back to the silo buildings (the spice silos). It works fine (reloads & repairs) but when I have more than one bomber they don't land correctly.

I describe the problem:

-I build two silos, then one bomber.

-Select the bomber and right click on silo 1
-The bomber lands on silo 1 and stays there.

-I select the bomber and right click on silo 2
-The bomber moves and lands on silo 2.

-I build a 2nd bomber and order it to land in the free silo (the 1st)
-The 2nd bomber tries to land (lines up) but keeps circling around the silo repeatedly trying to land without success.

I think the silo keeps a reference to the first bomber so it is blocked for other bombers. I cant asign other bombers unless the 1st is destroyed
What am I doing wrong, is there a trait missing in the silo or in the bomber?
There is some way to unassign the bomber to the previous pad if is assigned or ordered to land in another? Or unassign the bomber when it takeoff?




EDIT:
I've found the problem. The Bomber parent class (orni_controlable) code has the line "LandAltitude: 150". Removing it solved the problem (the bombers now search another pad and land correctly).
However if the bomber lands aiming south-west the silo sprite is rendered over the plane.
Is there some way to force the rendering order to be always the airplane above the building?

I think LandAltitude has a bug because if i force to land the bomber on ground (by pressing alt) when the plane takeoffs after a move order, the cell becomes blocked for land units (without that line not). And some similar happens with pads when a bomber is assigned.

I'd prefer use LandAltitude because it draws the airplane shadow while is landed, but gives the problems described, so i will remove the line.


EDIT2:
Added a second line (MinAirborneAltitude) with the value LandAltitude + 1 (so now altitude 150 is not considered airborne) and now it works correctly:

(...)
LandAltitude: 150
MinAirborneAltitude: 151
(...)







This is the silo/landing pad code:

Code: Select all

silo:
	Inherits: ^Building
	Buildable:
		Prerequisites: refinery
		Queue: Building
		BuildPaletteOrder: 130
		BuildDuration: 375
		BuildDurationModifier: 100
		Description: Repairs air units & stores excess harvested Spice
	Selectable:
		Bounds: 32,32
	Valued:
		Cost: 250
	Tooltip:
		Name: Pad-Silo
	RequiresBuildableArea:
		Adjacent: 4
	-GivesBuildableArea:
	Health:
		HP: 80000
	Armor:
		Type: building

	RevealsShroud:
		Range: 2c768
	RenderSprites:
		Image: silo.ordos
		FactionImages:
			atreides: silo.atreides
			fremen: silo.atreides
			harkonnen: silo.harkonnen
			corrino: silo.harkonnen
	-WithSpriteBody:
	WithResourceLevelSpriteBody:
		Sequence: stages
	StoresResources:
		Capacity: 2000
	-SpawnActorsOnSell:
	Power:
		Amount: -10
	
	Reservable:
	
	RepairsUnits:
		Interval: 125
		HpPerStep: 1000
		StartRepairingNotification: Repairing
		FinishRepairingNotification: UnitRepaired
		PlayerExperience: 5
	
	MustBeDestroyed:
		RequiredForShortGame: false
	ThrowsShrapnel:
		Weapons: Debris, Debris2, Debris3, Debris4
		Pieces: 3, 5
		Range: 2c0, 5c0
	RevealOnDeath:
		Radius: 2c768
	WithResourceStoragePipsDecoration:
		Position: BottomLeft
		Margin: 1, 4
		RequiresSelection: true
		PipCount: 5
This is the default plane code:

Code: Select all

^Plane:
	Inherits@1: ^ExistsInWorld
	Inherits@2: ^SpriteActor
	Inherits@handicaps: ^PlayerHandicaps
	Interactable:
	Tooltip:
		GenericName: Unit
	Huntable:
	OwnerLostAction:
		Action: Kill
	AppearsOnRadar:
		UseLocation: true
	HiddenUnderFog:
		Type: GroundPosition
		AlwaysVisibleRelationships: None
	ActorLostNotification:
	AttackMove:
	WithFacingSpriteBody:
	WithShadow:
	HitShape:
		Type: Circle
			Radius: 16
	MapEditorData:
		Categories: Aircraft
This is the ornithopter base code where the bomber inherits some traits:

Code: Select all

^orni_controlable:
	Inherits: ^Plane
	Inherits@GAINSEXPERIENCE: ^GainsExperience
	Inherits@AUTOTARGET: ^AutoTargetAllAssaultMove

	-Interactable:
	Inherits@selection: ^SelectableCombatUnit
	Selectable:
		Class: ornithopter
		Bounds: 32,32

	Buildable:
		Queue: Aircraft	
		BuildDuration: 750

	Health:
		HP: 10000
	Armor:
		Type: light

	Aircraft:
		Repulsable: true
		CruiseAltitude: 1600
		VTOL: true		
		TakeOffOnResupply: false		
		TurnToLand: false		
		LandAltitude: 150
		IdleTurnSpeed: 10

	UpdatesPlayerStatistics:
		AddToArmyValue: true

	Targetable:
		TargetTypes: Ground, Vehicle, Infantry, Air, Defense

	HiddenUnderFog:
		AlwaysVisibleRelationships: Ally
	RevealsShroud:
		ValidRelationships: Ally
		Type: GroundPosition
		RevealGeneratedShroud: true
		Range: 8c768

	RevealOnFire:

	SpawnActorOnDeath:
		Actor: ornithopter.husk

	RenderSprites:
		Image: ornithopter
This is the bomber code:

Code: Select all

ornithopter_light_bomber:
	Inherits: ^orni_controlable

	Buildable:
		BuildPaletteOrder: 160
		Description: Light Bomber Ornithopter\n Bombs Bays Installed
		Prerequisites: research_centre, ~techlevel.medium
	Tooltip:
		Name: Ornithopter Light Bomber
	Valued:
		Cost: 400

	AttackAircraft:
		FacingTolerance: 80
		PersistentTargeting: false
		OpportunityFire: False
	
	Aircraft:
		Speed: 140
		TurnSpeed: 16
		IdleBehavior: ReturnToBase
		CanForceLand: false

	Armament:
		Weapon: OrniBomb
		LocalOffset: -128,128,171, -128,-128,171
		PauseOnCondition: !ammo

	AutoTarget:
		InitialStanceAI: HoldFire

	AmmoPool:
		Ammo: 2
		ReloadDelay: 100
		AmmoCondition: ammo
	
	Rearmable:
		RearmActors: silo
	
	Repairable:
		RepairActors: silo
	
	WithAmmoPipsDecoration:
		Position: BottomLeft
		Margin: 4, 3
		RequiresSelection: true
		PipCount: 2

Post Reply