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.
[06:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[06:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[06:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
[06:49 pm]
Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
[06:48 pm]
Vrael -- On this Topic, I could definitely use some Introductions.
[06:48 pm]
Vrael -- Perhaps that utilizes cutting-edge technology and eco-friendly cleaning products?
[06:47 pm]
Vrael -- Do you know anyone with a deep understanding of the unique characteristics of your carpets, ensuring they receive the specialized care they deserve?
[06:45 pm]
NudeRaider -- Vrael
Vrael shouted: I've also recently becoming interested in Carpet Cleaning, but I'd like to find someone with a reputation for unparalleled quality and attention to detail.
beats me, but I'd make sure to pick the epitome of excellence and nothing less.
[06:41 pm]
Vrael -- It seems like I may need Introductions to multiple companies for the Topics that I care deeply about, even as early as Today, 6:03 am.
[06:38 pm]
Vrael -- I need a go-to solution and someone who understands that Carpets are more than just decorative elements in my home.
Please log in to shout.


Members Online: NudeRaider