• 🏆 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!

Ias

Status
Not open for further replies.
Level 3
Joined
Mar 2, 2012
Messages
27
Do someone have the trigger of a skill wherein if a unit attacks it increases it's attackspeed. :vw_death:
 
Level 3
Joined
Mar 2, 2012
Messages
27
oh sorry for incompleteness but;
1.) yap there is, in every level it increases the limit amount;
2.) Whenever it attack other units it returns to its normal attack speed again;
3.) Gui or jass(just explain it thoroughly cus i am new to jass)
there it goes!
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Yap thanks! ill give +rep if you made it correctly ^_^


u can test this

the demo test map is half gui half jass but u dont must modify the jass :)

in demo map with each hit your attack speed increased by +25% (max stack is 250%)

if u want sheck there trigger that also here


demo map init - nothing interesting, we just preloaded the ability and make map visible
  • Map init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set PreLoadAbilityList[0] = Attack Speed (Gloves of Haste)
      • Set Point = (Random point in (Playable map area))
      • Unit - Create 1 Paladin for Player 1 (Red) at Point facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_Point)
      • Unit - Remove (Last created unit) from the game
      • Visibility - Disable fog of war
      • Visibility - Disable black mask
timer trigger

JASS:
function Trig_Timer_Actions takes nothing returns nothing
    local integer i = 1
    local integer cv

    set i = 1
    loop
      exitwhen i > udg_CombatIndex
           set cv = udg_CombatI2CV[i]
           set udg_CombatTimer[cv] = udg_CombatTimer[cv] - 1
           if udg_CombatTimer[cv] < 1 then
                   //here u can do something if timer is out
                  set udg_CombatTimer[cv] = 0
                  set udg_CombatCount[cv] = 0

                  if i != udg_CombatIndex then
                       set udg_CombatI2CV[i] = udg_CombatI2CV[udg_CombatIndex]
                       set udg_CombatTimer[udg_CombatI2CV[i]] = udg_CombatTimer[udg_CombatI2CV[udg_CombatIndex]]
                       set udg_CombatCount[i] = udg_CombatCount[udg_CombatIndex]
                  endif
                  set udg_CombatIndex = udg_CombatIndex - 1
                  set i = i - 1
           endif
      set i = i + 1
    endloop
endfunction

//===========================================================================
function InitTrig_Timer takes nothing returns nothing
    set gg_trg_Timer = CreateTrigger( )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Timer, 1.00 )
    call TriggerAddAction( gg_trg_Timer, function Trig_Timer_Actions )
endfunction

set damage trigger

  • Set Damage
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • DamageEventOverride Equal to False
    • Actions
      • Set PNR1 = (Player number of (Owner of DamageEventSource))
      • Set CV1 = (Custom value of DamageEventSource)
      • Floating Text - Create floating text that reads ((String((Integer(DamageEventAmount)))) + <Empty String>) above DamageEventTarget with Z offset 50.00, using font size 13.00, color (100.00%, 100.00%, 10.00%), and 0.00% transparency
      • Floating Text - Set the velocity of (Last created floating text) to 75.00 towards 90.00 degrees
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 3.50 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.40 seconds
      • -------- we add unit to combat timer if he isnt already there --------
      • -------- combat timer justa periodic trigger what decrease each second the CombatTimer[custom value of unit] by 1 --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of DamageEventSource) Equal to Sylvanas Windrunner
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CombatTimer[CV1] Less than 1
            • Then - Actions
              • Set CombatIndex = (CombatIndex + 1)
              • Set CombatI2CV[CombatIndex] = CV1
              • Set CombatCount[CV1] = 1
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of PreLoadAbilityList[0] for DamageEventSource) Equal to 0
                • Then - Actions
                  • Unit - Add PreLoadAbilityList[0] to DamageEventSource
                • Else - Actions
                  • Unit - Set level of PreLoadAbilityList[0] for DamageEventSource to 1
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CombatCount[CV1] Less than 10
                • Then - Actions
                  • Set CombatCount[CV1] = (CombatCount[CV1] + 1)
                  • Unit - Set level of PreLoadAbilityList[0] for DamageEventSource to CombatCount[CV1]
                • Else - Actions
          • Set CombatTimer[CV1] = 5
          • Game - Display to (All players) the text: (((Name of DamageEventSource) + attack speed increased by ) + ((String((CombatCount[CV1] x 25))) + % in last 5 second.))
        • Else - Actions

(ofc for this need the bridbe gui damage engine but that included on map)
 

Attachments

  • increased attack with hit.w3x
    30.7 KB · Views: 28
Level 3
Joined
Mar 2, 2012
Messages
27
the timeout sytem in your trigger is that it last 5 seconds could you please change the timeout system for the attack speed to whenever it attacks other unit or it stop.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
the timeout sytem in your trigger is that it last 5 seconds could you please change the timeout system for the attack speed to whenever it attacks other unit or it stop.

done, and duration or max stack u can change (but if u want higher than 10 then u also must make more level to attackspeed ability in object editor :p) in map init

  • Map init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set PreLoadAbilityList[0] = Attack Speed (Gloves of Haste)
      • Set Point = (Random point in (Playable map area))
      • Unit - Create 1 Paladin for Player 1 (Red) at Point facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_Point)
      • Unit - Remove (Last created unit) from the game
      • Visibility - Disable fog of war
      • Visibility - Disable black mask
      • -------- -------- -------- -------- settings -------- -------- -------- --------
      • Set IASMaxStack = 10
      • Set IASDuration = 5
      • -------- more hp to archer, else she die too fast and u cant see enough well the ias --------
      • -------- so this is only for test, u can remove it if u want --------
      • Player - Set Player 1 (Red) handicap to 10000.00%
 

Attachments

  • increased attack with hit1.w3x
    31.2 KB · Views: 27
Level 9
Joined
Apr 23, 2011
Messages
460
Here are some changes to shadow's code.

JASS:
function Trig_Timer_Actions takes nothing returns nothing
    local integer i = 1
    local integer cV //try to follow Bribe's JPAG on naming variables. first letter of first word is always lowercase.
    //after that all first letters are uppercase, makes it more readable.
    
    set i = 1
    loop
           set cV = udg_CombatI2CV[i]
           set udg_CombatTimer[cV] = udg_CombatTimer[cV] - 1
           if udg_CombatTimer[cV] < 1 then
                   //here u can do something if timer is out
                  set udg_CombatTimer[cV] = 0
                  set udg_CombatCount[cV] = 0

                  if i != udg_CombatIndex then
                       set udg_CombatI2CV[i] = udg_CombatI2CV[udg_CombatIndex]
                       set udg_CombatTimer[udg_CombatI2CV[i]] = udg_CombatTimer[udg_CombatI2CV[udg_CombatIndex]]
                       set udg_CombatCount[i] = udg_CombatCount[udg_CombatIndex]
                  endif
                  set udg_CombatIndex = udg_CombatIndex - 1
                  set i = i - 1
           endif
      set i = i + 1
      exitwhen i > udg_CombatIndex //Moved exitwhen to end to make the loop end-point intuitive.
    endloop
endfunction

//===========================================================================
function InitTrig_Timer takes nothing returns nothing
    local trigger t = CreateTrigger() //Locals are your friend.
    call TriggerRegisterTimerEvent(t, 1.00, true ) // Don't use TriggerRegisterTimerEventPeriodic as this will just
    // call this function anyways.
    call TriggerAddAction( t, function Trig_Timer_Actions )
    set t = null //null your trigger when you're done with it so it won't allocate memory.
endfunction

There are some other functions in the MapInit and in your damage trigger that I don't see a reason for, but I only glanced over it for now ; ). I'll probably rewrite it later to make it more efficient, like converting all GUI globals to jass globals. I don't like the integration of regular variables and udg_VARIABLE variables, but that's just a preference.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Here are some changes to shadow's code.

There are some other functions in the MapInit and in your damage trigger that I don't see a reason for, but I only glanced over it for now ; ). I'll probably rewrite it later to make it more efficient, like converting all GUI globals to jass globals. I don't like the integration of regular variables and udg_VARIABLE variables, but that's just a preference.

ok let me notice that, this is NOT vjass, so dont have global exclude gui globals, i dont like the vjass and gui mix :p
 
Level 9
Joined
Apr 23, 2011
Messages
460
ok let me notice that, this is NOT vjass, so dont have global exclude gui globals, i dont like the vjass and gui mix :p

Well yeah :p I just do not like the whole udg_ thing. Ever since i got into jass and vJass, its always been a pain to have WE defined globals, which is why I like using my own globals in my maps so i can easily find them. But it's entirely preference. Your script works and it works pretty well, but using jass or vJass could eliminate BJ function calls and make the work a lot cleaner. Just look at Bribe's systems. He used GUI for beginners to understand, yet he used tons of Custom Script, otherwise it wouldn't be optimized. This is all just in the sake of an optimum map, considering we don't know anything about what he is using this system for, he might want to save a lot of memory due to the size of his map, thus the need for an efficient and optimal system arises.
 
Status
Not open for further replies.
Top