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.
[03:23 am]
Wing Zero -- Its awesome
[03:23 am]
Wing Zero -- Canadian cookies smell like maple syrup
[03:08 am]
jjf28 -- well I'm satisfied enough to leave it http://www.staredit.net/topic/17877/ if anyone interested gets lost somewhere I'll be happy to update the guide
[09:14 pm]
Suicidal Insanity -- science, such as at what temperature do you cook a steak?
[08:04 pm]
jjf28 -- it's where we all raid Heinermann's apartment for Canadian snacks and perform science o.o
[08:02 pm]
dumbducky -- Also wtf is SENCon?
[08:02 pm]
dumbducky -- KrayZee
KrayZee shouted: What happened to his latova website?
THe people demand answers
[11:02 am]
Pr0nogo -- woah, you can't call me an h for being g
[10:06 am]
Suicidal Insanity -- If you are going there .... and kids :P
[06:55 am]
IlyaSnopchenko -- And chicks
Please log in to shout.


Members Online: 5audreyc72100yo0, Roy, C(a)HeK, KrayZee, razorback9423