Staredit Network > Forums > Modding Assistance > Topic: (help pls) grant cloak (invisibility)
(help pls) grant cloak (invisibility)
Nov 12 2018, 10:44 pm
By: Lagi  

Nov 12 2018, 10:44 pm Lagi Post #1



I want observer to be invisible, only after research.

I dont know how to write the plugin to tell the game to give invisibilty to observer [purple part]

Quote
//Observer need upgrade 56 for cloak
if(unit->id == UnitId::ProtossObserver &&
UpgradesSc->currentLevel[unit->playerId][UpgradeId::SensorArray] != 0){
unit->isCloaked++;
}//Observer need upgrade 56 for cloak




None.

Nov 13 2018, 3:58 am Voyager7456 Post #2

Responsible for my own happiness? I can't even be responsible for my own breakfast

Quote from Lagi
I want observer to be invisible, only after research.

I dont know how to write the plugin to tell the game to give invisibilty to observer [purple part]

Quote
//Observer need upgrade 56 for cloak
if(unit->id == UnitId::ProtossObserver &&
UpgradesSc->currentLevel[unit->playerId][UpgradeId::SensorArray] != 0){
unit->isCloaked++;
}//Observer need upgrade 56 for cloak

Try setting its secondary order, like this:

unit->secondaryOrderId = OrderId::Cloak;



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]


Nov 13 2018, 11:50 am Lagi Post #3



Thanks Voyager!

people how do you figure it out? [guess I'm just stupid :rolleyes: )

=====

this works
Quote
//Observer need upgrade 56 for cloak
if(unit->id == UnitId::ProtossObserver &&
UpgradesSc->currentLevel[unit->playerId][UpgradeId::SensorArray] != 0){
unit->secondaryOrderId = OrderId::Cloak;
}//Observer need upgrade 56 for cloak


this dont

Quote
//Observer need upgrade 56 for cloak
if(unit->id == UnitId::ProtossObserver &&
UpgradesBw->currentLevel[unit->playerId][UpgradeId::UnusedUpgrade56] != 0){
unit->secondaryOrderId = OrderId::Cloak;
}//Observer need upgrade 56 for cloak


=====
well, I would like Observer to be invisible with separate upgrade from vision extend, but whatever. Maybe its even better? less complicated, and single upgrade is more valuable (vision upgrades in SC are usually useless).

I set everything with buttons good in Firegraft for unusedUpgrade 56 (I do it 2x from scratch).
I can click upgrade in observatory in game, but Observers stay visible (its not the case with Sensor Array-upgrade).

Maybe the unused-upgrades, dont like me, but probably I missing something, with adding new upgrades.



None.

Nov 13 2018, 12:41 pm Voyager7456 Post #4

Responsible for my own happiness? I can't even be responsible for my own breakfast

This is just something I've done before. :)

Quote
//Observer need upgrade 56 for cloak
if(unit->id == UnitId::ProtossObserver &&
UpgradesBw->currentLevel[unit->playerId][UpgradeId::UnusedUpgrade56] != 0){
unit->secondaryOrderId = OrderId::Cloak;
}//Observer need upgrade 56 for cloak

This doesn't work because the indexing of the UpgradesBw array starts again from zero. You would need to do this:

Code
UpgradesBw->currentLevel[unit->playerId][UpgradeId::UnusedUpgrade56 - UpgradeId::UnusedUpgrade46] != 0


However, it is easier to use the helper function getUpgradeLevel():

Code
if(unit->id == UnitId::ProtossObserver &&
            scbw::getUpgradeLevel(unit->playerId, UpgradeId::UnusedUpgrade56) > 0){
            unit->secondaryOrderId = OrderId::Cloak;
            }


Post has been edited 1 time(s), last time on Nov 13 2018, 12:47 pm by Voyager7456.



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]


Nov 13 2018, 1:51 pm Lagi Post #5



Thank You,

SOLVED



in file game_hook.cpp put in bool next frame section
Code
            //Voyager7456 - Observer need upgrade 56 for cloak
            if(unit->id == UnitId::ProtossObserver &&
           scbw::getUpgradeLevel(unit->playerId, UpgradeId::UnusedUpgrade56) > 0){
           unit->secondaryOrderId = OrderId::Cloak;
            }//Voyager7456 - Observer need upgrade 56 for cloak
           
        } //Loop through all visible units in the game - end


Post has been edited 1 time(s), last time on Nov 13 2018, 9: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: IlyaSnopchenko, Roy, jun3hong