I have scourge morph from zergling (modded)
when they are birth they fly to rally point from Hatchery.
I would like to give fresh born Scourge immediately a Stop order. How to do that?
========
i try this in game hooks
if((unit->id == UnitId::scourge || unit->id == UnitId::infested_terran) && unit->status & UnitStatus::Completed){
unit->secondaryOrderId = OrderId::Stop;
}
but the unit are constantly stop. the unit status completed is always true, and this status has use for building.
i could just set lurker_egg - but the morph animation show hydralisk and it looks odd
also canceling morph will end with receiving hydralisk (from zergling)
Post has been edited 2 time(s), last time on Aug 24 2019, 6:58 pm by Lagi.
None.

Responsible for my own happiness? I can't even be responsible for my own breakfast
In unit_morph.cpp, there is a function that hooks the ZergBirth order. This is the relevant portion:
if(
unit->previousUnitType != UnitId::ZergCocoon &&
unit->previousUnitType != UnitId::ZergLurkerEgg
)
{
orderNewUnitToRally(unit,unit->connectedUnit);
if(unit2 != NULL)
orderNewUnitToRally(unit2,unit->connectedUnit);
}
The trick will be how to distinguish Scourge morphed from Larva and Scourge morphed from Zerglings... I'm not sure of a way off the top of my head, you might have to experiment.
The other option would be to implement a third type of egg, that way it would be easy to distinguish when a Scourge came from a Zergling. In orders_Morph1() you can add a new type of egg, IE:
if(unit->id == UnitId::ZergLarva)
eggId = UnitId::ZergEgg;
else
if(unit->id == UnitId::ZergHydralisk)
eggId = UnitId::ZergLurkerEgg;
else
if(unit->id == UnitId::Zergling)
eggId = UnitId::whatever;
And then in the ZergBirth order you'd simply exclude that type of egg from rallying as well.
1. there are 2x unit morph files, and only one inject_unitmorp in initialize.cpp-> I think one of the unit morph files will not work
I try before, to rename one of the file, but just ended with replacing all files from backup copy of Framework.
2. i change the "other hooked" unit morph file, but it dont affect the game.*
*in my compiler the last unit_morph file I save - seem to be the one affecting the game. If i change anything in below "hooked" unit morph file, compiler is spiting endless log of errors.
P.S. "Unit2" in below code is in regards to double unit from 1 egg (zegrlings scourges). so theoretically if i comment it rally point should not affect zerglings nor scourges
unit->previousUnitType != UnitId::ZergLurkerEgg
)
{
orderNewUnitToRally(unit,unit->connectedUnit);
/*if(unit2 != NULL && unit->id == UnitId::ZergScourge){
orderNewUnitToRally(unit2,unit->connectedUnit);}*/
}
actUnitReturnToIdle(unit);
None.

Responsible for my own happiness? I can't even be responsible for my own breakfast
>there are 2x unit morph files, and only one inject_unitmorp in initialize.cpp

I guess someone needs to submit an issue with BoomerangAide.
When I get off work, I'll post a corrected file.
I believe you're correct about the code you posted above, but of course that means that they'll no longer rally when morphed from Larva either.
that means that they'll no longer rally when morphed from Larva either.
i dont want Scourge to morph from 2 sources (i want it only be available from zerglings), so its not an issue for me.
None.