Staredit Network > Forums > Modding Assistance > Topic: [solved] Dark Templar decloak when attack - code malfunction
[solved] Dark Templar decloak when attack - code malfunction
Aug 12 2019, 2:30 pm
By: Lagi  

Aug 12 2019, 2:30 pm Lagi Post #1



below code make Dark Templar become visible when he receive order to Attack.
Basing his invisiblity is very crude and is one big exploit. I would like DT to Decloak when he make attack (not when receive order).

someone has any advice/idea/ready to copypaste code how to limit DTemp cloak elegant?

also its cause bug: when warp into Dark Archon, DA become permanently cloaked.


//decloak Dark Templar when attacking /*unit->orderSignal & 0x20*/

if(unit->id == UnitId::ProtossDarkTemplar &&
!(unit->mainOrderId == OrderId::AttackUnit)){
unit->secondaryOrderId = OrderId::Cloak;
}
if(unit->id == UnitId::ProtossDarkTemplar &&
unit->mainOrderId == OrderId::AttackUnit){
unit->secondaryOrderId = OrderId::Decloak;
}

//decloak Dark Templar when attacking[/code]



edit
i try this one, but it doesnt work
//decloak Dark Templar when attacking /*unit->orderSignal & 0x20*/
if(unit->id == UnitId::ProtossDarkTemplar && unit->orderSignal & 0x20 &&

(unit->sprite->mainGraphic->animation == IscriptAnimation::GndAttkRpt
|| unit->sprite->mainGraphic->animation == IscriptAnimation::GndAttkInit)) {
unit->orderSignal &= ~(0x20);
unit->secondaryOrderId = OrderId::Decloak;
}


Post has been edited 3 time(s), last time on Aug 26 2019, 7:23 am by Lagi.



None.

Aug 16 2019, 4:31 pm Lagi Post #2



below works good. only this stim timer is clunky (increase attack speed :/ ), will try other timers after.

and need confirm warp to Darchon bug if still occur.

//decloak Dark Templar when attacking
if(unit->id == UnitId::ProtossDarkTemplar && unit->hitPoints > 0 )
{
if (unit->stimTimer <1){
unit->secondaryOrderId = OrderId::Cloak;
}

if ((unit->sprite->mainGraphic->animation == IscriptAnimation::GndAttkRpt
|| unit->sprite->mainGraphic->animation == IscriptAnimation::GndAttkInit)
|| (unit->mainOrderId == OrderId::WarpingDarkArchon))
{
unit->secondaryOrderId = OrderId::Decloak;
unit->stimTimer = 5;
}



}




None.

Aug 19 2019, 3:20 am Corbo Post #3

ALL PRAISE YOUR SUPREME LORD CORBO

Try this code:

Code
if (unit->id == UnitId::ProtossDarkTemplar){
                if (unit->mainOrderId == OrderId::AttackMove || unit->mainOrderId == OrderId::AttackUnit){
                    unit->setSecondaryOrder(OrderId::Decloak);
                } else {
                    unit->setSecondaryOrder(OrderId::Cloak);
                }
            }


You will need to uncheck the "Permanently Cloaked" box in units.dat for the Dark Templar unit, though.
Also you can add your dark archon thing if you wish. I did not really understand what you wanted there.



fuck you all

Aug 19 2019, 7:13 am Lagi Post #4



Hi Corbo,

I test the cloak/decloak with order:

1. DT become visible when he receive order being away from target (instead being invisible until he do the melee attack)



2. you increase micro with attack / stop dance. Because DT become invisible back immediately.



i need a timer to delay becoming cloak - I check almost all of them, and all have additional feature (ensmare slow templars down, stim speed up f.ex.)



None.

Aug 19 2019, 7:46 am Lagi Post #5



this seems to work, need some more testing

//decloak Dark Templar when attacking /*unit->orderSignal & 0x20*/
if(unit->id == UnitId::ProtossDarkTemplar && unit->hitPoints > 0 )
{
if (unit->rankIncrease>0){//cooldown
unit->rankIncrease--;
}

if (unit->rankIncrease==0)
unit->secondaryOrderId = OrderId::Cloak;



if ((unit->sprite->mainGraphic->animation == IscriptAnimation::GndAttkRpt
|| unit->sprite->mainGraphic->animation == IscriptAnimation::GndAttkInit)
|| (unit->mainOrderId == OrderId::WarpingDarkArchon)
|| (unit->mainOrderId == OrderId::ReaverStop))
{
unit->secondaryOrderId = OrderId::Decloak;
unit->rankIncrease = 90;
}
}
//end decloak Dark Templar when attacking


new button order allow to decloak all Dark templar and strike at whatever target (workers).
add in Firegraft new button for Dark templar with condition Always and action ReaverStop
in Firegraft in dat requirments, in order tab, add for Reaver stop [7] : Or / Current unit is .. / Dark templar

Post has been edited 1 time(s), last time on Sep 8 2019, 3:45 pm by Lagi.



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: RIVE, Roy