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.

Responsible for my own happiness? I can't even be responsible for my own breakfast
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.
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.

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:
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;
}
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.

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.

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.

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

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.
ok, the button "works"
but when its Enabled it dont research the tech26 - im clicking the yellow button and nothing happens
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.

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?
you were right i have Hive condition that i can not set in GPTP
Collapse Box

i try used on/off
condition work, if i use other condition than "has exit"
current unit is:
spawn pool
in not ttraining
Hive
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.

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.
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;
}
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.

Responsible for my own happiness? I can't even be responsible for my own breakfast
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.
thank you Good Man,
it works
function to check if player possess unit should be done by "someone" for GPTP.
None.