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.
[07:46 am]
RIVE -- :wob:
[2024-4-22. : 6:48 pm]
Ultraviolet -- :wob:
[2024-4-21. : 1:32 pm]
Oh_Man -- I will
[2024-4-20. : 11:29 pm]
Zoan -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
You should do my Delirus map too; it's a little cocky to say but I still think it's actually just a good game lol
[2024-4-20. : 8:20 pm]
Ultraviolet -- Goons were functioning like stalkers, I think a valk was made into a banshee, all sorts of cool shit
[2024-4-20. : 8:20 pm]
Ultraviolet -- Oh wait, no I saw something else. It was more melee style, and guys were doing warpgate shit and morphing lings into banelings (Infested terran graphics)
[2024-4-20. : 8:18 pm]
Ultraviolet -- Oh_Man
Oh_Man shouted: lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
oh ya I saw that when Armo posted it on Discord, pretty crazy
[2024-4-20. : 8:09 pm]
Vrael -- thats less than half of what I thought I'd need, better figure out how to open SCMDraft on windows 11
[2024-4-20. : 8:09 pm]
Vrael -- woo baby talk about a time crunch
[2024-4-20. : 8:08 pm]
Vrael -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
so that gives me approximately 27 more years to finish tenebrous before you get to it?
Please log in to shout.


Members Online: Roy