Opened 13 months ago

Last modified 11 months ago

#6784 new defect

Invisible mercenary units of rank basic when spawned in formation

Reported by: Langbart Owned by:
Priority: Must Have Milestone: Alpha 27
Component: Simulation Keywords:
Cc: Patch: Phab:D4984

Description

to reproduce

  • start a map with a trigger that spawns a Mercenary unit of Basic rank in a formation
  • add the following code to any Scenario map, e.g. acropolis_bay_2p.xml
    1. the trigger will remove all existing entities upon start, pop counter becomes zero
    2. spawns five units/mace/infantry_archer_b with a delay from the CivCentre in the Box source:ps/trunk/binaries/data/mods/public/art/textures/ui/session/icons/formations/box.png@27589 formation.
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2
3<Scenario version="7">
4 <Script>
5 warn("loadTrigger")
6 Trigger.prototype.RemoveOtherPlayerUnits = function()
7 {
8 TriggerHelper.GetAllPlayersEntitiesByClass("Unit").forEach(ent=>Engine.DestroyEntity(ent))
9 }
10 Trigger.prototype.DelayedUnitSpawn = function()
11 {
12 const positionID = TriggerHelper.GetPlayerEntitiesByClass(1, "CivCentre")[0]
13 const template = "units/mace/infantry_archer_b"
14 TriggerHelper.SetUnitFormation(1, TriggerHelper.SpawnUnits(positionID, template, 5, 1), "special/formations/box");
15 warn(`${template} created`)
16 };
17 const cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger)
18 cmpTrigger.RegisterTrigger("OnInitGame", "RemoveOtherPlayerUnits", { "enabled": true });
19 cmpTrigger.DoAfterDelay(2000, "DelayedUnitSpawn", {});
20 </Script>
21 <Environment>
22 <SkySet>cirrus</SkySet>
  • notice the pop counter shows 5, but there are no units to be seen
  • replace units/mace/infantry_archer_b (basic) with units/mace/infantry_archer_a (advanced) or units/mace/infantry_archer_e (elite) and the units are visible

bisect

[26134]

reason for high priority

  • the Macedonian campaign by SciGuy42 makes excessive use of the spawning units this way, with the bad side effect that some players cannot be defeated because these units can never be killed.

Attachments (1)

test.png (490.0 KB ) - added by Langbart 13 months ago.

Download all attachments as: .zip

Change History (10)

by Langbart, 13 months ago

Attachment: test.png added

in reply to:  1 ; comment:2 by Langbart, 12 months ago

Replying to Silier:

Bisect is wrong

Bisect fits the title of the ticket, the underlying problem may not. Prior to your commit, I could at least defeat the enemy.

It is absolutely unnecessary to post the entire file, extract the diff, or upload it to Phabricator.


so no my problem.

stick to the forum

in reply to:  2 comment:3 by Silier, 12 months ago

Replying to Langbart:

extract the diff, or upload it to Phabricator.

Do it yourself

comment:4 by Stan, 12 months ago

Owner: set to Stan
Patch: Phab:D4984

comment:5 by phosit, 12 months ago

jebel barkal might also spawn mercenaries in formation.

comment:6 by phosit, 12 months ago

jebel barkal isn't affected since it only spawns gaia units. gaia is their own civ and not mercenary.

comment:7 by Stan, 12 months ago

In 27636:

Workaround TriggerHelper.js not being able to spawn units correctly because of promotion.
Avoid duplication by moving the function to Transform.js.
Add tests to Transform.js
Add tests to TurretHolder.js
Optimize slightly Trainer.js by removing some useless Engine.QueryInterface calls.
Refs #6784 (symptoms in TriggerHelper.js are fixed underlying cause not)

SkirmishReplacer is called before the Modifier Manager so it does not suffer the same fate.
Entities using ChangeEntityTemplate function are still affected.
Maps calling Engine.AddEntity directly are still affected.

Ideally this should be handled by hotloading components instead of creating new entities each time. See => https://code.wildfiregames.com/D4991
Tested using: https://github.com/0ADMods/trailer_tools/commit/908dd631d950b5050d1784530c65f29ccfc67913

Differential Revision: https://code.wildfiregames.com/D4984

comment:8 by Stan, 12 months ago

Milestone: Alpha 27Alpha 28
Priority: Release BlockerMust Have

comment:9 by Stan, 11 months ago

Milestone: Alpha 28Alpha 27

Push back

comment:10 by Stan, 11 months ago

Owner: Stan removed
Note: See TracTickets for help on using tickets.