Page 1 of 2 12 LastLast
Results 1 to 50 of 65

[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
    Duluth, MN
    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
    Duluth, MN
    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
    Duluth, MN
    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
    Duluth, MN
    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
    Duluth, MN
    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
    Duluth, MN
    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
    Duluth, MN
    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
    Duluth, MN
    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
    Duluth, MN
    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
    Duluth, MN
    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
    Duluth, MN
    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
    Duluth, MN
    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.

  43. #43
    Sorry to revive this post but I have a problem related to what was discussed here.

    How do I add an upgrade to a unit (entity) via "on_fire _action"?

    I have gave to a tank an ability to display a "kicker message" when received the upgrade (this is just to check if the tank receives the upgrade or not). In the tank's "on_fire_action" I have:
    Code:
    action_02 = requirement_action:
    action_table -> upgrade_actions -> action_01 -> upgrade_add (apply_to_entities_in_squad = true; trigger_publish_event = false (what does this do?); upgrade = upgrade\ap_shot_fired.lua)
    chec_self = false
    global_fire_and_forget_on_success = false
    kill_action_on_failed_requirements = false
    no_retrigger = false
    requirement_table = (all are required_none)
    Yet when the weapon fires, upgrade is not added to the unit...
    The upgrade itself is set:
    Code:
    actions = (all are "no_action")
    ai_info = (all set to "0")
    commander_required_upgrades = (all blank)
    enable_in_hold = true
    global_max_limit = 0
    has_speech_code = false
    local_max_limit = 2
    owner_type = self
    requirements = (all are required_none)
    speech_codes are both blak
    tech_tree = *blank*
    tech_tree_column = -1
    tech_tree_tier = -1
    time_cost = (all set to "0")
    ui_event_cue = true
    ui_flash = false
    ui_group = command_pannel
    ui_group_position = 0
    ui_info = (all "0" or blank)
    ui_titlecard = false
    validate_actions = false
    The kicker message requirement is set to "required_entity_upgrade" and the tank has "upgrade_ext"...

    So has anybody managed to add an upgrade to an entity via on_fire_action?

  44. #44
    Member I_am_a_Spoon's Avatar
    Join Date
    Jan 2010
    Location
    Western Australia
    Christ, 2011.... way to make me feel old. Four years and I never even implemented my ammo system. :P

    I personally found that slot_items were more easy to work with (as long as you're attempting a squad-level system).

  45. #45
    Member eliw00d's Avatar
    Join Date
    Jul 2008
    Location
    Duluth, MN
    It needs to be an ability_action, not an upgrade_action.

    Also, requirement_actions will not work, so you will simply have to add the upgrade.

    Entity upgrades work best, as long as the entity has an upgrade_ext. But, it looks like you already have that covered.

  46. #46
    It needs to be an ability_action, not an upgrade_action.

    Also, requirement_actions will not work, so you will simply have to add the upgrade.
    I was also curious about this too - the "on_fire_actions" is an "ability_action_table" - so is it ok to put there directly an upgrade_action (or critical_action)? I always thought that upgrade_actions need to be placed in upgrade_action_table and so on, so I've always used requirement_action with empty requirements to put actions into corresponding tables...

    And thanks for the answer eliw00d
    Last edited by MyldnerF; 10th Jun 15 at 1:45 AM.

  47. #47
    Member Jagdpanther's Avatar
    Join Date
    Dec 2008
    Location
    Berlin
    so I've always used requirement_action with empty requirements to put actions into corresponding tables
    This should normally be the correct way to use upgrade_actions into a table where only ability_actions are available, but only as long if this requirement_action is an "ability_action/requirement_action".

    But you don't need it in this case, cause there also exists an "ability_action/upgrade_add".

  48. #48
    OK thanks

    But you don't need it in this case, cause there also exists an "ability_action/upgrade_add".
    yeah I noticed that too but I also noticed that the "upgrade_add" ability action differs from the upgrade action - ability action has only "upgrade" entry where you set the path to the upgrade, while upgrade action has also "apply_to_entities_in_squad" and "trigger_publish_event".

    Do they need to stay this way or can I mix these "paramaters" (or what are they correctly called)? When I say "they differ" I mean that in vCoH Attrib.sga file there are all the actions, requirements etc. listed with their paramateres so if it is possible to add another one without breaking something. I mean "required_squad_upgrade" has no "min/max completed" in the vCoH file yet it can be used to check stacked upgrades...

  49. #49
    Member Jagdpanther's Avatar
    Join Date
    Dec 2008
    Location
    Berlin
    Do they need to stay this way or can I mix these "paramaters"
    You can use the parameters only "as is". That's because the referenced file "ability_action/upgrade_add.lua" defines it in this layout. I don't think that changing it, does have any affect than only being ignored or causing errors. You'll need to test it out, if it can work with a changed layout or not. It should be very depending of what is hardcoded and what not. So it's more or less a field of trial and error.

    Most of those parameters are simply absent, because they do make no sense in this context.

    I also have changed several of those definition files without getting problems, but I also wasn't trying to add parameters they don't exist in the "template" except for some mod-tool usage (eg. macros).

  50. #50
    OK thanks again

    BTW: Do you have any idea why an upgrade added in this way (on_fire_action) would not stack? I gave a kicker message to a tank every time it receives an upgrade that is given to it via on_fire_action. On the first shot it shows the message but after the shot it does not do that anymore...
    In the tank's "upgrade_ext" I set the number of slots to 4 the upgrade itself has "local_max_limit" set to 4 too however the message doesn't show anymore after the first shot :/
    Or maybe the upgrade action can be set to be applied to entity but the ability action doesn't have it...so is it possible that the ability action applies on squad? Though Sturmhaubitze wrote he was pretty sure the upgrades added this way end up on entity...but then even the first kicker message wouldn't work...I'm confused right now

Page 1 of 2 12 LastLast

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
  •