• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Hidden Cheat

Status
Not open for further replies.
Level 3
Joined
Jan 16, 2023
Messages
14
I have a mod that I play alot that seems to have at least two versions, each of which has some issues. One has a cheat, and the other has some undesirable game properties.
I've looked through both versions and the trigger scripts are identical, but I've checked that the cheat is not present in the second version. Does anyone know where someone would be able to embed a cheat into a mod outside that?
The cheat is specifically that you get a crazy amount of gold from cancelling a building construction.
The attached files are the mods, the second version is the cheat one.
 

Attachments

  • RandomFarmTD_0.57a_EN_fix1.w3x
    2.2 MB · Views: 1
  • RandomFarmTD_0.57a_en_fix1~1.w3x
    2.2 MB · Views: 3

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,558
I think I found it:
vJASS:
call SetPlayerStateBJ(ConvertedPlayer(GetUnitUserData(GetTriggerUnit())),PLAYER_STATE_RESOURCE_GOLD,(GetPlayerState(ConvertedPlayer(GetUnitUserData(GetTriggerUnit())),PLAYER_STATE_RESOURCE_GOLD)+(udg_integer03*20)))
It looks like they're multiplying the gold by 20 when a unit (tower I guess) dies.

Just remove the *20 from it and you should be good to go:
vJASS:
call SetPlayerStateBJ(ConvertedPlayer(GetUnitUserData(GetTriggerUnit())),PLAYER_STATE_RESOURCE_GOLD,(GetPlayerState(ConvertedPlayer(GetUnitUserData(GetTriggerUnit())),PLAYER_STATE_RESOURCE_GOLD)+(udg_integer03)))

But I could be mistaken. All I did was look through the code for anywhere you see this PLAYER_STATE_RESOURCE_GOLD as that's where Gold is being referenced. There's 23 occurrences of it throughout the script.

So I would use the Find tool in the Trigger Editor and search for udg_integer03*20 then simply delete *20.
 
Last edited:
Level 3
Joined
Jan 16, 2023
Messages
14
I think I found it:
vJASS:
call SetPlayerStateBJ(ConvertedPlayer(GetUnitUserData(GetTriggerUnit())),PLAYER_STATE_RESOURCE_GOLD,(GetPlayerState(ConvertedPlayer(GetUnitUserData(GetTriggerUnit())),PLAYER_STATE_RESOURCE_GOLD)+(udg_integer03*20)))
It looks like they're multiplying the gold by 20 when the unit dies.

Just remove the *20 from it and you should be good to go:
vJASS:
call SetPlayerStateBJ(ConvertedPlayer(GetUnitUserData(GetTriggerUnit())),PLAYER_STATE_RESOURCE_GOLD,(GetPlayerState(ConvertedPlayer(GetUnitUserData(GetTriggerUnit())),PLAYER_STATE_RESOURCE_GOLD)+(udg_integer03)))

But I could be mistaken. All I did was look through the code for anywhere you see this PLAYER_STATE_RESOURCE_GOLD as that's where Gold is being referenced. There's 23 occurrences of it throughout the script.

So I would use the Find tool in the Trigger Editor and search for udg_integer03*20 then simply delete *20.
I think that's intentional, the gold you get from cancelling building a tower is more like 1000x. But I can't really figure out what's triggering the 20x, it's apparently
GetUnitTypeId(GetTriggerUnit())=='h010', 'h01A', 'h03Y','h04B'
Is there a list of these Ids somewhere? I'm thinking it's referring to some hash table somewhere or something, but Google isn't being helpful.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,558
Those are the rawcodes of several different unit-types. You can view rawcodes in the Object Editor by pressing Control + D, h010 would be one of the many towers I imagine. It looks like it's giving you 20x more gold if the dying tower was one of those few.

Anyway, I don't think there's any special tricks going on here, I imagine someone simply threw in a *1000 somewhere in the code.

Look into udg_integer03 as well, it's part of the gold refund equation.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,558
Oh, I believe I see the issue now. It was setting the player's gold instead of adding to it. Change the Trig_gold_Actions function to look like this:
vJASS:
function Trig_gold_Actions takes nothing returns nothing
    call AddSpecialEffectTargetUnitBJ("origin",GetTriggerUnit(),"UI\\Feedback\\GoldCredit\\GoldCredit.mdl")
    call DestroyEffectBJ(GetLastCreatedEffectBJ())
    if(Trig_gold_Func005C())then
        call AdjustPlayerStateBJ(udg_integer03*20, ConvertedPlayer(GetUnitUserData(GetTriggerUnit())), PLAYER_STATE_RESOURCE_GOLD)
        call CreateTextTagUnitBJ(("|c00ffcc00+"+(I2S((udg_integer03*20))+" |r")), GetDyingUnit(), -10.00,9.50,100,100,100,0)
    else
        call AdjustPlayerStateBJ(udg_integer03, ConvertedPlayer(GetUnitUserData(GetTriggerUnit())), PLAYER_STATE_RESOURCE_GOLD)
        call CreateTextTagUnitBJ(("|c00ffcc00+"+(I2S(udg_integer03)+" |r")), GetDyingUnit(), -10.00,9.50,100,100,100,0)
    endif
    call SetTextTagVelocityBJ(GetLastCreatedTextTag(),60.00,90.00)
    call SetTextTagPermanentBJ(GetLastCreatedTextTag(),false)
    call SetTextTagLifespanBJ(GetLastCreatedTextTag(),1.40)
    call SetTextTagFadepointBJ(GetLastCreatedTextTag(),0.65)
endfunction
I'm assuming the *20 thing is actually intentional and is used by those specific towers for a reason.

Edit: I guess this wasn't the issue, although this is far more efficient than what it was doing before, lol.
 
Last edited:
Level 3
Joined
Jan 16, 2023
Messages
14
Those are the rawcodes of several different unit-types. You can view rawcodes in the Object Editor by pressing Control + D, h010 would be one of the many towers I imagine. It looks like it's giving you 20x more gold if the dying tower was one of those few.

Anyway, I don't think there's any special tricks going on here, I imagine someone simply threw in a *1000 somewhere in the code.

Look into udg_integer03 as well, it's part of the gold refund equation.
Thanks for the help. I've found the codes and the relevant towers. One last thing if you don't mind, since the codes are identical, could there be like a cancel-gold-value attribute hardcoded into the unit that could be involved?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,558
Thanks for the help. I've found the codes and the relevant towers. One last thing if you don't mind, since the codes are identical, could there be like a cancel-gold-value attribute hardcoded into the unit that could be involved?
Okay, I figured it out. I was too focused on something like a triggered refund ability and forgot to check the standard mechanics first.
It's a simple fix in the Gameplay Constants:

refund.png
 
Status
Not open for further replies.
Top