1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Lead your forces to battle in the 15th Techtree Contest. The call is yours, commander!
    Dismiss Notice
  4. The reforging of the races is complete. Come see the 14th Techtree Contest Results.
    Dismiss Notice
  5. It's time to choose your horse in the race - the 32nd Modeling Contest Poll is up!
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Excess Charges System

Discussion in 'World Editor Help Zone' started by Impereal Gardian, Feb 12, 2015.

  1. Impereal Gardian

    Impereal Gardian

    Joined:
    Dec 11, 2010
    Messages:
    100
    Resources:
    0
    Resources:
    0
    Okay, so ill try to explain what i need the best i can.

    Say that in slot 1, my gun has 7/7 charges left. When i reload, it will subtract 7 charges from item in slot 3. I got this working.

    My problem is that, if i go to reload even if I am only missing 1 bullet, it will still take away 7 charges.

    My Question is:
    Is there an Item Action that will subtract Item Charges from slot 3 equal to the number of missing charges from Slot 1?

    This is what I had originally, but i'm looking to make it so you dont "lose" excess charges from slot 1.
    • Reload Normal Guns
      • Events
        • Unit - A unit Finishes casting an ability
      • Conditions
        • ((Ability being cast) Equal to Reload [W] ) and (((Triggering unit) has buff Speed Cola ) Equal to False)
      • Actions
        • Unit - Remove Swap Weapons [Q] from (Triggering unit)
        • Unit - Remove Reload [W] from (Triggering unit)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Charges remaining in (Item carried by (Triggering unit) in slot 1)) Less than or equal to 6) and ((Item-type of (Item carried by (Triggering unit) in slot 1)) Equal to M1911)
          • Then - Actions
            • Floating Text - Create floating text that reads Reloading (1.90 sec... above (Triggering unit) with Z offset 0.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
            • Wait 1.90 seconds
            • Item - Set charges remaining in (Item carried by (Triggering unit) in slot 1) to 7
            • Item - Set charges remaining in (Item carried by (Triggering unit) in slot 3) to ((Charges remaining in (Item carried by (Triggering unit) in slot 3)) - 7)
            • Unit - Add Swap Weapons [Q] to (Triggering unit)
            • Unit - Add Reload [W] to (Triggering unit)
            • Floating Text - Destroy (Last created floating text)
          • Else - Actions

    If you need me to elaborate, ill try my best.
     
  2. Impereal Gardian

    Impereal Gardian

    Joined:
    Dec 11, 2010
    Messages:
    100
    Resources:
    0
    Resources:
    0
    • Reload Normal Guns Copy
      • Events
        • Unit - A unit Finishes casting an ability
      • Conditions
        • ((Ability being cast) Equal to Reload [W] ) and (((Triggering unit) has buff Speed Cola ) Equal to False)
      • Actions
        • Unit - Remove Swap Weapons [Q] from (Triggering unit)
        • Unit - Remove Reload [W] from (Triggering unit)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Charges remaining in (Item carried by (Triggering unit) in slot 1)) Less than or equal to 6) and ((Item-type of (Item carried by (Triggering unit) in slot 1)) Equal to M1911)
          • Then - Actions
            • Floating Text - Create floating text that reads Reloading (1.90 sec... above (Triggering unit) with Z offset 0.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
            • Floating Text - Change the lifespan of (Last created floating text) to 0.60 seconds
            • Floating Text - Destroy (Last created floating text)
            • Wait 1.90 seconds
            • Item - Set charges remaining in (Item carried by (Triggering unit) in slot 3) to ((Charges remaining in (Item carried by (Triggering unit) in slot 3)) + (Charges remaining in (Item carried by (Triggering unit) in slot 1)))
            • Item - Set charges remaining in (Item carried by (Triggering unit) in slot 3) to ((Charges remaining in (Item carried by (Triggering unit) in slot 3)) - 7)
            • Item - Set charges remaining in (Item carried by (Triggering unit) in slot 1) to 7
            • Unit - Add Swap Weapons [Q] to (Triggering unit)
            • Unit - Add Reload [W] to (Triggering unit)
          • Else - Actions
            • Unit - Add Swap Weapons [Q] to (Triggering unit)
            • Unit - Add Reload [W] to (Triggering unit)


    Nailed it. Dunno why i didn't try this first.
     
  3. maddeem

    maddeem

    Joined:
    Jan 1, 2011
    Messages:
    1,299
    Resources:
    5
    Maps:
    2
    Spells:
    3
    Resources:
    5
    The problem doesn't seem clear; however I'm glad you fixed it. But just a word of advice, don't use "waits" if at all possible. The only reason why this trigger even works is because you are using GetTriggerUnit() time after time. This style of GUI is redundant and GetTriggerUnit() should be stored into a variable, and instead of using waits you should use timers.

    Waits are not exact and the time it takes to resume the trigger variates highly based on everyone's MS.

    I'm not saying what you're doing is wrong, and it will by all means work for you; just remember if you have a problem with your trigger not working properly, check to see if there is a wait in there. Waits can screw up so much.
     
  4. Impereal Gardian

    Impereal Gardian

    Joined:
    Dec 11, 2010
    Messages:
    100
    Resources:
    0
    Resources:
    0
    The trigger worked for the most part, but I ran into another problem when I had 1 charge in slot 3, it would set the slot 1 item to 7 charges despite only havering 1. I solved this as well.

    The wait timers are my units "reloading" but still being able to move. Before I had added wait timers, I had cast times that my unit had to stay still while casting (which standing still in my map is not a good idea). I'm not the best with a good portion of the GUI, but for the most part I get things to work.