Invisible mercenary units of rank basic when spawned in formation
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
- the trigger will remove all existing entities upon start, pop counter becomes zero
- spawns five
units/mace/infantry_archer_b
with a delay from the CivCentre
in the Box
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.
Replying to Silier:
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.
stick to the forum