As I'm not sure if Corbo is still interested in this, I'm bumping the thread. The project will be finished within the next few weeks and I am in need of the following:
CONSUME:
-Must heal hit points for a value pulled from an unused weapon (e.g. Weapon ID 117)
-Otherwise, must behave as normal
INFESTED DURAN:
-Must regenerate energy faster after an unused upgrade has been researched (e.g. Upgrade ID 18)
-The upgrade will have 2 levels to it
-The energy regen values should be as follows:
No upgrade - standard regen speed
1 upgrade - 1.5x regen speed
2 upgrades - 2x regen speed
Please let me know if you are able to help. Thanks!

Responsible for my own happiness? I can't even be responsible for my own breakfast
I'll post something later today, Pr0nogo.
Well, I think this lines can achieve what you want to do:
For the Consume behaviour:
/// in wpnspellhit.cpp
/// from line 411 (void ConsumeHit() function)
void ConsumeHit(CUnit* attacker, CUnit* target) {
if(
target != NULL &&
!(target->status & UnitStatus::Invincible) &&
getSpellStatString(target,TechId::Consume,attacker->playerId) == 0 //returning a value != 0 means there was an error
)
{
incrementUnitDeathScores(target,attacker->playerId);
target->remove();
if(!(target->status & UnitStatus::IsHallucination)) {
/// KYSXD
/// For use with WeaponId namespace
s16 healtRegen = weapons_dat::DamageAmount[117] * 256; /// WeaponId = 117
attacker->setHp(attacker->hitPoints + healtRegen);
u16 energyMax = attacker->getMaxEnergy();
if((energyMax - attacker->energy) > 12800) //12800 is 50 energy ingame
attacker->energy = energyMax;
else
attacker->energy += 12800;
}
}
} //void ConsumeHit(CUnit* attacker, CUnit* target)
For the Duran's upgrade behaviour:
/// In update_unit_state.cpp
/// from line 83 (else statement of 'if(unit->energy == maxEnergy)')
else {
/// KYSXD:
/// Normal energy regen
u16 energyRegen = 8;
/// KYSXD:
/// For use with UpgradeId namespace
if(unit->id == UnitId::Hero_InfestedDuran)
{
switch(scbw::getUpgradeLevel(unit->playerId, 18)) /// UpgradeId 18
{
case 1:
energyRegen *= 1.5;
break;
case 2:
energyRegen *= 2;
break;
default:
break;
}
}
/// KYSXD:
/// New modified regen
unit->energy += energyRegen;
if(unit->energy > maxEnergy)
unit->energy = maxEnergy;
}
These should do the job.

Responsible for my own happiness? I can't even be responsible for my own breakfast
Or KYSXD could just beat me to it.
Thanks KYSXD! How would I compile these into GPTP?

Responsible for my own happiness? I can't even be responsible for my own breakfast
Download this:
https://github.com/BoomerangAide/GPTP-For-VS2008Replace the code mentioned in the comments with KYSXD's code (in update_unit_state.cpp and wpnspellhit.cpp).
Build the Visual Studio project. It will generate a .qdp file. I believe by default it will go in the Debug directory, but you can change that in the project settings.
I don't see an executable anywhere, so I assume I need to use notepad++ or some other compiler to actually modify the code? Or is it because I don't have VS 2008 correctly installed? The readme doesn't clear any of this up. Thanks for your help so far, it is much appreciated!

Responsible for my own happiness? I can't even be responsible for my own breakfast
If you have VS correctly installed, you should be able to open the "GPTP.sln" file, which will launch Visual Studio. You don't strictly need VS2008, I use 2010 and it works fine. I haven't tested with newer versions though.
Every time I attempt to build the project after copy and pasting the code from KYSXD's post, it throws a fatal error and numerous other nonfatal errors. The fatal one is sometimes in update_unit_state.cpp and sometimes in wpnspellhit.cpp. In both cases, the fatal error is at the last line of the cpp's code and says that the left hook '{' is not matched. I've tried placing a right hook '}' but that hasn't helped. Any ideas?

ALL PRAISE YOUR SUPREME LORD CORBO
I've compiled KYSXD's code for you. Let me know the results.
Attachments:
fuck you all
Corbo, please tell me that this time you turned off the hooks that aren't in use.
Still crashing whenever marines attack. Can you try KYSXD's code instead of your own?

Responsible for my own happiness? I can't even be responsible for my own breakfast
I don't know what Corbo is doing that's causing that issue. Maybe he's not using a fresh GPTP install?
Pr0nogo, try this. Extraneous hooks are disabled and I tested both Consume and Marines attacking. I just threw it together and was too lazy to test the unused upgrades, but there shouldn't be an issue.
Post has been edited 1 time(s), last time on May 12 2017, 11:59 am by Voyager7456.
Marine attacking no longer crashes, but Consume's graphic appears when cast and the unit it's cast on isn't killed, and no energy/life is restored. This occurs both when the plugin is imported in my existing exe and when the plugin is the only modified data in a fresh exe.
Here's the fresh exe for reference.

ALL PRAISE YOUR SUPREME LORD CORBO
I don't know what Corbo is doing that's causing that issue. Maybe he's not using a fresh GPTP install?
Pr0nogo, try this. Extraneous hooks are disabled and I tested both Consume and Marines attacking. I just threw it together and was too lazy to test the unused upgrades, but there shouldn't be an issue.
After the first two times I tried I actually redownloaded and used a fresh install. Share your consume+hooks code?
fuck you all

Responsible for my own happiness? I can't even be responsible for my own breakfast
Sorry, that was my bad. I uploaded the wrong one. Use this.
I don't know what Corbo is doing that's causing that issue. Maybe he's not using a fresh GPTP install?
Pr0nogo, try this. Extraneous hooks are disabled and I tested both Consume and Marines attacking. I just threw it together and was too lazy to test the unused upgrades, but there shouldn't be an issue.
After the first two times I tried I actually redownloaded and used a fresh install. Share your consume+hooks code?
It's KYSXD's posted code, and I commented out all of the hook inject functions aside from GameHooks, DrawHooks, CastOrder, WpnSpellHit, TechTarget and UpdateUnitState.
Post has been edited 1 time(s), last time on May 13 2017, 3:07 pm by Voyager7456.
Health works as intended, as far as I can tell. I haven't checked with upgrades. What weapon is it reading the data from? 117?
If at full energy, the caster has their energy set to ~45. If at anything but full energy, the caster has their energy set to full.

Responsible for my own happiness? I can't even be responsible for my own breakfast
Yes, it reads from 117.
Interesting. This energy anomaly looks like it may be a bug in GPTP - it also occurs without any of KYSXD's code changes. I'll have to investigate later, I don't have time right now.
Alright, thanks for your help.

Responsible for my own happiness? I can't even be responsible for my own breakfast
Wow, that was super simple once I actually had the time to sit down and investigate. The comparison checking if the unit is at max energy is wrong (on the GPTP repository as well). Corrected version posted below.
I never actually noticed this before, the last couple projects I've been working on have overrode Consume for other things.
Post has been edited 1 time(s), last time on May 14 2017, 8:21 pm by Voyager7456.