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.
[08:18 am]
KrayZee -- If Resident Evil 4 is getting a remake, they better make the plot believable. Like actually send an entire team to rescue the President's daughter but the team was ambushed and all equipment were lost. Leon is the only survivor and only kept a handgun. Later he would hitchhike and get picked up. He then asked to be dropped off the nearest town.
[04:01 am]
RIVE -- The significance is lessened by the probability of future RE titles ignoring either conclusion in favor of a rewrite anyway.
[03:59 am]
RIVE -- Mia's on the Chopper vs Mia's not on the Chopper.
[07:33 pm]
KrayZee -- RIVE
RIVE shouted: Also, what was the point of choosing between Mia or Zoe when there's no pay-off?
There is payoff since there are different endings.
[04:10 pm]
RIVE -- CV is stupid hard. (Those red hunters..) If that was remade, Capcom would water it down too much.
[04:08 pm]
RIVE -- Also, what was the point of choosing between Mia or Zoe when there's no pay-off?
[04:08 pm]
RIVE -- RE5 felt like a chore. 7's alright except the Eveline fight is a blander rehashed of Carla from 6 which is sad bc 6 was terrible.
[04:00 pm]
O)FaRTy1billion[MM] -- Zycorax
Zycorax shouted: Their names makes absolutely no sense.
1, 360, 1, 10. what's not to follow?
[2019-12-13. : 2:22 pm]
Dem0n -- RE7 was actually fun AF tho. Pretty spooky too.
[2019-12-13. : 12:48 pm]
Zycorax -- Their names makes absolutely no sense.
Please log in to shout.


Members Online: Roy, KYSXD, Doodan