The Forums Are Now Closed!

The content will remain as a historical reference, thank you.

[MOD][UI] Rollover Ally Info v1.4.5

By on November 19, 2010 1:47:57 PM from Demigod Forums Demigod Forums

pacov

Join Date 02/2008
+182

Update - version v1.4.5 released - gold is now visible for your allies, but not visible for your enemies.  All credit goes to miriyaka. 


Back in Nov of 2009, a talented modder going by Chirmaya created an excellent mod for demigod called the Rollover Ally Info mod.  After Chirmaya released the mod and added in a gold display via an update, it became clear that you could see both your teammates' (good) and your enemies' (not so good) gold.  I've updated his original mod to suppress the gold information.  All credit for this mod goes to Chirmaya and credit for the enemy gold suppression fix goes to miriyaka.

Here are the details on the mod:

Features:

  • Adds a mana display to a unit's rollover information if they have mana
  • Adds a display of a friendly demigod's equipment
  • Adds a display of a friendly demigod's consumablesAdds a display of a friendly demigod's favor item
  • Adds a display of a friendly demigod's buffs and debuffs
  • Adds a display of a friendly demigod's gold
  • Will not display the popup for yourself

Changelog:

v1.4.5
-Updated code so that the gold display would be properly visible in observer mode when watching replays (fix by miriyaka)
v1.4.4
-Added gold display for allies only - enemy gold not viewable (all credit for fix goes to miriyaka)
v1.4.3
- Removed gold display from each team
v1.4.2
- Made it so that gold does not show up when a minion is highlighted.
v1.4.1
- Fixed a bug with the gold displaying for non-demigod teams.
v1.4
- Added gold display.
- Added consumable display.
- Added favour item display.
v1.3
- Name change from "Rollover Mana and Equipment Display" to "Rollover Ally Info".
- Added the display of the ally's buffs and debuffs.
v1.2
- Made the popup not show up when your cursor is over your own Demigod.
v1.1
- Fixed some items showing up with the incorrect images.

Notes:
This is a User-Interface mod, so it doesn't require anyone else to have it installed.

How to Install:
Run the executable.

How to Enable:
Inside Demigod, and under the Mod Manager, simply enable the mod!

Files modified (for mod conflict checking only):
lua\ui\game\HUD_rollover.lua

Download:
http://www.box.net/shared/bp2jum4r5k

Locked Post 24 Replies
Search this post
Subscription Options


Reason for Karma (Optional)
Successfully updated karma reason!
November 19, 2010 1:48:02 PM from Demigod Forums Demigod Forums

NT

Reason for Karma (Optional)
Successfully updated karma reason!
November 19, 2010 4:19:54 PM from Demigod Forums Demigod Forums

did you try just adding a conditional comparing the active player's team and the hovered-over objects team and only displaying the gold if that is the case? 

Reason for Karma (Optional)
Successfully updated karma reason!
November 19, 2010 4:41:04 PM from Demigod Forums Demigod Forums

did you try just adding a conditional comparing the active player's team and the hovered-over objects team and only displaying the gold if that is the case?

Did you go and assume I know how to code mods all that well? 

Reason for Karma (Optional)
Successfully updated karma reason!
November 19, 2010 6:10:16 PM from Demigod Forums Demigod Forums

well I'm a terrible mod coder I don't want to learn the entire code base and script languages are generally terribly coded... 

I just figured that was more of a logical, generic programmer step to take. I've looked at the mod's code as well in the past to do the same thing you're doing and that's what I figured would fix it and I looked around to see where that would be stored (AIBrain, iono?) but I couldn't figure out how to check the army's team and it would have required a few other modifications as well so I just shrugged it off. 

Reason for Karma (Optional)
Successfully updated karma reason!
November 20, 2010 10:27:16 AM from Demigod Forums Demigod Forums

Took a quick look at how it works, and each AIBrain just creates a sync table every beat containing its own gold, which gets pushed to all user sync tables.  InternalGiveResources and TakeResource would have to be destructively overridden to do an 'if IsAlly(GetFocusArmy(), self:GetArmyIndex()) then' check when populating this table, so each player's sync table only has allied gold in it.

Seems really simple and straightforward, but I've never messed with GetFocusArmy(), because it's easy to use it to create desyncs.  However, anything with effects/graphics and sync tables should be safe, so I'll give it a shot - I just won't be able to desync-test it.

 

Oh, and this change will break Chirmaya's version of the UI mod, which does a math.floor on ArmyGold[unit:GetArmy()], which will return nil and cause the entire rollover to stop functioning.  It's trivial to fix the UI mod so that it checks for the availability of the gold display before trying to read it, though.

Edit: Very trivial - the gold display block just needs an if condition after 'gold = ', like so:

Code: c++
  1.                 if gold then
  2.                     rollover.goldText:SetText(string.format("%d", math.floor(gold)))
  3.                     rollover.goldText:Show()
  4.                     rollover.goldIcon:Show()
  5.                 end
Reason for Karma (Optional)
Successfully updated karma reason!
November 20, 2010 11:39:29 AM from Demigod Forums Demigod Forums

AIBrain.lua hook with the absolute sim-side fix

This will be in any further releases of the Uberfix that I do (test or otherwise), and anyone can feel free to include it in any sim-side mod they want - it will play nice with itself, no matter how many copies of it are running.  I figured out a simple way to do it non-destructively, too.   I left gold visibility for observers in.  It's easy to remove if there's popular demand, but I figure there are already a jillion ways to use an observer client to cheat, and this one is pretty dang minor.

This fix does NOT break Chirmaya's final version of the mod, and will simply display 0 for enemy demigod gold amounts.  The original rollover mod can easily be changed to display nothing if gold is zero, AND not display enemy gold in non-fixed sim games by substituting this block, starting at line 264 of \hook\lua\ui\game\HUD_rollover.lua:

Code: c++
  1.                 local gold = ArmyGold[unit:GetArmy()]
  2.                 rollover.goldText:SetText(string.format("%d", math.floor(gold)))
  3.                 rollover.goldText:Show()
  4.                 rollover.goldIcon:Show()

with this:

Code: c++
  1.                 if IsAlly(unit:GetArmy(), GetFocusArmy()) then
  2.                     local gold = ArmyGold[unit:GetArmy()]
  3.                     if gold and gold > 0 then
  4.                         rollover.goldText:SetText(string.format("%d", math.floor(gold)))
  5.                         rollover.goldText:Show()
  6.                         rollover.goldIcon:Show()
  7.                     end
  8.                 end
Reason for Karma (Optional)
Successfully updated karma reason!
November 20, 2010 3:30:11 PM from Demigod Forums Demigod Forums

Yeah - I completely realize that as well, which was why there really wasn't much of a push to get this new version in place.  But that said, there's nothing to keep me from having the original post nuked so that folks can't get at the file if they don't already have it.  At the very least, a new version will be good for anyone that still likes the functionality of the mod, but feels like they are cheating by being able to see enemy gold. 

I see you've posted quite a bit of code and from your comment in the other thread, it sounds like you came up with a way to solve the gold problem.  I'll review as soon as I get a chance and I really appreciate your looking into this again for us.  Thanks!!!

Reason for Karma (Optional)
Successfully updated karma reason!
November 20, 2010 3:31:19 PM from Demigod Forums Demigod Forums

None of this really matters, since anyone who wants to see enemies' gold can still just use the original version, since it's a UI mod and can't be detected or restricted in a multiplayer game.

and side note - I have a solution for that in mind... just need to see if I can get a buy in from stardock.

Reason for Karma (Optional)
Successfully updated karma reason!
November 20, 2010 10:19:45 PM from Demigod Forums Demigod Forums

New executable is uploaded.  Op is updated.

Reason for Karma (Optional)
Successfully updated karma reason!
November 21, 2010 7:33:14 PM from Demigod Forums Demigod Forums

If someone could test a multiplayer game with a sim mod running that AIBrain.lua hook, I'd appreciate it. Make sure all players have an identical copy of the mod, and let me know if it causes a desync - it should happen almost immediately if there's an issue. I'm pretty sure the way I did it is safe, but I'd like to know for certain.

Not sure I can pull that off tonight, but I'll check with some folks over the next few days and get a test going for you.  Thanks.

Reason for Karma (Optional)
Successfully updated karma reason!
November 21, 2010 8:32:42 PM from Demigod Forums Demigod Forums

Compiled aibrain.lua into an exe.  Do not download/install this unless you are assisting me with testing.  http://www.box.net/shared/a5u98mllxe

 

Reason for Karma (Optional)
Successfully updated karma reason!
November 21, 2010 10:13:25 PM from Demigod Forums Demigod Forums

ok - I did get a test in.  Miriyaka - please download the mod I uploaded above and confirm that I have it coded the way you wanted it (just a copy and paste, but let's make sure).  I played a > 30 min game against in1 (both of us having the mod installed) with no desyncs and all was normal.  Check my work and let me know. 

Reason for Karma (Optional)
Successfully updated karma reason!
November 22, 2010 5:46:29 AM from Demigod Forums Demigod Forums

Yep, that looks fine.  Thanks for testing it.
Welp, actually, it isn't in a hook folder.  So it wasn't being used at all.  Modified it so that it should be running now: link

Reason for Karma (Optional)
Successfully updated karma reason!
November 22, 2010 6:21:44 AM from Demigod Forums Demigod Forums

Uh... :/ Well, Pacov, I can test it with you one more time, if you wish.

Reason for Karma (Optional)
Successfully updated karma reason!
November 22, 2010 11:20:23 AM from Demigod Forums Demigod Forums

Don't feel like you have to play an actual game with it - it's something that runs every time gold is given, which happens within the first 0.1 seconds of the game.  A desync should be nearly instant if it's going to happen at all.

I'm probably being unnecessarily paranoid about this, but I haven't been testing my code thoroughly enough (and not at all in multiplayer), and I want to make sure I'm not creating more problems than I'm fixing.

Reason for Karma (Optional)
Successfully updated karma reason!
November 22, 2010 11:54:25 AM from Demigod Forums Demigod Forums
doh. well, the joys of quickly coding a mod. anyway, i'll see if i can give this a go tonight.
Reason for Karma (Optional)
Successfully updated karma reason!
November 22, 2010 12:01:48 PM from Demigod Forums Demigod Forums

Yes, yes, that's all perfectly understandable, and I don't think you are unnecessarily paranoid, either. It's always better to "overdo" such things, so to say. Anyway, I'm available after ~7 PM EST, so I trust Pacov will contact me if he needs help: 20 minutes of my time is no epic sacrifice for community's sake.

Reason for Karma (Optional)
Successfully updated karma reason!
November 22, 2010 2:11:27 PM from Demigod Forums Demigod Forums

Thanks guys.  If all goes well, I'll release another RC of the Uberfix with this change, and a lot of other things.  For what it's worth, I had managed to somehow screw up Oculus' Brain Storm in the last release, and I found a few other fixes dating back to 1.02 that weren't actually implemented properly, and weren't working (like the IgnoreFacing flags on Sludge Slinger et al).

Reason for Karma (Optional)
Successfully updated karma reason!
November 22, 2010 4:32:13 PM from Demigod Forums Demigod Forums

did you merge in the Ironwalker's change and stuff? I've looked around on the google.code website but it was such a terrible mess it chased me away 

Reason for Karma (Optional)
Successfully updated karma reason!
November 22, 2010 5:25:37 PM from Demigod Forums Demigod Forums

OK - here is a link to an executable using the aibrain.lua.  Figured I'd just compile the code properly as I already had the create exe script built:  http://www.box.net/shared/t6szahf1kp.

Again, only download this if you are helping me with testing. 

Reason for Karma (Optional)
Successfully updated karma reason!
November 22, 2010 5:37:15 PM from Demigod Forums Demigod Forums

Ok - Darkliath was kind enough to test with me.  We played about 2 minutes of a game and there was no desync. 

In addition, using the original rollover ally info mod, with your coding change in place, I was unable to see the enemies gold, so it clearly is suppressing information as expected.  I'd say this is good to be added to uber. 

Reason for Karma (Optional)
Successfully updated karma reason!
November 26, 2010 6:59:53 PM from Demigod Forums Demigod Forums

Just a quick fyi - seems like quite a few people have started using this mod now.  >30 downloads in our small community.  Good stuff!

Reason for Karma (Optional)
Successfully updated karma reason!
November 28, 2010 1:06:23 PM from Demigod Forums Demigod Forums

Whoops, I just found a bug with the code I added to prevent the display of enemy gold - namely that it errors out when an observer mouses over any demigod.

Replace line 265 in HUD_rollover with the following, which gives observers a pass:

Code: c++
  1. if GetFocusArmy() < 1 or IsAlly(unit:GetArmy(), GetFocusArmy()) then

 

To be clear, this should be replacing:

Code: c++
  1. if IsAlly(unit:GetArmy(), GetFocusArmy()) then

 

Sorry about that - it never occurred to me to test it in observer mode, and I only discovered this problem with GetFocusArmy/IsAlly a few days ago when working with Peppe on the Skirmish AI mod.

Reason for Karma (Optional)
Successfully updated karma reason!
November 28, 2010 8:14:40 PM from Demigod Forums Demigod Forums

Updated and published version 1.4.5 based on your revision. 

Reason for Karma (Optional)
Successfully updated karma reason!
Stardock Forums v1.0.0.0    #108432  walnut2   Server Load Time: 00:00:00.0000187   Page Render Time: