• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Custom Battle System

Status
Not open for further replies.
Level 9
Joined
Jul 24, 2007
Messages
308
how to make a custom battle system like that when player presses "A or a hotkey" the hero attacks infront of him, and when he press "D or a hotkey" he defend with a move or something, and ofcourse damage dealt is hero damage, and damaged reduced on armor damage reduction.. where can i find such a system/how to make 1?
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
1. You would need to use the arrows (located in Events -> Player -> Keyboard Event), and use 100% triggers.

2. You would need to use skills with those key shortcuts you want, and its still 100% triggers :p

For example
  • Unknown
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Attack
    • Actions
      • Animation - Play (Triggering unit)'s attack animation
      • Set Point[0] = (Position of (Triggering unit))
      • Set Point[1] = (Point[0] offset by 70.00 towards (Facing of (Triggering unit)) degrees)
      • Unit - Cause (Triggering unit) to damage circular area after 0.00 seconds of radius 80.00 at Point[1], dealing 100.00 damage of attack type Spells and damage type Normal
      • Custom script: call RemoveLocation(udg_Point[0])
      • Custom script: call RemoveLocation(udg_Point[1])

You would need to make some damage system since you can't check whats the unit's damage.
 
Level 3
Joined
Dec 18, 2007
Messages
43
Try this:
Add these functions to begging of the map
JASS:
function defend takes nothing returns nothing
    local unit u
    local real r = *Your percent of dmg reduction*
    set u = GetTriggerUnit()
    call SetUnitLifeBJ( u, ( GetUnitStateSwap(UNIT_STATE_LIFE, u) + ( (r/100) * GetEventDamage() ) ) )
    set u = null
endfunction

JASS:
function create_trigger takes unit u returns nothing
   local integer i = udg_Int + 1
   set udg_Int = i
   set udg_Trig[i] = CreateTrigger(  )
   call TriggerRegisterUnitEvent( udg_Trig[i], u, EVENT_UNIT_DAMAGED )
   call TriggerAddAction( udg_Trig[i], function defend )
   call PolledWait(*your time of defend ability*)
   call DestroyTrigger(udg_Trig[i])
   set udg_Int = udg_Int - 1
endfunction

Then create this trigger
  • Defend
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to defend
    • Actions
      • Custom script: call create_trigger(GetTriggerUnit())
Global Variables:
Int - integer
Trig - trigger(array)
 
Status
Not open for further replies.
Top