Staredit Network > Forums > Modding Assistance > Topic: [solved] change dmg type with upgrade
[solved] 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.

Post has been edited 1 time(s), last time on Aug 26 2019, 7:22 am by Lagi.



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.

Aug 12 2019, 10:13 pm Lagi Post #13



what is this ? what this do?

&& unit->orderSignal & 0x20



None.

Aug 20 2019, 7:16 pm Voyager7456 Post #14

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

Quote from Lagi
what is this ? what this do?

&& unit->orderSignal & 0x20

I was using the order signal to communicate when the flamethrower graphic needs to be created.

Code
FirebatGndAttkRpt:
   wait               1
   nobrkcodestart    
   sigorder         32


Here in the iscript, sigorder 32 is setting the 0x20 orderSignal flag.

unit->orderSignal & 0x20 is a condition that checks if that flag is set, the code then spawns the flamethrower graphic and then finally clears the 0x20 flag so we don't spawn it again.



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]


Sep 14 2019, 6:41 pm Lagi Post #15



i dont understand how to convert sigorder into order singal flag

f.ex. corsair

CorsairCastSpell:
playfram 0x00 # Frame set 0
nobrkcodestart
wait 1
playfram 0x00 # Frame set 0
wait 1
playsnd 1059 # Protoss\Corsair\PCorWeb1.wav
castspell
nobrkcodeend
gotorepeatattk
sigorder 2


sigorder 2 , which 0x0__ would that be?



None.

Sep 14 2019, 7:03 pm Pr0nogo Post #16



https://www.rapidtables.com/convert/number/hex-to-decimal.html




Sep 14 2019, 8:12 pm Lagi Post #17



thanks,

this dont work however

if((unit->mainOrderId == OrderId::CastDisruptionWeb) && (unit->orderSignal & 0x02)
&& (unit->sprite->mainGraphic->animation == IscriptAnimation::CastSpell ))

{
unit->vulture.spiderMineCount--;




None.

Sep 19 2019, 8:58 am UndeadStar Post #18



In your earlier iscript, you put "sigorder 2" after "gotorepeatattk".
If you really wrote it like that, it's probably never used.



None.

Sep 25 2019, 6:30 am muscerly Post #19



try it https://unitconverter.net/binary-converter it may helps you.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[08:55 pm]
Vrael -- not really two-party-system specific but it was kinda a big deal when those old guys wrote about "unalienable rights" and that stuff
[08:54 pm]
Vrael -- Oh_Man
Oh_Man shouted: basically i'm saying two party systems sap the violence out of a population by giving them the illusion of choice, instead of feeling the need to rebel, they just say "well i'm not voting for you next time"
you kinda missed those minor details about how fundamental rights are baked into democratic systems so you actually have power to change the system (to whatever degree you wanna argue), whereas in other systems your only option is "no u", aka it's not an illusion of choice
[08:52 pm]
Ultraviolet -- what are you trying to accomplish here?
[08:51 pm]
sraw531 -- similar to how people farm scarabs.
[08:50 pm]
sraw531 -- was toying with the thought of trying to get a computer to continuously make nexi in the corner of the map and have triggers remove it occasionally, but I honestly don't know how to do that.
[08:48 pm]
Ultraviolet -- sraw531
sraw531 shouted: is there a way to create using triggers a building that is under construction? (Especially protoss, for multiple reasons)
afaik this is not possible
[08:46 pm]
sraw531 -- though ~3400 units on map is also an improvement considering reavers are 11 and carriers are 9 units.
[08:45 pm]
sraw531 -- GGmano
GGmano shouted: Yea see it describet as ccmu fix
I think my favorite part about ccmu fix is probably the 400 weapon limit. 100 is so low, considering 10 valks is 80 of that.
[08:41 pm]
Ultraviolet -- Suicidal Insanity
Suicidal Insanity shouted: Ultraviolet The devs are fairly good about backwards compatibility, just sometimes takes time
Fair enough, random crashes are always scary though :P
[07:36 pm]
Suicidal Insanity -- Ultraviolet
Ultraviolet shouted: martosss So you've had issues with maps that were previously playable having issues with the latest patch as well? I was play testing one of my creations a couple days ago and it crashed the game, something it has never done before. Has me feeling kind of concerned about playability of custom content going forward :/
The devs are fairly good about backwards compatibility, just sometimes takes time
Please log in to shout.


Members Online: Roy, hamlet337017, Gladishse10, yxekow