Staredit Network > Forums > Modding Assistance > Topic: (help pls) change dmg type with upgrade
(help pls) change dmg type with upgrade
Nov 18 2018, 8:23 am
By: Lagi  

Nov 18 2018, 8:23 am Lagi Post #1



I like to change firebat dmg type with upgrade from concussive into normal

can someone correct my green line?

Quote
//Firebat if upgrade 57 normal damage
if(unit->id == UnitId::TerranFirebat &&
scbw::getUpgradeLevel(unit->playerId, UpgradeId::UnusedUpgrade57) > 0){
unit->status = DamageType::Normal;
}//Firebat if upgrade 57 normal damage

i also try with
weapons_dat::DamageType[DamageType::Normal]

but its either not working or "freezing" firebat.



None.

Nov 18 2018, 4:59 pm UndeadStar Post #2



The status of an unit is made of constantly evolving flags.Doing "unit->status = value" is definitely wrong, unless you did "value = unit->status" before then set or unset some flags on "value" with & or | and using the "UnitStatus" enum.



None.

Nov 18 2018, 5:00 pm Lagi Post #3



SOLVED

in file weapon_damage.cpp, search for purple txt below

Quote
//Firebat if upgrade 57 normal damage
if(weaponId == WeaponId::FlameThrower &&
scbw::getUpgradeLevel(attacker->playerId, UpgradeId::UnusedUpgrade57)){
damageType = 3; //"3" its normal damage type
}//Firebat if upgrade 57 normal damage
else{

damageType = weapons_dat::DamageType[weaponId];
}

you need also to uncomment the hooks::injectWeaponDamageHook(); in initialize.cpp

if you activating the hook, it will overwrite the data you changed in Firegraft or datEdit.

for unused upgrade57 (in above example) you need to add cost in .dat (in datEdit or PyDat), add the button and set the requirements in Firegraft.

=======================

now, how to change the flame GRP from orange into blue?



None.

Nov 25 2018, 5:15 pm Voyager7456 Post #4

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

Charon Boosters change the color of missile smoke from orange to blue once researched in some hardcoded way, but I don't think anyone has actually looked at how they accomplish that.

Without writing a new hook, I think the best option would be to remove the sprol call that generates the flames from the Firebat iscript, and instead put in a sigorder call (use something that it isn't already used for some purpose - I believe 64 will work). Then have your plugin detect when the Firebat's order state is 64, and create the flame overlay. Then it will be simple enough to spawn a different sprite depending on what the upgrade status is.



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]


Nov 26 2018, 7:50 pm Lagi Post #5



thanks voyager, will try iscript - sounds easier
(now i have vague clue, what you talking about :) )

there is enum ColorRemapping
flamer use Ofire
and i check that Bfire is actually making them blue (with black inside but whatever)

I look into it,after I get bored with Diablo 1 Thernobog and Ancestor Legacy, i will do something, "somewhere" like this (write here to not forget or have easier time to recall):

if upg(unused57>0) (
Flamer = CImage::setRemaping(ColorRemapping::Bfire).

this would not work, but its a step in my investigation.



None.

Nov 26 2018, 8:02 pm Voyager7456 Post #6

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

Mapping to Bexpl have the flames appear blue, without the black/transparent weirdness in the center.

I'll write an example plugin after work and show you what I'm talking about in my previous post. Keep in mind that you wouldn't necessarily want to change the mapping of the flamer image when you research the upgrade, because that would change the image for all players.



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]


Nov 28 2018, 8:00 am O)FaRTy1billion[MM] Post #7

👻 👾 👽 💪

Quote from Voyager7456
Charon Boosters change the color of missile smoke from orange to blue once researched in some hardcoded way, but I don't think anyone has actually looked at how they accomplish that.
While it's not really relevant to the topic... Hardcoded in the SPROL iscript opcode is a check if the current object is a bullet fired from a hero goliath or a goliath owned by a player with the upgrade, and if it is then it creates an overlay with an ID of 505, otherwise it creates an overlay with whatever ID was passed in the opcode's argument.



TinyMap2 - Latest in map compression! ( 7/09/14 - New build! )
EUD Action Enabler - Lightweight EUD/EPD support! (ChaosLauncher/MPQDraft support!)
EUDDB - topic - Help out by adding your EUDs! Or Submit reference files in the References tab!
MapSketch - New image->map generator!
EUDTrig - topic - Quickly and easily convert offsets to EUDs! (extended players supported)
SC2 Map Texture Mask Importer/Exporter - Edit texture placement in an image editor!
\:farty\: This page has been viewed [img]http://farty1billion.dyndns.org/Clicky.php?img.gif[/img] times!

Nov 30 2018, 11:29 am Lagi Post #8



using this plugin and playing with firebat. When i send FB to combat and they start dying, I encounter almost always error:

instruction under 0x0...0###93E5 is refering to the memory 0x0...04C. Memory can not be read.


in gtpt 0x04c is playerId in CUntiLayout

it doesnt matter if i have or not upgrade - error occur.
if I comment the damagetype modification, game is stable

any idea?



None.

Nov 30 2018, 6:36 pm Voyager7456 Post #9

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

Quote
//Firebat if upgrade 57 normal damage
if(attacker &&
weaponId == WeaponId::FlameThrower &&
scbw::getUpgradeLevel(attacker->playerId, UpgradeId::UnusedUpgrade57)){
damageType = 3; //"3" its normal damage type
}//Firebat if upgrade 57 normal damage
else{

damageType = weapons_dat::DamageType[weaponId];
}

Sounds like the Firebat is dying while its projectile was still on the map. Add a check to make sure the attacker pointer isn't NULL to avoid a null pointer dereference, like this.



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]


Nov 30 2018, 11:48 pm Lagi Post #10



It works.

Very much - thank you

you are magnificent



None.

Dec 1 2018, 8:23 pm Voyager7456 Post #11

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

Here's the plugin I was describing for changing the flame color:

game_hooks.cpp
for (CUnit *unit = *firstVisibleUnit; unit; unit = unit->link.next) {
            ...

            if(unit->id == UnitId::firebat && unit->orderSignal & 0x20
                && (unit->sprite->mainGraphic->animation == IscriptAnimation::GndAttkRpt
                || unit->sprite->mainGraphic->animation == IscriptAnimation::GndAttkInit)) {
                unit->orderSignal &= ~(0x20);
                u32 frameAngle = (unit->currentDirection1) / 8 % 32;
                if(scbw::getUpgradeLevel(unit->playerId, UnusedUpgrade57))
                    unit->sprite->createOverlay(420, 0, 0, frameAngle);
                else
                    unit->sprite->createOverlay(421, 0, 0, frameAngle);
               
               
            }
        }


bunker_hooks.cpp
void createBunkerAttackThingyHook(CUnit* unit) {

    ...

    if (unit->id == UnitId::firebat || unit->id == UnitId::gui_montag) {
        frameAngle = ((unit->currentDirection1 + 8) / 16 % 16) * 16;
        if(scbw::getUpgradeLevel(unit->playerId, UpgradeId::UnusedUpgrade57))
            spriteId = 372; //Firebat flamethrower graphics
        else
            spriteId = 378;
        unit->orderSignal &= ~(0x20);
    }

...


Firebat Iscript
...
FirebatGndAttkRpt:
    wait               1
    nobrkcodestart    
    sigorder         32
    playfram           0x11     # frame set 1
    attkshiftproj       24
    wait               1
    attkshiftproj       52
    wait               1
    attkshiftproj       80
    wait               5
    playfram           0x00     # frame set 0
    wait               2
    nobrkcodeend
    gotorepeatattk
    ignorerest        
...


Obviously you will need to have the bunker hooks enabled in initialize.cpp. I replaced the entry for image ID 420 (Plasma Drip) in images.dat with an identical copy of ID 421 (Flamethrower) and just changed the remapping to use bexpl.pcx.



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]


Dec 2 2018, 2:50 pm Lagi Post #12



woow thanks

edit:
Quote from Voyager7456
Here's the plugin I was describing for changing the flame color:


for (CUnit *unit = *firstVisibleUnit; unit; unit = unit->link.next) {
...

if(unit->id == UnitId::firebat && unit->orderSignal & 0x20
&& (unit->sprite->mainGraphic->animation == IscriptAnimation::GndAttkRpt
|| unit->sprite->mainGraphic->animation == IscriptAnimation::GndAttkInit)) {
unit->orderSignal &= ~(0x20);
u32 frameAngle = (unit->currentDirection1) / 8 % 32;
if(scbw::getUpgradeLevel(unit->playerId, UpgradeId::UnusedUpgrade57))
unit->sprite->createOverlay(420, 0, 0, frameAngle);
else
unit->sprite->createOverlay(421, 0, 0, frameAngle);


}
}

bunker_hook need #include <SCBW/api.h>

in DatEdit i change the image values
iscript save and input into .mpg
&
it works!!!

"dont run SCV! blue flame is healing"

Post has been edited 3 time(s), last time on Dec 2 2018, 4:37 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.
[09:32 pm]
O)FaRTy1billion[MM] -- iirc the last byte in the TRIG is for more flags or something
[09:15 pm]
Wormer -- also, when I wear cartoon it turns off the dynamic lighting and doesn't turn it on when I switch back, maybe that kind of incompatibilities were the problem
[09:02 pm]
Suicidal Insanity -- Wormer
Wormer shouted: Pr0nogo THAT why it's impossible to switch that skin on the fly
My guess is GPU memory constraints
[09:02 pm]
Suicidal Insanity -- I think its 27 and padding
[09:01 pm]
Wormer -- Wormer
Wormer shouted: or the guide (http://www.starcraftai.com/wiki/CHK_Format#.22UNIT.22_-_Placed_Units) is wrong there and it should be u8[27] ?
the right link http://www.starcraftai.com/wiki/CHK_Format#.22TRIG.22_-_Triggers
[09:01 pm]
Wormer -- or the guide (http://www.starcraftai.com/wiki/CHK_Format#.22UNIT.22_-_Placed_Units) is wrong there and it should be u8[27] ?
[08:59 pm]
Wormer -- anybody knows why chk format has a list of 27 player group IDs (http://www.starcraftai.com/wiki/CHK_Format#List_of_Players.2FGroup_IDs), but TRIG section uses an array of 28 elements => suppose the last byte is padding as well?
[08:57 pm]
Wormer -- but it's actually possible to switch between cartoon and classic skin which is cool
[08:52 pm]
Wormer -- Pr0nogo
Pr0nogo shouted: they coded a new system in for it
THAT why it's impossible to switch that skin on the fly
[08:51 pm]
Pr0nogo -- i don't remember if it was because the old system was limited to only 2, or they didn't know how to increase it, or what
Please log in to shout.


Members Online: Roy, Unsweetened, Pandut, Pr0nogo, ivyjij