System Stamina and Combat System

D.V.D

Make a wish
Reaction score
73
Stamina and Combat System

This system uses attributes and the stamina of the user to deal damage. The damage is dealt like in Dark Invasion ORPG( it inspired me to do this) by pressing buttons. Now the spell has a cooldown which is about 0.25 seconds and when you attack with the stamina below 10, you deal no damage. Now the math behind the damage:
Code:
Agility / 3
Strength / 3
Intelligence / 3
Agility + Intelligence + Strength = Damage
Damage times Stamina
Damage / 3

Code:
Initialization
    Events
        Map initialization
    Conditions
    Actions
        Set Stamina = 0
        Melee Game - Run melee AI scripts (for computer players)
        Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) is A Hero) Equal to True
                    Then - Actions
                        Set Attacker = (Picked unit)
                    Else - Actions

Code:
Attack
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Attack 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Stamina Less than or equal to 10
            Then - Actions
                Set Stamina = 0
                Set Stamina2 = Stamina
                Skip remaining actions
            Else - Actions
        Set Angle = (Facing of Attacker)
        Set MultiPoint[0] = (Position of Attacker)
        Set MultiPoint[1] = (MultiPoint[0] offset by 101.00 towards Angle degrees)
        Set UnitGroup = (Units within 100.00 of MultiPoint[1])
        Set Damage = (Damage x Stamina2)
        Set Damage = (Damage / 3)
        Floating Text - Create floating text that reads (String(Damage)) above Attacker with Z offset 0.00, using font size 11.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
        Set Text = (Last created floating text)
        Floating Text - Change Text: Disable permanence
        Floating Text - Change the lifespan of Text to 1.00 seconds
        Floating Text - Change the fading age of Text to 1.00 seconds
        Unit Group - Pick every unit in UnitGroup and do (Actions)
            Loop - Actions
                Unit - Cause Attacker to damage (Picked unit), dealing (Real(Damage)) damage of attack type Normal and damage type Normal
        Set Damage = 0
        Set Stamina = 0
        Set Stamina2 = 0
        Custom script:   call RemoveLocation(udg_MultiPoint[0])
        Custom script:   call RemoveLocation(udg_MultiPoint[1])
        Custom script:   call DestroyGroup(udg_UnitGroup)

Code:
Stamina
    Events
        Time - Every 0.03 seconds of game time
    Conditions
        (Attacker is alive) Equal to True
    Actions
        Set UnitGroup = (Units in (Playable map area))
        Unit Group - Pick every unit in UnitGroup and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Picked unit) Equal to Attacker
                    Then - Actions
                        Set Agility = (Agility of Attacker (Include bonuses))
                        Set Intelligence = (Intelligence of Attacker (Include bonuses))
                        Set Strength = (Strength of Attacker (Include bonuses))
                        Set Agility = (Agility / 3)
                        Set Intelligence = (Intelligence / 3)
                        Set Strength = (Strength / 3)
                        Set Damage = (Agility + (Intelligence + Strength))
                    Else - Actions
        Custom script:   call DestroyGroup(udg_UnitGroup)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Stamina Less than 100
            Then - Actions
                Set Stamina2 = Stamina
                Set Stamina = (Stamina + 1)
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Stamina Equal to 100
            Then - Actions
                Set Stamina = 100
                Set Stamina2 = Stamina
            Else - Actions
        Set UnitGroup = (Units in (Playable map area) matching ((((Matching unit) is alive) Equal to True) and (((Max mana of (Matching unit)) Greater than 0.50) and (((Matching unit) is A Hero) Equal to True))))
        Unit Group - Pick every unit in UnitGroup and do (Actions)
            Loop - Actions
                Set String = <Empty String>
                Set Stamina2 = (Integer(((Real(Stamina2)) / 2.00)))
                For each (Integer A) from 1 to 50, do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                Stamina2 Greater than or equal to (Integer A)
                            Then - Actions
                                Set String = (String + |cff660066'|r)
                            Else - Actions
                                Set String = (String + ')
                Set p[1] = (Position of (Picked unit))
                Set p[2] = (p[1] offset by (-75.00, 0.00))
                Floating Text - Create floating text that reads String at p[2] with Z offset 210.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                Set pg = (All enemies of (Owner of (Picked unit)))
                Floating Text - Hide (Last created floating text) for pg
                Floating Text - Change (Last created floating text): Disable permanence
                Floating Text - Change the lifespan of (Last created floating text) to 0.06 seconds
                Custom script:   call DestroyGroup(udg_UnitGroup)
                Custom script:   call DestroyForce(udg_pg)
                Custom script:   call RemoveLocation(udg_p[1])
                Custom script:   call RemoveLocation(udg_p[2])

Special Thanks to:
Dark Beer for helping remove a leak and adding 4 trigger into 1,
Dark Invasion ORPG for inspiring me to do this,
Sirroelivan for making the floating mana bar trigger used to show the stamina.


Screenshots:
untitled-19.jpg

untitled-18.jpg


How to Import: Copy all the triggers and variables
Copy the spell Attack
Create your hero's with no damage at all or attack and add them the attack spell.

Have fun:).
 

Attachments

  • Combat System.w3x
    17.1 KB · Views: 195

Charapanga

New Member
Reaction score
46
Nicely done, but is it MUI?
Trigger 1 (All units in (Playable map area)) leaks...

And i dont understand a word of your math...
 

D.V.D

Make a wish
Reaction score
73
Thanks, I'll remove the leak. I don't know how much simpilar I can make it. States / 3 x Stamina / 2.
 

GooS

Azrael
Reaction score
154
Agility / 3
Strength / 3
Intelligence / 3
Agility + Intelligence + Strength = Damage
Damage times Stamina
Damage / 3

I'm guessing what's going on here is

Code:
dmg = ((int / 3 + str/3 + agi/3) * stamina) / 3

or in the long way:

Code:
Agility = Agility / 3
Strength = Strength / 3
Intelligence = Intelligence / 3
Agility + Intelligence + Strength = Damage
Damage = Damage * Stamina
Damage = Damage / 3
Is it how you meant? o_O

Anyways neat thing, I'm thinking of using a likewise system in my map :)
 

D.V.D

Make a wish
Reaction score
73
Yea, that's how it works. Thanks for the comment. Im working on a MUI version.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top