Results 1 to 42 of 42

[SEMI-SOLVED] Squad-Based Ammo System

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

    [SEMI-SOLVED] Squad-Based Ammo System

    Ammo mechanic is now working as intended... thanks to everyone who helped out!

    Only one problem remaining... I've been trying to colour-code various levels of ammo depletion. Tried slot items and decorators, but neither fits the bill.
    Last edited by I_am_a_Spoon; 12th Apr 12 at 9:54 PM.

  2. #2
    Can't you add slot_items with the On_Fire_Action? It should work as any other action
    The most dangerous distance away from a tank is 200 yards; the safest distance is six inches - Tom Wintringham, 1940

  3. #3
    Member eliw00d's Avatar
    Join Date
    Jul 2008
    Location
    Minnesota
    Why not try upgrades instead of slot_items?

  4. #4
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    Neither seems to work when using the on_fire action. I can get some actions to work, such as kicker messages, but nothing like slot_items or upgrades. Am I missing something?...

  5. #5
    If you apply upgrades through on_fire I'm quite sure they're ending up on the entity, not the squad, so you'll need to adjust your requirements accordingly.

  6. #6
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    I set the upgrade triggered by the on_fire action to launch a kicker message when successfully applied. In-game, nothing happens... so the upgrade isn't even being applied by the weapon.

    I've managed to actions such as received suppression (which affects the squad) and weapon_target_type changes to work, so it seems to me that the on_fire action just doesn't work with every type of action?

  7. #7
    Make sure the entity has an upgrade_ext, many don't. If it doesn't, copy it over from an entity that does. No upgrade_ext means can't receive upgrades.

  8. #8
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    EDIT: Ok, so the actual system works now, but I'm having a little trouble reversing the process when the squad replenishes their ammo.

    Long story short... what's the best way to remove up to 500 stacked slot_items simultaneously?

    Last edited by I_am_a_Spoon; 2nd Nov 11 at 12:44 PM.

  9. #9
    Member eliw00d's Avatar
    Join Date
    Jul 2008
    Location
    Minnesota
    The circumstances are different in Fortress Europe, as we remove the upgrades (not slot_items) with SCAR, but perhaps you could add a short delay action in the upgrade / slot_item that removes itself?

  10. #10
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    Well that's the thing, the removal can't be timed, it needs to be done manually by the player via an upgrade.

    How hard would it be to code using SCAR?

  11. #11
    Member eliw00d's Avatar
    Join Date
    Jul 2008
    Location
    Minnesota
    If you added an upgrade in the on_fire action instead of a slot_item, I am fairly confident that the upgrade could remove itself. I don't think it works with slot_items, though, as they are messier to work with. Just use upgrades, trust me. They are better.

    If you are dealing with a conventional approach to COH, as in base building and what not, it might be extremely difficult to setup, as you would have to detect every unit that is produced and then work magic on each one.

  12. #12
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    Nevermind, all working.

    Thanks for the help guys!

  13. #13
    Member eliw00d's Avatar
    Join Date
    Jul 2008
    Location
    Minnesota
    What did you end up doing to fix it?

  14. #14
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    2353 ability/upgrade actions.
    Last edited by I_am_a_Spoon; 13th Apr 12 at 7:37 AM.

  15. #15
    Member eliw00d's Avatar
    Join Date
    Jul 2008
    Location
    Minnesota
    O_O

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

  17. #17
    Member Jagdpanther's Avatar
    Join Date
    Dec 2008
    Location
    Berlin
    294 delayed_actions (three tiers), 2059 remove_slot upgrade_actions (4th tier).
    All this made by hand?

  18. #18
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    I just copy/pasted most of it.

    Only problem I have now are the UI decorators. I'm trying to get the squad's level of ammo indicated by a colour-coded icon on their squad tab, but I can't get the colour-changes working properly.

  19. Modding Senior Member Company of Heroes Senior Member  #19
    Cel├ęstial by heart Celution's Avatar
    Join Date
    Apr 2008
    Location
    Sweden
    Nice that you found a solution, but next time, try creating a macro for it.

  20. #20
    Moderator Darkbladecr's Avatar
    Join Date
    Nov 2005
    Location
    CoH:Modern Combat
    Only problem I have now are the UI decorators. I'm trying to get the squad's level of ammo indicated by a colour-coded icon on their squad tab, but I can't get the colour-changes working properly.
    Instead of a color-coded icon you can show the actual ammo count:
    Try this:
    http://forums.relicnews.com/showthre...L-Instructions
    Or this:
    http://forums.relicnews.com/showthre...splay-UI-Boxes

  21. #21
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    That's fairly complicated... I'm just trying to make a simple gameplay mechanism. It doesn't need to be that complex.

    The icons are colour-coded to mark the approximate percentage of ammo remaining, (green, yellow, orange, red, etc), and are accompanied by a kicker message when triggered. So a player knows he doesn't really need to worry about units with a green ammo icon, but might want to reconsider sending units with orange or red ammo indicators out to remote areas where they can't be resupplied, at least not without ammo carriers.

  22. #22
    Member Jagdpanther's Avatar
    Join Date
    Dec 2008
    Location
    Berlin
    Another idea could be is, to use the action "ui_decorator_action" in where you can change some textures (icons). Maybe you will need to create some special things to get it to work, like three exemplars of the same icon with three different state colors.

  23. #23
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    Had a look at the action you're talking about, but I have absolutely no idea how it works...

  24. #24
    Member Jagdpanther's Avatar
    Join Date
    Dec 2008
    Location
    Berlin
    Me too. After testing some things without any luck, I give up. It seems, this action is used nowhere, so we have no reference. ;(

  25. #25
    Quite sure it's used by the Lieutenant's command aura, to apply the stars underneath British troops when an officer is nearby.

    EDIT: And also by the command tank. It has some options for animating the images, which creates the radio pulse for the command tank decorator. Also an option to layer on the multiple stars when multiple lieutenants are within range. You'd probably want the later option, which would allow you to have three indicators for ammo. None = no decorator, Running Low = lvl1 decorator, Half = lvl2 decorator, Mostly full = lvl3 decorator.

  26. #26
    Member Jagdpanther's Avatar
    Join Date
    Dec 2008
    Location
    Berlin
    @sturm: nice find. The command tank uses indeed the "ui_decorator_action". Don't know, why the scan for this action fails. It's a good example.

    @spoon: check the ability "captain_force_multiplier_vet2" in "action_list/start_self_actions/action_01". As an idea you coud use a colored version of "units\cmnw_leader_badge_player_outline" instead of the used "units/cmnw_leader_badge_circular_outline". This could be act as the colored (state) background for your unit/squad. Create then for each state a new action with another background_icon.

    edit: some additional information. The values for animation_name and art_object_name must be filled or it wont work. These names you can find in "data\art\ui\animations\decorators.lua". There are all animations specified. You can't add a background color for the squad symbol this way (I have tried it), only an additional badge symbol (animated) is possible. Try whether you like it.
    Last edited by Jagdpanther; 11th Nov 11 at 6:47 AM.

  27. #27
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    Late reply guys... haha.



    I got some decorator actions working, but there were two problems:

    1) they disappeared when squads were garrisoned.
    2) they didn't show up on the taskbar.



    I also tried adding slot items instead, but their icons interfered with those of weapon upgrades and weren't being removed properly.

    Any other ideas? DB's suggestions are solid, but I haven't got anything like the technical know how I'd need...

  28. #28
    Member eliw00d's Avatar
    Join Date
    Jul 2008
    Location
    Minnesota
    I would suggest using SCAR. Also, upgrades are better than slot items because they won't interfere with anything. Just be sure to give each entity the "upgrade_ext", or they won't get them.

  29. #29
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    Upgrades that do what? Slot item icons and decorator actions aren't really the best options...

  30. #30
    Member eliw00d's Avatar
    Join Date
    Jul 2008
    Location
    Minnesota
    For your on_fire_actions. I don't really know what you have going on behind the scenes, but it sounds like you are over-complicating things quite a bit.

  31. #31
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    I have the actual ammo mechanic working perfectly. All I'm trying to do at this point is colour-code different ammo percentages for each squad on the UI.

  32. #32
    Member eliw00d's Avatar
    Join Date
    Jul 2008
    Location
    Minnesota
    Well, as I said, you will probably have to use SCAR. The UI extension would probably suit your needs perfectly.

  33. #33
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    ^ That's like telling a monkey to learn astrophysics. XD

    Unfortunately I have no experience with SCAR whatsoever... I'm limited to whatever I can manage in the mod studio.

  34. #34
    Moderator Darkbladecr's Avatar
    Join Date
    Nov 2005
    Location
    CoH:Modern Combat
    You can always learn
    I started to read up on some of it so at least I can understand it, however writing it from scratch is a challenge

  35. #35
    Member eliw00d's Avatar
    Join Date
    Jul 2008
    Location
    Minnesota
    Lua is one of the easier programming languages to learn, mostly because its syntax is very simplistic. I learned from scratch a few years ago!

  36. #36
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    So the general consensus is that it'd only be possible through SCAR?
    Keeping in mind that I wouldn't necessarily need a numerical counter? Something simpler would be fine.

    To be blunt... I'm not going to learn two entire scripting languages from scratch just to make an ammo counter. I don't have the time or capability. If it needs to be done through SCAR, I'll either need help or will have to revert to kicker messages and decorators, both of which have flaws.

  37. #37
    Member eliw00d's Avatar
    Join Date
    Jul 2008
    Location
    Minnesota
    Well, you are rather limited in what you can do with Mod Studio, as you can only use what Relic made. With SCAR, you can do a lot more. As far as I know, the UI decorators were not really made to stack on top of each other.

    What do you mean by two languages? SCAR is Lua.

  38. #38
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    My bad, thought they were different. I still don't have the time though, I'm a full-time student.



    I'm having another problem... when you upgrade a squad with a special weapon and the guy holding it dies, you won't get it back again when you reinforce. This only happens if the squad's expended some ammo though (as doing so adds slot items).

    I don't know how the exact mechanic behind this works, but the ammo item doesn't take up a slot, uses a different hardpoint to regular weapons, and under the "weapon" section I've put "default" instead of "squad". I don't know why this is happening... I can only assume that squadmembers are being allocated the ammo slot item instead of the weapon slot item when they spawn.

  39. #39
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    Can anyone help me with the problem in the post above?

  40. #40
    Member eliw00d's Avatar
    Join Date
    Jul 2008
    Location
    Minnesota
    Use upgrades instead of slot items.

  41. #41
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    But can upgrades be stacked in the same way as slot items?

  42. #42
    Member eliw00d's Avatar
    Join Date
    Jul 2008
    Location
    Minnesota
    Yup. Just be sure that the entities you are giving the upgrades to have an upgrade_ext to receive them. Also, I think there are some variables in the upgrades themselves you will have to tweak, like global and local limits.

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
  •