my Lords, if you find some time
I want Dark Archon Feedback spell also to target all protoss, and remove their shields, like targeted EMP (how to affect with energy+shielded protoss unit? I dont know, can be double damage i guess. edit: first deal damage, then zeroing shields)
here is the
Feedback_spell.cpp (original, not yet massacred by me

)
I can not go through the
purple part (I think). It force my Darkon to choose energized victim
void orders_Feedback(CUnit* unit) {
CUnit* target = unit->orderTarget.unit;
if(
target != NULL &&
units_dat::BaseProperty[target->id] & UnitProperty::Spellcaster &&
!(target->status & UnitStatus::IsHallucination)
)
{
u16 techCost;
int sightRange = unit->getSightRange(true);
if(
ordersSpell_Sub_4926D0(
unit,
TechId::Feedback,
&techCost,
sightRange * 32,
0x532 //Must target units with energy
)
)
{
if(target->status & UnitStatus::IsHallucination) {
u8 overlaySize = hasOverlay(target);
replaceFeedbackSprite(target,overlaySize + SpriteId::Feedback_Hit_Small);
unit->spendUnitEnergy(techCost);
target->remove();
unit->orderToIdle();
}
else { //F6DE3
if(target->energy <= 0)
unit->orderToIdle();
else {
target->damageWith(target->energy,WeaponId::Feedback,unit,unit->playerId,1,1);
target->energy = 0;
unit->spendUnitEnergy(techCost);
scbw::playSound(SoundId::Protoss_Darchon_feedback_wav,target);
...
Post has been edited 3 time(s), last time on Aug 31 2019, 2:05 pm by Lagi.
None.
i just comment the whole code for feedback.cpp
and left only
target->shields = 0
in game the Feedback still want to target unit with energy (and zeroing target caster shields instead of energy - so ok something works)
i think something is wrong with this hook
where is declare the target of spell?
None.

Responsible for my own happiness? I can't even be responsible for my own breakfast
i just comment the whole code for feedback.cpp
and left only target->shields = 0
in game the Feedback still want to target unit with energy (and zeroing target caster shields instead of energy - so ok something works)
i think something is wrong with this hook
where is declare the target of spell?
tech_target_check.cpp has what you're looking for.
tech_target_check.cpp is controlling the message pop-up
i check it in game, Dark Archon still cannot remove shields from zealot (DArchon dont lose energy, dont make animation etc.), just the error message dont appear
//Should be equivalent to getSpellStatString @ 0x00491E80
u16 getTechUseErrorMessageHook(CUnit* target, u8 castingPlayerId, u16 techId) {
u16 stringId;
if(target->stasisTimer != 0)
stringId = 900; //Units in stasis can't be targeted.<0>
else
if(techId < TechId::DefensiveMatrix || techId > TechId::OpticalFlare)
stringId = 876; //Invalid target.<0>
else {
//originally handled by switchs and internal arrays of id
if(techId == TechId::Feedback) {
if(units_dat::BaseProperty[target->id] & UnitProperty::Building)
stringId = 877; //Unable to target structure.<0>
else
/*if(!target->isValidCaster() || !target->shields >0)
stringId = 1330; //Must target units with energy.<0>
else*/
stringId = 0; //valid target
None.

Responsible for my own happiness? I can't even be responsible for my own breakfast
Ah, sorry I should have guessed that Feedback did things slightly differently, because the Brood War spells always have to do things differently...
It looks like you'll also need to modify orders_Feedback() in feedback_spell.cpp.
thans that works!
=======
in tech_target_check.cpp
if(techId == TechId::Feedback) {
if(units_dat::BaseProperty[target->id] & UnitProperty::Building)
stringId = 877; //Unable to target structure.<0>
else
if(!target->isValidCaster() & !target->shields >0)
stringId = 1330; //Must target units with energy.<0>
else
stringId = 0; //valid target
}
in feedback_spell.cpp:
void orders_Feedback(CUnit* unit) {
CUnit* target = unit->orderTarget.unit;
if(
target != NULL &&
((units_dat::BaseProperty[target->id] & UnitProperty::Spellcaster) || target->shields > 0) && //igal
!(target->status & UnitStatus::IsHallucination)
)
{
u16 techCost;
int sightRange = unit->getSightRange(true);
if(
ordersSpell_Sub_4926D0(
unit,
TechId::Feedback,
&techCost,
sightRange * 32,
0x532 //Must target units with energy
)
)
{
if(target->status & UnitStatus::IsHallucination) {
u8 overlaySize = hasOverlay(target);
replaceFeedbackSprite(target,overlaySize + SpriteId::Feedback_Hit_Small);
unit->spendUnitEnergy(techCost);
target->remove();
unit->orderToIdle();
}
else { //F6DE3
if(target->energy <= 0 && target->shields <= 0) //igal
unit->orderToIdle();
else {
target->damageWith(target->energy,WeaponId::Feedback,unit,unit->playerId,1,1);
target->energy = 0;
target->shields = 0; //igal
unit->spendUnitEnergy(techCost);
scbw::playSound(SoundId::Protoss_Darchon_feedback_wav,target);
dont forget to uncomment injects in initialize.cpp
Collapse Box

hooks::injectResearchUpgradeOrdersHooks();
hooks::injectMedicOrdersHooks();
hooks::injectHallucinationSpellHook();*/
hooks::injectFeedbackSpellHook();
/*hooks::injectBtnsCondHook();
hooks::injectRecvCmdHook();*/
hooks::injectCreateInitUnitsHooks();
/*hooks::injectGiveUnitHook();
hooks::injectTrainCmdRecvHooks();
hooks::injectCMDRECV_SiegeTankHooks();
hooks::injectCMDRECV_MergeArchonHooks();
hooks::injectCMDRECV_MorphHooks();/*
hooks::injectCMDRECV_StopHooks();
hooks::injectCMDRECV_CancelHooks();
hooks::injectSelectLarvaHooks();
hooks::injectRepairOrderHook();
hooks::injectStatsPanelDisplayHook();
hooks::injectUtilsHooks();
hooks::injectMindControlSpellHook();
hooks::injectCMDRECV_BuildHooks();
*/
hooks::injectApplyUpgradeFlags();
/*hooks::injectAttackPriorityHooks();*/
hooks::injectBunkerHooks();
/*hooks::injectCloakNearbyUnits();
hooks::injectCloakingTechHooks();*/
hooks::injectDetectorHooks();
/*hooks::injectHarvestResource();*/
hooks::injectRallyHooks();
/*hooks::injectRechargeShieldsHooks();
hooks::injectSpiderMineHooks();
hooks::injectStimPacksHooks();*/
hooks::injectTechTargetCheckHooks();
/*hooks::injectTransferTechAndUpgradesHooks();
hooks::injectUnitSpeedHooks();
hooks::in
works. Something is little odd. cause when targeting Dark Templar he also lose 10 hp, f.ex. zealot only losing shields
None.

Responsible for my own happiness? I can't even be responsible for my own breakfast
The Dark Templar starts with 50 energy (all units have energy, but they only display it if you have the Spellcaster flag checked). When you cast Feedback on it, it first takes damage equal to its energy (enough to remove its shields and then do 10 HP damage) and then has its shields set to zero.
If you wait for a Zealot to have enough energy, it would also take HP damage.
wooo... that interesting
fix
se { //F6DE3
if(target->energy <= 0 && target->shields <= 0) //igal
unit->orderToIdle();
else {
if(units_dat::BaseProperty[target->id] & UnitProperty::Spellcaster){
target->damageWith(target->energy,WeaponId::Feedback,unit,unit->playerId,1,1);}
target->energy = 0;
target->shields = 0; //igal
unit->spendUnitEnergy(techCost);
scbw::playSound(SoundId::Protoss_Darchon_feedback_wav,target);
Post has been edited 1 time(s), last time on Aug 31 2019, 4:05 pm by Lagi.
None.