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.
[11:39 pm]
Corbo -- I wouldn't go to say it's unbelieveable but silly it definitely is
[11:39 pm]
Corbo -- but yes, the plot is silly
[11:38 pm]
Corbo -- don't hate
[11:38 pm]
Corbo -- Salazar was great
[11:25 pm]
KrayZee -- The President of the United States only sending only 1 man equipped with a pistol to rescue his daughter? Then Leon has to deal with midget Napoleon, how can you take that seriously? :P
[11:23 pm]
KrayZee -- The plot in Resident Evil 4? It's just too silly.
[11:07 pm]
Corbo -- You don't find that believeable?
[07:38 pm]
Wing Zero -- I played 6 for a bit but wasn't too happy with it. Haven't played another one since then though.
[2019-12-14. : 8:18 am]
KrayZee -- If Resident Evil 4 is getting a remake, they better make the plot believable. Like actually send an entire team to rescue the President's daughter but the team was ambushed and all equipment were lost. Leon is the only survivor and only kept a handgun. Later he would hitchhike and get picked up. He then asked to be dropped off the nearest town.
[2019-12-14. : 4:01 am]
RIVE -- The significance is lessened by the probability of future RE titles ignoring either conclusion in favor of a rewrite anyway.
Please log in to shout.


Members Online: Roy, susan049, Ottinges80, pegimolti32