Staredit Network > Forums > Modding Assistance > Topic: [help] give unit order after being create
[help] give unit order after being create
Aug 24 2019, 9:27 am
By: Lagi  

Aug 24 2019, 9:27 am Lagi Post #1



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.

Aug 27 2019, 11:42 pm Voyager7456 Post #2

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:

Code
        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:

Code
                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.



all i am is a contrary canary
but i'm crazy for you
i watched you cradling a tissue box
sneezing and sniffling, you were still a fox


Modding Resources: The Necromodicon [WIP] | Mod Night
My Projects: SCFC | ARAI | Excision [WIP] | SCFC2 [BETA] | Robots vs. Humans | Leviathan Wakes [BETA]


Aug 29 2019, 10:32 am Lagi Post #3



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.

Aug 29 2019, 3:02 pm Voyager7456 Post #4

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
:facepalm:

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.



all i am is a contrary canary
but i'm crazy for you
i watched you cradling a tissue box
sneezing and sniffling, you were still a fox


Modding Resources: The Necromodicon [WIP] | Mod Night
My Projects: SCFC | ARAI | Excision [WIP] | SCFC2 [BETA] | Robots vs. Humans | Leviathan Wakes [BETA]


Aug 31 2019, 3:58 pm Lagi Post #5



Quote from Voyager7456
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.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:56 am]
Oh_Man -- cool bit of history, spellsword creator talking about the history of EUD ^
[09:24 pm]
Moose -- denis
[05:00 pm]
lil-Inferno -- benis
[10:41 am]
v9bettel -- Nice
[2024-4-19. : 1:39 am]
Ultraviolet -- no u elky skeleton guy, I'll use em better
[2024-4-18. : 10:50 pm]
Vrael -- Ultraviolet
Ultraviolet shouted: How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
hey cut it out I'm getting all the minerals
[2024-4-18. : 10:11 pm]
Ultraviolet -- :P
[2024-4-18. : 10:11 pm]
Ultraviolet -- How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
[2024-4-17. : 11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
Please log in to shout.


Members Online: Zycorax, jun3hong, Oh_Man, Ultraviolet