y wont this work??

G

gonecase

Guest
Code:
function Dummy_Unit takes nothing returns integer
  return 'e000'
endfunction

// ----------------- Shining Ogremace --------------------

function Shining_Ogremace_Abi takes nothing returns integer
  return 'A007'
endfunction

function Shining_Ogremace_Debuff_Abi takes nothing returns integer
  return 'A002'
endfunction

function Shining_Ogremace_Mana_Cost takes nothing returns integer
  return 15
endfunction

function Shining_Ogremace_Damage takes integer l returns real
  return 4.*l
endfunction

function Shining_Ogremace_Cooldown takes integer l returns real
  return 3.5 - 0.5*l 
endfunction

//===========================================================
// Shining Ogremace
//===========================================================

function shining_ogremace_learned_cond takes nothing returns boolean
  return GetLearnedSkill() == Shining_Ogremace_Abi()
endfunction

function shining_ogremace_cond takes nothing returns boolean
  return GetSpellAbilityId() == Shining_Ogremace_Abi()
endfunction

function shining_ogremace_add_debuff takes unit c, unit v returns nothing
  local unit u = CreateUnitAtLoc(GetOwningPlayer(c), Dummy_Unit(), GetUnitLoc(c), 0.) 
  local integer l = GetUnitAbilityLevel(c,Shining_Ogremace_Abi()) 
  
  call UnitDamageTarget(c,v,Shining_Ogremace_Damage(l),true,false, ATTACK_TYPE_HERO, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS)  
  call IssueTargetOrder(v, "attack", c)
  call UnitAddAbility(u, Shining_Ogremace_Debuff_Abi())
  call SetUnitAbilityLevel(u, Shining_Ogremace_Debuff_Abi(), l)
  call IssueTargetOrder(u, "acidbomb", v)
  call UnitApplyTimedLife(u, 'BTFL', 0.6)
  
  set u = null
endfunction

function shining_ogremace_action takes nothing returns nothing
  local unit c = GetTriggerUnit()
  local unit v = GetSpellTargetUnit()

  call shining_ogremace_add_debuff(c,v)

  set v = null
  set c = null
endfunction

function shining_ogremace_autocast_action takes nothing returns nothing
  local trigger t = null
  if GetIssuedOrderId() == 852255 then //flamingarrows turn on autocast
    set t = GetHandleTrigger(GetTriggeringTrigger(), "t")
    call EnableTrigger(t)
    call EnableTrigger(GetHandleTrigger(GetTriggeringTrigger(), "f"))
    if GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA) >= Shining_Ogremace_Mana_Cost() then
      call SetHandleBoolean(t, "b", true)
    endif
    set t = null 
    //call DebugMsg("Shining Ogremace Autocast On")
  endif
  if GetIssuedOrderId() == 852256 then //flamingarrows turn off autocast
    call DisableTrigger(GetHandleTrigger(GetTriggeringTrigger(), "t"))
    call DisableTrigger(GetHandleTrigger(GetTriggeringTrigger(), "f"))
    //call DebugMsg("Shining Ogremace Autocast Off")
  endif    
endfunction

function shining_ogremace_cooldown_timer takes nothing returns nothing
  local trigger t = GetHandleTrigger(GetExpiredTimer(), "t")
  //call DebugMsg("Cooldown Over")
  call SetHandleHandle(t, "p", null)
  call FlushHandleLocals(GetExpiredTimer())
  call DestroyTimer(GetExpiredTimer())
  set t = null
endfunction

function auto_casted_shining_ogremace_action takes nothing returns nothing
  local trigger t = GetTriggeringTrigger()
  local unit c = GetHandleUnit(t, "c")
  local unit v = GetTriggerUnit()
  local integer l = GetUnitAbilityLevel(c, Shining_Ogremace_Abi())
  local boolean b = GetHandleBoolean(t, "b")
  local boolean m 
  local timer p = GetHandleTimer(t, "p")
  
  if GetAttacker() == c and p == null and IsUnitEnemy(v, GetOwningPlayer(c)) and not(IsUnitType(v, UNIT_TYPE_STRUCTURE)) and not(IsUnitType(v, UNIT_TYPE_MAGIC_IMMUNE)) then
    set m = GetUnitState(c, UNIT_STATE_MANA) >= Shining_Ogremace_Mana_Cost()
    if b or m then
      call shining_ogremace_add_debuff(c,v) 
    
      if not(m) then
        call SetHandleBoolean(t, "b", false)
      endif  
    
      set p = CreateTimer()
      call SetHandleHandle(t, "p", p)
      call SetHandleHandle(p, "t", t)
      call TimerStart(p, Shining_Ogremace_Cooldown(l), false, function shining_ogremace_cooldown_timer)
    
      set p = null
    endif  
  endif
  
  set t = null
  set v = null
  set c = null
endfunction

function shining_ogremace_autocast_has_mana takes nothing returns nothing
  local trigger t = GetHandleTrigger(GetTriggeringTrigger(), "t")
  //call DebugMsg("Tgrale has mana again")
  call SetHandleBoolean(t, "b", true)
  set t = null
endfunction  

function InitTrig_shining_ogremace takes nothing returns nothing
  local trigger t = CreateTrigger()
  local trigger p = CreateTrigger()
  local trigger k = CreateTrigger()
  local trigger f = CreateTrigger()
  local trigger r = CreateTrigger()
  
  call TriggerRegisterUnitEvent(t, GetTriggerUnit(), EVENT_UNIT_SPELL_EFFECT)
  call TriggerAddCondition(t, Condition(function shining_ogremace_cond))
  call TriggerAddAction(t, function shining_ogremace_action)
  
  //used for auto-cast shining ogremace
  call TriggerRegisterAnyUnitEventBJ(r, EVENT_PLAYER_UNIT_ATTACKED)
  call TriggerAddAction(r, function auto_casted_shining_ogremace_action)
  call SetHandleHandle(r, "c", GetTriggerUnit())
  call SetHandleBoolean(r, "b", GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA) >= Shining_Ogremace_Mana_Cost())
  call SetHandleHandle(r, "k", k)
  call DisableTrigger(r)
  
  call TriggerRegisterUnitManaEvent(f, GetTriggerUnit(), GREATER_THAN, Shining_Ogremace_Mana_Cost() )
  call TriggerAddAction(f, function shining_ogremace_autocast_has_mana)
  call SetHandleHandle(f, "t", t)
  
  call TriggerRegisterUnitEvent(k, GetTriggerUnit(), EVENT_UNIT_ISSUED_ORDER)
  call TriggerAddAction(k, function shining_ogremace_autocast_action)  
  call SetHandleHandle(k, "t", r)
  call SetHandleHandle(k, "f", f)
  
  call DestroyTrigger(GetTriggeringTrigger())
  set t = null 
  set p = null
endfunction

this is suppose to reduce armor n slow the unit when attack or auto casted
 

Steel

Software Engineer
Reaction score
109
It might be your line:
Code:
  local unit u = CreateUnitAtLoc(GetOwningPlayer(c), Dummy_Unit(), GetUnitLoc(c), 0.)

I've noticed problems myself sometimes when creating a unit on a local initilization.
 

Cilla

is watching you! Ahh, fresh meat!
Reaction score
39
Code:
function Dummy_Unit takes nothing returns integer
  return 'e000'
endfunction

// ----------------- Shining Ogremace --------------------

function Shining_Ogremace_Abi takes nothing returns integer
  return 'A007'
endfunction

function Shining_Ogremace_Debuff_Abi takes nothing returns integer
  return 'A002'
endfunction[/QUOTE]

I just had a glimpse on this trigger but i think you cannot return A002 or somethin which is no Integer
 

Steel

Software Engineer
Reaction score
109
No those 'A###' refer to the raw code for the spell, thats just fine.

Also if you could COMMENT those triggers that would be nice. Its hard to follow your handles because they lack detailed names.
 
N

no0by

Guest
If I'm not wrong this looks like the InitTrig part:
Code:
function InitTrig_shining_ogremace takes nothing returns nothing
  local trigger t = CreateTrigger()
  local trigger p = CreateTrigger()
  local trigger k = CreateTrigger()
  local trigger f = CreateTrigger()
  local trigger r = CreateTrigger()
  
  call TriggerRegisterUnitEvent(t, [COLOR="red"]GetTriggerUnit()[/COLOR], EVENT_UNIT_SPELL_EFFECT)
  call TriggerAddCondition(t, Condition(function shining_ogremace_cond))
  call TriggerAddAction(t, function shining_ogremace_action)
  
  //used for auto-cast shining ogremace
  call TriggerRegisterAnyUnitEventBJ(r, EVENT_PLAYER_UNIT_ATTACKED)
  call TriggerAddAction(r, function auto_casted_shining_ogremace_action)
  call SetHandleHandle(r, "c", [COLOR="Red"]GetTriggerUnit())[/COLOR]
  call SetHandleBoolean(r, "b", GetUnitState([COLOR="red"]GetTriggerUnit()[/COLOR], UNIT_STATE_MANA) >= Shining_Ogremace_Mana_Cost())
  call SetHandleHandle(r, "k", k)
  call DisableTrigger(r)
  
  call TriggerRegisterUnitManaEvent(f, [COLOR="red"]GetTriggerUnit()[/COLOR], GREATER_THAN, Shining_Ogremace_Mana_Cost() )
  call TriggerAddAction(f, function shining_ogremace_autocast_has_mana)
  call SetHandleHandle(f, "t", t)
  
  call TriggerRegisterUnitEvent(k, [COLOR="red"]GetTriggerUnit()[/COLOR], EVENT_UNIT_ISSUED_ORDER)
  call TriggerAddAction(k, function shining_ogremace_autocast_action)  
  call SetHandleHandle(k, "t", r)
  call SetHandleHandle(k, "f", f)
  
  [COLOR="red"]call DestroyTrigger(GetTriggeringTrigger())[/COLOR]
  set t = null 
  set p = null
endfunction

Therefore none of the red parts should work.

(the InitTrig part is for warcraft 3 to 'build' the trigger and doesn't get any event responces e.g. GetTriggeringUnit(), GetTriggeringPlayer(), ect)

Edit:
Code:
function shining_ogremace_learn_cond takes nothing returns boolean
    return GetLearnedSkill()==Shining_Ogremace_Abi()
endfunction

function shining_ogremace_learn_action takes nothing returns nothing
  local trigger t = CreateTrigger()
  local trigger p = CreateTrigger()
  local trigger k = CreateTrigger()
  local trigger f = CreateTrigger()
  local trigger r = CreateTrigger()
  
  call TriggerRegisterUnitEvent(t, GetTriggerUnit(), EVENT_UNIT_SPELL_EFFECT)
  call TriggerAddCondition(t, Condition(function shining_ogremace_cond))
  call TriggerAddAction(t, function shining_ogremace_action)
  
  //used for auto-cast shining ogremace
  call TriggerRegisterAnyUnitEventBJ(r, EVENT_PLAYER_UNIT_ATTACKED)
  call TriggerAddAction(r, function auto_casted_shining_ogremace_action)
  call SetHandleHandle(r, "c", GetTriggerUnit())
  call SetHandleBoolean(r, "b", GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA) >= Shining_Ogremace_Mana_Cost())
  call SetHandleHandle(r, "k", k)
  call DisableTrigger(r)
  
  call TriggerRegisterUnitManaEvent(f, GetTriggerUnit(), GREATER_THAN, Shining_Ogremace_Mana_Cost() )
  call TriggerAddAction(f, function shining_ogremace_autocast_has_mana)
  call SetHandleHandle(f, "t", t)
  
  call TriggerRegisterUnitEvent(k, GetTriggerUnit(), EVENT_UNIT_ISSUED_ORDER)
  call TriggerAddAction(k, function shining_ogremace_autocast_action)  
  call SetHandleHandle(k, "t", r)
  call SetHandleHandle(k, "f", f)
  
  //call DestroyTrigger(GetTriggeringTrigger())
  set t = null 
  set p = null
endfunction

function InitTrig_shining_ogremace takes nothing returns nothing
    local trigger trig=CreateTrigger()
    local integer i=0
    
    loop
        exitwhen i>bj_MAX_PLAYERS
        call TriggerRegisterPlayerUnitEvent(trig,Player(i),EVENT_UNIT_HERO_SKILL,null)
        set i=i+1
    endloop
    call TriggerAddCondition(trig,Condition(function shining_ogremace_learn_cond))
    call TriggerAddAction(trig,function shining_ogremace_learn_action)
    set trig=null
endfunction

This should work I havent tested it
 
G

gonecase

Guest
Code:
set i=i+1 >>> Error

Code:
function Ogrelord takes nothing returns integer
  return 'H000'
endfunction

function Dummy_Unit takes nothing returns integer
  return 'e000'
endfunction

function Shining_Ogremace_Abi takes nothing returns integer
  return 'A007'
endfunction

function Shining_Ogremace_Debuff_Abi takes nothing returns integer
  return 'A002'
endfunction

function Shining_Ogremace_Mana_Cost takes nothing returns integer
  return 15
endfunction

function Shining_Ogremace_Damage takes integer l returns real
  return 4.*l
endfunction

function Shining_Ogremace_Cooldown takes integer l returns real
  return 3.5 - 0.5*l 
endfunction

function shining_ogremace_learned_cond takes nothing returns boolean
  return GetLearnedSkill() == Shining_Ogremace_Abi()
endfunction

function shining_ogremace_cond takes nothing returns boolean
  return GetSpellAbilityId() == Shining_Ogremace_Abi()
endfunction

function shining_ogremace_add_debuff takes unit c, unit v returns nothing
  local unit u = CreateUnitAtLoc(GetOwningPlayer(c), Dummy_Unit(), GetUnitLoc(c), 0.) 
  local integer l = GetUnitAbilityLevel(c,Shining_Ogremace_Abi()) 
  
  call UnitDamageTarget(c,v,Shining_Ogremace_Damage(l),true,false, ATTACK_TYPE_HERO, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS)  
  call IssueTargetOrder(v, "attack", c)
  call UnitAddAbility(u, Shining_Ogremace_Debuff_Abi())
  call SetUnitAbilityLevel(u, Shining_Ogremace_Debuff_Abi(), l)
  call IssueTargetOrder(u, "acidbomb", v)
  call UnitApplyTimedLife(u, 'BTFL', 0.6)
  
  set u = null
endfunction

function shining_ogremace_action takes nothing returns nothing
  local unit c = GetTriggerUnit()
  local unit v = GetSpellTargetUnit()

  call shining_ogremace_add_debuff(c,v)

  set v = null
  set c = null
endfunction

function shining_ogremace_autocast_action takes nothing returns nothing
  local trigger t = null
  if GetIssuedOrderId() == 852255 then //flamingarrows turn on autocast
    set t = GetHandleTrigger(GetTriggeringTrigger(), "t")
    call EnableTrigger(t)
    call EnableTrigger(GetHandleTrigger(GetTriggeringTrigger(), "f"))
    if GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA) >= Shining_Ogremace_Mana_Cost() then
      call SetHandleBoolean(t, "b", true)
    endif
    set t = null 
    //call DebugMsg("Shining Ogremace Autocast On")
  endif
  if GetIssuedOrderId() == 852256 then //flamingarrows turn off autocast
    call DisableTrigger(GetHandleTrigger(GetTriggeringTrigger(), "t"))
    call DisableTrigger(GetHandleTrigger(GetTriggeringTrigger(), "f"))
    //call DebugMsg("Shining Ogremace Autocast Off")
  endif    
endfunction

function shining_ogremace_cooldown_timer takes nothing returns nothing
  local trigger t = GetHandleTrigger(GetExpiredTimer(), "t")
  //call DebugMsg("Cooldown Over")
  call SetHandleHandle(t, "p", null)
  call FlushHandleLocals(GetExpiredTimer())
  call DestroyTimer(GetExpiredTimer())
  set t = null
endfunction

function auto_casted_shining_ogremace_action takes nothing returns nothing
  local trigger t = GetTriggeringTrigger()
  local unit c = GetHandleUnit(t, "c")
  local unit v = GetTriggerUnit()
  local integer l = GetUnitAbilityLevel(c, Shining_Ogremace_Abi())
  local boolean b = GetHandleBoolean(t, "b")
  local boolean m 
  local timer p = GetHandleTimer(t, "p")
  
  if GetAttacker() == c and p == null and IsUnitEnemy(v, GetOwningPlayer(c)) and not(IsUnitType(v, UNIT_TYPE_STRUCTURE)) and not(IsUnitType(v, UNIT_TYPE_MAGIC_IMMUNE)) then
    set m = GetUnitState(c, UNIT_STATE_MANA) >= Shining_Ogremace_Mana_Cost()
    if b or m then
      call shining_ogremace_add_debuff(c,v) 
    
      if not(m) then
        call SetHandleBoolean(t, "b", false)
      endif  
    
      set p = CreateTimer()
      call SetHandleHandle(t, "p", p)
      call SetHandleHandle(p, "t", t)
      call TimerStart(p, Shining_Ogremace_Cooldown(l), false, function shining_ogremace_cooldown_timer)
    
      set p = null
    endif  
  endif
  
  set t = null
  set v = null
  set c = null
endfunction

function shining_ogremace_autocast_has_mana takes nothing returns nothing
  local trigger t = GetHandleTrigger(GetTriggeringTrigger(), "t")
  //call DebugMsg("Tgrale has mana again")
  call SetHandleBoolean(t, "b", true)
  set t = null
endfunction  

function shining_ogremace_learned_action takes nothing returns nothing
  local trigger t = CreateTrigger()
  local trigger p = CreateTrigger()
  local trigger k = CreateTrigger()
  local trigger f = CreateTrigger()
  local trigger r = CreateTrigger()
  
  call TriggerRegisterUnitEvent(t, GetTriggerUnit(), EVENT_UNIT_SPELL_EFFECT)
  call TriggerAddCondition(t, Condition(function shining_ogremace_cond))
  call TriggerAddAction(t, function shining_ogremace_action)
  
  //used for auto-cast shining ogremace
  call TriggerRegisterAnyUnitEventBJ(r, EVENT_PLAYER_UNIT_ATTACKED)
  call TriggerAddAction(r, function auto_casted_shining_ogremace_action)
  call SetHandleHandle(r, "c", GetTriggerUnit())
  call SetHandleBoolean(r, "b", GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA) >= Shining_Ogremace_Mana_Cost())
  call SetHandleHandle(r, "k", k)
  call DisableTrigger(r)
  
  call TriggerRegisterUnitManaEvent(f, GetTriggerUnit(), GREATER_THAN, Shining_Ogremace_Mana_Cost() )
  call TriggerAddAction(f, function shining_ogremace_autocast_has_mana)
  call SetHandleHandle(f, "t", t)
  
  call TriggerRegisterUnitEvent(k, GetTriggerUnit(), EVENT_UNIT_ISSUED_ORDER)
  call TriggerAddAction(k, function shining_ogremace_autocast_action)  
  call SetHandleHandle(k, "t", r)
  call SetHandleHandle(k, "f", f)
  
  call DestroyTrigger(GetTriggeringTrigger())
  set t = null 
  set p = null
endfunction

function InitTrig_shining_ogremace takes nothing returns nothing
  local trigger t = CreateTrigger()
  call TriggerRegisterUnitEvent(t, gg_unit_H000_0001, EVENT_UNIT_HERO_SKILL ) 
  call TriggerAddCondition(t, Condition (function shining_ogremace_learned_cond))
  call TriggerAddAction(t, function shining_ogremace_learned_action)
endfunction
this is working but not while autocasted
 
N

no0by

Guest
I've tweeked your code abit and its working as it should I think

(See Attachment)
 

Attachments

  • Shining Ogermace.w3x
    18.2 KB · Views: 183
G

gonecase

Guest
thanxxx man... u going down on the credits thtz for suree....
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top