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.
[07:46 am]
RIVE -- :wob:
[2024-4-22. : 6:48 pm]
Ultraviolet -- :wob:
[2024-4-21. : 1:32 pm]
Oh_Man -- I will
[2024-4-20. : 11:29 pm]
Zoan -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
You should do my Delirus map too; it's a little cocky to say but I still think it's actually just a good game lol
[2024-4-20. : 8:20 pm]
Ultraviolet -- Goons were functioning like stalkers, I think a valk was made into a banshee, all sorts of cool shit
[2024-4-20. : 8:20 pm]
Ultraviolet -- Oh wait, no I saw something else. It was more melee style, and guys were doing warpgate shit and morphing lings into banelings (Infested terran graphics)
[2024-4-20. : 8:18 pm]
Ultraviolet -- Oh_Man
Oh_Man shouted: lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
oh ya I saw that when Armo posted it on Discord, pretty crazy
[2024-4-20. : 8:09 pm]
Vrael -- thats less than half of what I thought I'd need, better figure out how to open SCMDraft on windows 11
[2024-4-20. : 8:09 pm]
Vrael -- woo baby talk about a time crunch
[2024-4-20. : 8:08 pm]
Vrael -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
so that gives me approximately 27 more years to finish tenebrous before you get to it?
Please log in to shout.


Members Online: jackwrwn85, zzt