Results 1 to 19 of 19

Accessory Weapon Counter?

  1. #1
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia

    Accessory Weapon Counter?

    I need a way to indicate the number of accessory weapon (grenades, panzerfausts, special ammunition, etc) slot items a unit is carrying. I've encountered problems so far though:



    UI decorator: disappears in buildings and is incompatible with other decorators (like the Brit officer decorators).

    Slot item: dodgy in general, the icon is incompatible with other upgrade icons.

    Kicker message: can't be checked out at a glance if temporary, interferes with other kicker messages if permanent.

    Extra UI box(es): Can't work out how to display relevant information when a squad is selected (if it's even possible).

    Passive ability/upgrade (with the actual icon displaying the grenade count): would look unprofessional (right next to other abilities/upgrades, would either be clickable or greyed out with requirement text).

    UI text (like VP notifiers): pretty much a last resort, unless it's more versatile that I think it is?



    Are there any other options I've overlooked? I could really use a hand here.
    Last edited by I_am_a_Spoon; 21st Aug 12 at 6:15 PM.

  2. #2
    Member eliw00d's Avatar
    Join Date
    Jul 2008
    Location
    USA
    RE: Extra UI boxe(s): it is possible, but requires a lot of SCAR.

  3. #3
    is there a way to input the squad slot item counts when click on them ??

  4. #4
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    You'd just need to obtain the number of slot items wouldn't you? Somehow.

  5. #5
    Member eliw00d's Avatar
    Join Date
    Jul 2008
    Location
    USA
    You can put whatever you want in there, they are just localized strings. However, you would need a system set up (in SCAR) to know the number of slot items on every unit. I still advise against using slot_items, at least with vehicles, since slot_items boot out cargo in transports and such. Upgrades are much cleaner.

  6. #6
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    Upgrades can't be quantified by a requirement action though.

  7. #7
    Member eliw00d's Avatar
    Join Date
    Jul 2008
    Location
    USA
    True.

  8. #8
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    Sorry, what did you mean by "slot_items boot out cargo in transports"?

  9. #9
    Member eliw00d's Avatar
    Join Date
    Jul 2008
    Location
    USA
    When a transport vehicle that is carrying Squads is given a slot_item, it is hard-coded to boot out those Squads. I think it's because most slot_items for transport vehicles are permanent upgrades, like the Maxson Quad or the Flammenwerfer.

  10. #10
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    Really? Damn, I was hoping for special shell types.

    Ok so how would you obtain the number of slot items a squad has through SCAR?

  11. #11
    Member eliw00d's Avatar
    Join Date
    Jul 2008
    Location
    USA
    If you're going to use SCAR, why not use variables to track ammunition?

    This is how you would get slot items, though:

    Int SGroup_GetNumSlotItem( SGroupID group, Int itemID )
    Get the number of slot items with the same ID that the squads in the sgroup own
    Source: [WW2Data.sga/Scar/Groups.scar] (1915)
    ItemID is actually the SlotItemBlueprint.

    http://www.docs.frostbite.linkpc.net...c/scar_doc.htm

  12. #12
    I haven't tested yet but...

    How did we change the track source when we click on squad ?

    (for example,i click on rifleman squad and display his ammo info,and then i click the engineer squad.Can it display engineer ammo info ?)

  13. #13
    you can use the slot item "ui unit ratings" to count the number of slot items (of course you have to remove the weapons ratings first).

  14. #14
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    That would be fairly hard to spot at a glance. And then you couldn't display weapon ratings.

  15. #15
    Code:
    function Util_CreateLocString(text)
    	local tmpstr = LOC(text)
    	tmpstr[1] = text
    	return tmpstr
    end
    
    
    Rule_AddInterval(ammoindicator,1)
    
    function ammoindicator()
    	UI_SetDisplayIngameScore(true, false) 
    	local SGroupID = Util_AddMouseoverSquadToSGroup()
    	
    	if SGroupID == nil then 
    	
    	UI_SetScoreSingle(Util_CreateLocString("N/A"), Util_CreateLocString("N/A"))
    	
    	else
    	
    	local itemcount = SGroup_GetNumSlotItem( SGroupID, BP_GetSlotItemBlueprint("slot_item/generic_ammunition.lua") )
    	local itemowner = SGroup_GetName(SGroupID)
    	UI_SetScoreSingle(Util_CreateLocString(Loc_ConvertNumber(itemowner)), Util_CreateLocString(Loc_ConvertNumber(itemcount)))
        
    	end 
    
    end
    
    Scar_AddInit(ammoindicator)
    Now,I have get it showed on screen

    but I haven't knew how to update the SGroupID which the mouse input.

    I add a "Rule_AddInterval(ammoindicator,1)" , but it freeze in start without error message.

    Any ideas ?

  16. #16
    Member eliw00d's Avatar
    Join Date
    Jul 2008
    Location
    USA
    I would recommend these functions over the mouseover ones:

    Void Misc_GetSelectedEntities( EGroupID group, Boolean subSelection )
    Clears a given egroup and adds the current selection to the group
    Source: [DLL, from file /Cross/BIAModUI/LuaLibs/LuaUI.cpp] (1578)
    Void Misc_GetSelectedSquads( SGroupID group, Boolean subSelection )
    Clears a given sgroup and adds the current selection to the group
    Source: [DLL, from file /Cross/BIAModUI/LuaLibs/LuaUI.cpp] (1607)

  17. #17
    Code:
    function Util_CreateLocString(text)
    	local tmpstr = LOC(text)
    	tmpstr[1] = text
    	return tmpstr
    end
    
    
    function ammoindicator()
    
        UI_SetDisplayIngameScore(true, false) 
    	
    	local select = SGroup_Create("")
    	Misc_GetSelectedSquads(select, false)
    	local itemcount =SGroup_GetNumSlotItem(select , M870)
    	UI_SetScoreSingle(Util_CreateLocString("Ammo indicator"), Util_CreateLocString(itemcount))
    
    end
    
    Scar_AddInit(ammoindicator)
    I revise it to this

    So...uh...the UI didn't change its value dynamically...it always shows "0" ( itemcount )

    Even I change itemcount = Stats_TotalDuration() , it can't show game time also...

  18. #18
    Member eliw00d's Avatar
    Join Date
    Jul 2008
    Location
    USA
    That's because your function only runs once. I would suggest looking into how Rules work, which would allow you to have a function constantly running.

    Also, is M870 defined anywhere else? If not, that is also a problem.

  19. #19
    Thanks ! I succeed !

    Thanks your guidance !

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •