Need vJASS help - Custom Polymorph

Rainther

I guess I should write something of value here...
Reaction score
61
Hi all. I've started working on a map and have hit a dead end. This JASS-based trigger is supposed to get triggered when a custom polymorph ability is being cast. It's supposed to remove the Polymorph-buff upon received damage on target at level 1 damage, and on level 2 and 3 when some damagin has occured. However the UnitRemoveBuffBJ(PolyBuff, target) doesn't work on removing the Sheep-buff, but it works on other buffs. The script however works from other triggers (removing Polymorph, that is) that I've tried, but not in this one.
Anybuddy who happends to posses a though in why this aint working?
Feel free to comment if I should do any ways to prevent leaks while at it.

This trigger is in vJASS and is using ABC -- STRUCT ATTACHMENT SYSTEM BY COHADAR -- v6.0 as help.

JASS:
scope Polymorph initializer Init

globals
    private constant integer SPELL_ID = 'Poly'
    private constant integer BUFF = 'B000'
endglobals

private struct Data
    unit cast
    unit taru
    integer abiLvL
    real dmg
endstruct

private function Act2 takes nothing returns nothing
    local trigger t = GetTriggeringTrigger()
    local Data d = GetTriggerStructA(t)
    local real dmg = GetEventDamage()
    
    if GetTriggerEventId()==EVENT_UNIT_DAMAGED then
        set d.dmg = d.dmg + dmg
        if d.abiLvL == 1 then
            call UnitRemoveBuffBJ( BUFF, d.taru )
            call ClearTriggerStructA(t)
            call d.destroy()
            call DisableTrigger(t)
            call DestroyTrigger(t)
        elseif d.abiLvL == 2 and d.dmg >= 200 then
            call UnitRemoveBuffBJ( BUFF, d.taru )
            call ClearTriggerStructA(t)
            call d.destroy()
            call DisableTrigger(t)
            call DestroyTrigger(t)
        elseif d.abiLvL == 3 and d.dmg >= 500 then
            call UnitRemoveBuffBJ( BUFF, d.taru )
            call ClearTriggerStructA(t)
            call d.destroy()
            call DisableTrigger(t)
            call DestroyTrigger(t)
        endif
    elseif GetSpellAbilityId() == SPELL_ID or UnitHasBuffBJ(d.taru, BUFF) != true then
        call ClearTriggerStructA(t)
        call d.destroy()
        call DisableTrigger(t)
        call DestroyTrigger(t)
    endif
    set t = null
endfunction
    
private function Act takes nothing returns nothing
    local trigger t = CreateTrigger()
    local unit cast = GetTriggerUnit()
    local unit taru = GetSpellTargetUnit()
    local integer abiLvL = GetUnitAbilityLevel(cast, SPELL_ID)
    local Data d = Data.create()
    
    set d.cast = cast
    set d.taru = taru
    set d.abiLvL = abiLvL
    set d.dmg = 0
    call SetTriggerStructA(t, d)
    call TriggerRegisterUnitEvent(t, taru, EVENT_UNIT_DAMAGED)
    call TriggerRegisterUnitEvent(t, cast, EVENT_UNIT_SPELL_CAST)
    call TriggerRegisterTimerEvent(t, 0.25, true)
    call TriggerAddAction(t, function Act2)
    set t = null
endfunction

private function Cons takes nothing returns boolean
    return GetSpellAbilityId() == SPELL_ID
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition(t,Filter(function Cons) )
    call TriggerAddAction( t, function Act )
endfunction

endscope
 

Rainther

I guess I should write something of value here...
Reaction score
61
Is the polymorph-buff an ability which can't be spotted by the eye?

EDIT: Removing the ability instead of buff doesn't seem to do the trick either. I'm rather curious why I can remove the polymorph-buff through a seperate trigger with an event such as "Is attacked" but not in this trigger.
 

Rainther

I guess I should write something of value here...
Reaction score
61
Still haven't solved this problem... Does anybuddy have a clue why this trigger doesn't want to remove the buff of polymorph from the victim?
 

Silvenon

New Member
Reaction score
19
Maybe you can create a custom polymorph ability that doesn't display the buff at all (give it an empty buff).
 

Rainther

I guess I should write something of value here...
Reaction score
61
Have been thinking of doing such, however I'm not really sure how to change a units model through triggers. To disable a unit would be like to silence the units abilities, ranged and melee attack so that I get.
Anybuddy knows how to change model of a unit through triggers?
 

Silvenon

New Member
Reaction score
19
Copied from PitzerMike's tutorial:

Sca1 (Chaos): Adding a chaos ability to a unit transforms it into the unit type specified in the target unit id field of the ability. This can be used to change any aspect like the proper name or the model of a unit in the game or simply in combination with channel to implement morphing spells. Don't forget to remove the tech requirements from custom chaos abilities. One problem of Chaos is that it adds the morphed unit's current armor, damage, health and mana bonus received from items, auras and srength, agility, intelligence to the stats of the resulting unit. That means it's not a very good idea to morph heroes using chaos until Blizzard fixes those bugs. Ordinary units can't be affected by items and hero stats, so the only problem are buffs received from auras. Those buffs can easily be removed before the conversion and are automatically added again afterwards so that's not a real issue.

JASS:
call UnitRemoveAbility(u, 'BHab')
call UnitRemoveAbility(u, 'BUau')
call UnitRemoveAbility(u, 'BUav')
call UnitRemoveAbility(u, 'BEah')
call UnitRemoveAbility(u, 'BHad')
call UnitRemoveAbility(u, 'BEar')
call UnitRemoveAbility(u, 'BOae')
call UnitRemoveAbility(u, 'BOac')
call UnitRemoveAbility(u, 'Bapl')
call UnitRemoveAbility(u, 'Bplg')
call UnitRemoveAbility(u, 'Boar')
call UnitRemoveAbility(u, 'Babr')
call UnitRemoveAbility(u, 'Bakb')
call UnitAddAbility(u, <chaos ability id>)


This script will remove all aura buffs before applying the chaos upgrade. If you have custom buffs in your map, you'll have to remove them here too.

But that method is apparently a bit buggy with heroes. But that's the only way I could think of.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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