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.
[06:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[06:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[06:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
[06:49 pm]
Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
[06:48 pm]
Vrael -- On this Topic, I could definitely use some Introductions.
[06:48 pm]
Vrael -- Perhaps that utilizes cutting-edge technology and eco-friendly cleaning products?
[06:47 pm]
Vrael -- Do you know anyone with a deep understanding of the unique characteristics of your carpets, ensuring they receive the specialized care they deserve?
[06:45 pm]
NudeRaider -- Vrael
Vrael shouted: I've also recently becoming interested in Carpet Cleaning, but I'd like to find someone with a reputation for unparalleled quality and attention to detail.
beats me, but I'd make sure to pick the epitome of excellence and nothing less.
[06:41 pm]
Vrael -- It seems like I may need Introductions to multiple companies for the Topics that I care deeply about, even as early as Today, 6:03 am.
[06:38 pm]
Vrael -- I need a go-to solution and someone who understands that Carpets are more than just decorative elements in my home.
Please log in to shout.


Members Online: IlyaSnopchenko, Ultraviolet