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.
[2024-4-14. : 9:21 pm]
O)FaRTy1billion[MM] -- there are some real members mixed in those latter pages, but the *vast* majority are spam accounts
[2024-4-14. : 9:21 pm]
O)FaRTy1billion[MM] -- there are almost 3k pages
[2024-4-14. : 9:21 pm]
O)FaRTy1billion[MM] -- the real members stop around page 250
[2024-4-14. : 9:20 pm]
O)FaRTy1billion[MM] -- look at the members list
[2024-4-12. : 12:52 pm]
Oh_Man -- da real donwano
da real donwano shouted: This is the first time I've seen spam bots like this on SEN. But then again, for the last 15 years I haven't been very active.
it's pretty common
[2024-4-11. : 9:53 pm]
da real donwano -- This is the first time I've seen spam bots like this on SEN. But then again, for the last 15 years I haven't been very active.
[2024-4-11. : 4:18 pm]
IlyaSnopchenko -- still better than "Pakistani hookers in Sharjah" that I've seen advertised in another forum
[2024-4-11. : 4:07 pm]
Ultraviolet -- These guys are hella persistent
[2024-4-11. : 3:29 pm]
Vrael -- You know, the outdoors is overrated. Got any indoor gym and fitness equipment?
[2024-4-10. : 8:11 am]
Sylph-Of-Space -- Hello!
Please log in to shout.


Members Online: Roy, armitage