XenesisXenon / AW2-InfiniteCOs

A modding project for Advance Wars 2 to allow expansion
http://forums.warsworldnews.com/viewtopic.php?f=11&t=13526
12 stars 6 forks source link

Defence function collects incorrect CO Unit stats #22

Closed TheMasterCreed closed 3 years ago

TheMasterCreed commented 3 years ago

Certain CO's, like Eagle, do not have the appropriate defense boosts to their specialty units.

Tried editing the CO's in the editor and no matter what you change the defense to, after compiling, their defense still remains at 0.

For example, changed Eagle's air defense to 50 just for giggles and when entering a match, his air units still remain at 0 defense. Tried it with the other slots just to make sure but those slots are for Attack, Movement, and Range respectively. This seems to only be an issue with unit specializations, because when setting the function SetCOD2DAllStat, all units are effected appropriately.

XenesisXenon commented 3 years ago

The unit specialisations that are set are scripts, they run in sequential order - if you set a specific boost and then run allstat, the allstat will overwrite the specific boost. So if you want to change the stats set, do it like following

  1. Set allstat
  2. Set unit specific boost

However, I'm sure there are mistakes in here so I'll make sure to check them over.

TheMasterCreed commented 3 years ago

Untitled This is what I have set, still no defense value. However I will use the unit specific script and see if that fixes my issue. Thanks!

TheMasterCreed commented 3 years ago

Untitled Untitled2

Still no luck, here is what is in my script. Even checked the actual battle forecast. No extra defense.

TheMasterCreed commented 3 years ago

Technically speaking, I could set StatAll to Eagle's value's, and then go through every other unit in the game and set their appropriate stats using the unit specific script.

Example: setCOD2DAllStat coeagle,15,10,0,0 setCOD2DUnitStat coeagle,Unit_Infantry,0,0,0,0 setCOD2DUnitStat coeagle,Unit_Mech,0,0,0,0

But do I feel like doing unit by unit? No, I still might though xD.

XenesisXenon commented 3 years ago

Oh no please don't do that. I'll have a look through and see what's wrong.

TheMasterCreed commented 3 years ago

You are amazing, thank you!

TheMasterCreed commented 3 years ago

Okay so something I discovered.

When using SetCOAllUnitStat, it works fine on it's own. All stats get set as they should be.

However when anything else that changes stats comes after that command, the defense gets "overlooked".

Example: SetCOD2DAllUnitStat coeagle,10,10,1,1 This works perfectly fine.

Example2: SetCOD2DAllUnitStat coeagle10,10,1,1 SetCOD2DUnitStat coeagle,Unit_Infantry,0,0,0,0 This sets defense to 0 for all units.

Hope this helped!

XenesisXenon commented 3 years ago

Confirmed reproduction of the issue, doesn't appear to be a simple fix.

Only affects defence attribute - Firepower, movement and range work correctly Affects scripts for D2D, Power and Super

Bug in the defence value function - value is written correctly but is not being used

XenesisXenon commented 3 years ago

Confirmed source of issue: Defence collection function does not grab from Unit ID, is grabbing solely from Unit 1 in the list (Infantry). Reproduce by giving infantry a defence boost and all units will have defence boosts

XenesisXenon commented 3 years ago

This should fix the issue, now defence should be grabbed correctly. If you come across incorrect CO numbers, etc, please place another issue