Staredit Network > Forums > Modding Assistance > Topic: [solved] how to make research require another research
[solved] how to make research require another research
Aug 22 2019, 7:53 am
By: Lagi  

Aug 22 2019, 7:53 am Lagi Post #1



I have custom tech : burrow movement

It would make sens for above tech to require normal Burrow to be researched before.

How to set it up in Firegraft?

Post has been edited 1 time(s), last time on Sep 1 2019, 8:01 pm by Lagi.



None.

Aug 27 2019, 11:30 pm Voyager7456 Post #2

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

Quote from Lagi
I have custom tech : burrow movement

It would make sens for above tech to require normal Burrow to be researched before.

How to set it up in Firegraft?

You can't do this in FireGraft. What you will need to do is use GPTP and use the button condition hooks to disable/enable the button for researching and using the technology as appropriate.



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]


Aug 31 2019, 2:26 pm Lagi Post #3



buttonset.cpp


I dont know how to do it. Im looking at the structure of buttonset.cpp, but dont know how to make it.

I think i suppose to paste this:

if(unit->id == UnitId::spawning_pool &&
scbw::getUpgradeLevel(unit->playerId, UpgradeId::UnusedUpgrade55) < 0){

current_button_state = BUTTON_STATE::Disabled;


but where ? and how to inform the program which button it is (with what to replace current_button_state?

===
maybe im in wrong place cause its button sets?



None.

Aug 31 2019, 3:44 pm Voyager7456 Post #4

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

btns_cond.cpp is the place to look, actually. You'd do something like this:

Code
if(unit->id == UnitId::spawning_pool) {
    if(scbw::getUpgradeLevel(unit->playerId, UpgradeId::UnusedUpgrade55) < 1)
        return BUTTON_DISABLED; //we don't have the prerequisite upgrade
    else if (scbw::hasTechResearched(unit->playerId, TechId::MyTech))
        return BUTTON_HIDDEN; //hide the button if we've already researched this tech
    else
        return BUTTON_ENABLED;
}




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]


Aug 31 2019, 4:31 pm Lagi Post #5



hmm..

file btns cond appear to affect only few buttons:

BTNSCOND_NoNydusExit(CUnit* unit) {

s32 BTNSCOND_Movement(CUnit* unit) {

s32 BTNSCOND_HasScarabs(CUnit* unit) {


for sure you can add new one, but how?



None.

Aug 31 2019, 4:42 pm Voyager7456 Post #6

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

Adding a completely new one would involve hooking some more functions and is probably more trouble than its worth, since you can distinguish by unit ID within a single condition. I'd suggest adding your code to say, NoNydusExit and then changing the condition in FireGraft appropriately.



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]


Aug 31 2019, 5:51 pm Lagi Post #7



:/ i want nydus canal to still work normally

someone choose poor button condition, can not they hook "2 unit selected & not researched" ?! its even double for Arch & DArch. And even if you need building to morph 2x templars, than you can just hide button.



None.

Aug 31 2019, 6:01 pm Voyager7456 Post #8

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

Quote from Lagi
:/ i want nydus canal to still work normally

someone choose poor button condition, can not they hook "2 unit selected & not researched" ?! its even double for Arch & DArch. And even if you need building to morph 2x templars, than you can just hide button.

The Nydus Canal will still work normally. This is why we have the "if(unit->id == UnitId::spawning_pool)" condition. If the unit is a Spawning Pool, the button will behave in the new way. Otherwise it will behave normally.

If you end up needing more conditions, I have hooks for HasInterceptors, HasNuke, IsBurrowed, CanBurrow, IsCloaked and CanCloak that I can share.



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]


Aug 31 2019, 6:31 pm Lagi Post #9



ok, the button "works"

but when its Enabled it dont research the tech26 - im clicking the yellow button and nothing happens

:bored:

s32 BTNSCOND_NoNydusExit(CUnit* unit) {

if(unit->id == UnitId::spawning_pool) {

if(scbw::hasTechResearched(unit->playerId, TechId::Burrowing))
return BUTTON_ENABLED; //we have the prerequisite upgrade

else if (scbw::hasTechResearched(unit->playerId, TechId::UnusedTech26))
return BUTTON_HIDDEN; //hide the button if we've already researched this tech
else
return BUTTON_DISABLED;
}

return (unit->building.nydusExit == NULL) ? BUTTON_ENABLED : BUTTON_HIDDEN;
}

;




None.

Aug 31 2019, 6:40 pm Voyager7456 Post #10

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

Sounds like the button condition is working fine, but the issue is with the button action.

What do the dat requirements look like to research UnusedTech26 in FireGraft?



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]


Aug 31 2019, 6:54 pm Lagi Post #11



you were right i have Hive condition that i can not set in GPTP

Collapse Box

i need to add into hook condition "if has Hive" and i dont know how to do it :/
something like this
scbw::hasTechResearched(unit->playerId, UnitID::ZergHive))


Post has been edited 5 time(s), last time on Aug 31 2019, 7:50 pm by Lagi.



None.

Sep 1 2019, 5:21 am Voyager7456 Post #12

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

I don't think there is a helper function to see if a player owns a unit. What you can do is loop over that player's units and see if they own one.

Code
bool ownUnit = false;
CUnit* current_unit = firstPlayerUnit->unit[unit->playerId];
        while(current_unit != NULL) {
            if(current_unit->id == UnitId::hive) {
                ownUnit = true;
                break;
            }
            current_unit = current_unit->player_link.next;
        }




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]


Sep 1 2019, 11:11 am Lagi Post #13



i try this one, but button is disabled all the time (even if has hive and burrow reserached)

s32 BTNSCOND_NoNydusExit(CUnit* unit) {

if(unit->id == UnitId::spawning_pool) {

bool ownUnit = false;
CUnit* current_unit = firstPlayerUnit->unit[unit->playerId];
while (current_unit == NULL)
{

if(current_unit->id == UnitId::hive) {
ownUnit = true;
break;
}
current_unit = current_unit->player_link.next;
}

if(
scbw::hasTechResearched(unit->playerId, TechId::Burrowing) &&
!(scbw::hasTechResearched(unit->playerId, TechId::UnusedTech26)) &&
(ownUnit == true)

)


return BUTTON_ENABLED; //we have the prerequisite upgrade

else if (scbw::hasTechResearched(unit->playerId, TechId::UnusedTech26))
return BUTTON_HIDDEN; //hide the button if we've already researched this tech
else
return BUTTON_DISABLED;
}

return (unit->building.nydusExit == NULL) ? BUTTON_ENABLED : BUTTON_HIDDEN;
}

;




None.

Sep 1 2019, 3:33 pm Voyager7456 Post #14

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

Quote from Lagi
i try this one, but button is disabled all the time (even if has hive and burrow reserached)

s32 BTNSCOND_NoNydusExit(CUnit* unit) {

if(unit->id == UnitId::spawning_pool) {

bool ownUnit = false;
CUnit* current_unit = firstPlayerUnit->unit[unit->playerId];
while (current_unit == NULL)
{

if(current_unit->id == UnitId::hive) {
ownUnit = true;
break;
}
current_unit = current_unit->player_link.next;
}

if(
scbw::hasTechResearched(unit->playerId, TechId::Burrowing) &&
!(scbw::hasTechResearched(unit->playerId, TechId::UnusedTech26)) &&
(ownUnit == true)

)


return BUTTON_ENABLED; //we have the prerequisite upgrade

else if (scbw::hasTechResearched(unit->playerId, TechId::UnusedTech26))
return BUTTON_HIDDEN; //hide the button if we've already researched this tech
else
return BUTTON_DISABLED;
}

return (unit->building.nydusExit == NULL) ? BUTTON_ENABLED : BUTTON_HIDDEN;
}

;

current_unit == NULL should be current_unit != NULL.



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]


Sep 1 2019, 8:01 pm Lagi Post #15



thank you Good Man,
it works

function to check if player possess unit should be done by "someone" for GPTP.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[03:17 pm]
Pr0nogo -- u
[02:35 pm]
lil-Inferno -- u
[02:02 pm]
Corbo -- No
[01:28 pm]
razorback9423 -- Um, is this shoutbox active?
[2019-9-14. : 11:18 am]
razorback9423 -- C.I.S. Conversion Mod will have a campaign, and the first part is coming this September.
[2019-9-13. : 12:03 am]
Wing Zero -- Memes
[2019-9-12. : 8:36 pm]
KrayZee -- I'm curious what internet archaeologists will find in Maplantis
[2019-9-12. : 5:17 pm]
MTiger156 -- Moral of the story - don't end up like Friendster
[2019-9-12. : 3:53 am]
Pr0nogo -- Voyager7456
Voyager7456 shouted: kill you opponent
Zoan
Zoan shouted: this map was boring as far as I remember lol
Please log in to shout.


Members Online: Roy, psyhotechnica, BeatMeistro, udyqiwyb