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.
[10:41 am]
v9bettel -- Nice
[01:39 am]
Ultraviolet -- no u elky skeleton guy, I'll use em better
[10:50 pm]
Vrael -- Ultraviolet
Ultraviolet shouted: How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
hey cut it out I'm getting all the minerals
[10:11 pm]
Ultraviolet -- :P
[10:11 pm]
Ultraviolet -- How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
[2024-4-17. : 11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- if i don't gamble them away first
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
[2024-4-17. : 3:26 am]
O)FaRTy1billion[MM] -- i have to ask for minerals first tho cuz i don't have enough to send
[2024-4-17. : 1:53 am]
Vrael -- bet u'll ask for my minerals first and then just send me some lousy vespene gas instead
Please log in to shout.


Members Online: Roy, Dem0n