Staredit Network > Forums > Modding Assistance > Topic: (solved) Feedback remove shields
(solved) Feedback remove shields
Nov 13 2018, 10:29 pm
By: Lagi  

Nov 13 2018, 10:29 pm Lagi Post #1



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.

Aug 24 2019, 3:12 pm Lagi Post #2



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.

Aug 27 2019, 11:43 pm Voyager7456 Post #3

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

Quote from Lagi
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.



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 29 2019, 9:58 am Lagi Post #4



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.

Aug 29 2019, 2:53 pm Voyager7456 Post #5

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.



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:03 pm Lagi Post #6



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


works. Something is little odd. cause when targeting Dark Templar he also lose 10 hp, f.ex. zealot only losing shields



None.

Aug 31 2019, 3:38 pm Voyager7456 Post #7

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.



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, 3:46 pm Lagi Post #8



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.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:39 am]
Ultraviolet -- no u elky skeleton guy, I'll use em better
[10:50 pm]
Vrael -- Ultraviolet
Ultraviolet shouted: How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
hey cut it out I'm getting all the minerals
[10:11 pm]
Ultraviolet -- :P
[10:11 pm]
Ultraviolet -- How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
[2024-4-17. : 11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- if i don't gamble them away first
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
[2024-4-17. : 3:26 am]
O)FaRTy1billion[MM] -- i have to ask for minerals first tho cuz i don't have enough to send
[2024-4-17. : 1:53 am]
Vrael -- bet u'll ask for my minerals first and then just send me some lousy vespene gas instead
[2024-4-17. : 1:52 am]
Vrael -- hah do you think I was born yesterday?
Please log in to shout.


Members Online: Roy