modifying attribute points

jig7c

Stop reading me...-statement
Reaction score
123
bump!

it is still not working.. what am i missing?
neither is the attribute point being added, nor is the text coming up

JASS:
scope AttributeModifier initializer Init
function Attribute_Conditions takes nothing returns boolean
    return IsUnitEnemy(GetKillingUnit(), Player(PLAYER_NEUTRAL_AGGRESSIVE)) and IsUnitType(GetKillingUnit(), UNIT_TYPE_HERO)
endfunction

function Attribute_Actions takes nothing returns nothing
    local unit u = GetKillingUnit()
    local integer i = GetRandomInt(1,4)//creating integer for random attribute
    local texttag t = CreateTextTag () //floating text
    //showing a floating text over killing unit, based on the bonus given!!
    
    //Strenght
    if (i == 1) then
        call UnitModifyStr(u, 2) //adding the bonus
        call SetTextTagPosUnit( t, u, 10 )
        call SetTextTagText( t, "+2 Strength", 0.023 )
        call SetTextTagColor( t, 10, 255, 255, 0 )
        call SetTextTagPermanent (t, false)
        call SetTextTagLifespan (t, 2.00)
        call SetTextTagVelocity( t, 0.0355 * Cos( 90. * bj_DEGTORAD ), 0.0355 * Sin( 90. * bj_DEGTORAD ) )
        call SetTextTagFadepoint (t, 2.00 )
    elseif (i == 2) then//Agility
        call UnitModifyAgi(u, 2) //adding the bonus
        call SetTextTagPosUnit( t, u, 10 )
        call SetTextTagText( t, "+2 Agility", 0.023 )
        call SetTextTagColor( t, 255, 10, 255, 0 )
        call SetTextTagPermanent (t, false)
        call SetTextTagLifespan (t, 2.00)
        call SetTextTagVelocity( t, 0.0355 * Cos( 90. * bj_DEGTORAD ), 0.0355 * Sin( 90. * bj_DEGTORAD ) )
        call SetTextTagFadepoint (t, 2.00 )
    elseif (i == 3) then  // Intelligence
        call UnitModifyInt(u, 2) //adding the bonus
        call SetTextTagPosUnit( t, u, 10 )
        call SetTextTagText( t, "+2 Intelligence", 0.023 )
        call SetTextTagColor( t, 255, 255, 10, 0 )
        call SetTextTagPermanent (t, false)
        call SetTextTagLifespan (t, 2.00)
        call SetTextTagVelocity( t, 0.0355 * Cos( 90. * bj_DEGTORAD ), 0.0355 * Sin( 90. * bj_DEGTORAD ) )
        call SetTextTagFadepoint (t, 2.00 )
    elseif (i == 4) then //All Stats
        call UnitModifyStr (u, 1)
        call UnitModifyAgi (u, 1)
        call UnitModifyInt (u, 1)
        call SetTextTagPosUnit( t, u, 10 )
        call SetTextTagText( t, "+1 All Stats", 0.023 )
        call SetTextTagColor( t, 200, 10, 50, 0 )
        call SetTextTagPermanent (t, false)
        call SetTextTagLifespan (t, 2.00)
        call SetTextTagVelocity( t, 0.0355 * Cos( 90. * bj_DEGTORAD ), 0.0355 * Sin( 90. * bj_DEGTORAD ) )
        call SetTextTagFadepoint (t, 2.00 )
    endif
    
    set u = null //removing unit from var
    set t = null
endfunction

//===========================================================================
function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterPlayerUnitEvent( t, Player( 12 ), EVENT_PLAYER_UNIT_DEATH, null )
    call TriggerAddCondition( t, Condition( function Attribute_Conditions) )
    call TriggerAddAction( t, function Attribute_Actions )
endfunction
endscope
 

Executor

I see you
Reaction score
57
Ah, foolishness mistake.

Check with debug msg if and which code is executed or not executed.
 

Laiev

Hey Listen!!
Reaction score
188

jig7c

Stop reading me...-statement
Reaction score
123
what i need is every time a HERO kills a Neutral Hostile Unit, it either gains a random stat of +2 or +1 to all stat...
thats it, so what changes do I need to make?
 

Laiev

Hey Listen!!
Reaction score
188
if the spell don't work, the problem is with condition

if the start at least start, the text show up

EDIT: also if still don't working, put this after the text

JASS:
call SetTextTagVisibility(<text>, true)


EDIT EDIT: use this example:

JASS:
.
        call UnitModifyStr(u, 2) //adding the bonus
        call SetTextTagText( t, "+2 Strength", 0.023 )
        call SetTextTagPosUnit( t, u, 10 )
        call SetTextTagColor( t, 10, 255, 255, 0 )
        call SetTextTagVelocity( t, 0.0355 * Cos( 90. * bj_DEGTORAD ), 0.0355 * Sin( 90. * bj_DEGTORAD ) )
        call SetTextTagVisibility(t, true)
        call SetTextTagFadepoint (t, 2.00 )
        call SetTextTagLifespan (t, 2.00)
        call SetTextTagPermanent (t, false)
 

jig7c

Stop reading me...-statement
Reaction score
123
still don't work..
maybe i have to declare UnitProperties trigger somehwhere so it can use UnitModifyStr, UnitModifyAgi and UnitModifyInt in my trigger???

but im not even getting any text...
 

tooltiperror

Super Moderator
Reaction score
231
Init should be private.

Edit: At least use the private key words.

JASS:
scope AttributeModifier initializer Init     
     private function condition takes nothing returns boolean
         return IsUnitEnemy(GetKillingUnit(), Player(PLAYER_NEUTRAL_AGGRESSIVE)) and IsUnitType(GetKillingUnit(), UNIT_TYPE_HERO)
     endfunction

     private function action takes nothing returns nothing
         local unit u = GetKillingUnit()
         local integer i = GetRandomInt(1,4)//creating integer for random attribute
         local texttag t = CreateTextTag () //floating text
         //showing a floating text over killing unit, based on the bonus given!!
    
         //Strenghth
         if (i == 1) then
             call UnitModifyStr(u, 2) //adding the bonus
             call SetTextTagPosUnit( t, u, 10 )
             call SetTextTagText( t, "+2 Strength", 0.023 )
             call SetTextTagColor( t, 10, 255, 255, 0 )
             call SetTextTagPermanent (t, false)
             call SetTextTagLifespan (t, 2.00)
             call SetTextTagVelocity( t, 0.0355 * Cos( 90. * bj_DEGTORAD ), 0.0355 * Sin( 90. * bj_DEGTORAD ) )
             call SetTextTagFadepoint (t, 2.00 )
         elseif (i == 2) then//Agility
             call UnitModifyAgi(u, 2) //adding the bonus
             call SetTextTagPosUnit( t, u, 10 )
             call SetTextTagText( t, "+2 Agility", 0.023 )
             call SetTextTagColor( t, 255, 10, 255, 0 )
             call SetTextTagPermanent (t, false)
             call SetTextTagLifespan (t, 2.00)
             call SetTextTagVelocity( t, 0.0355 * Cos( 90. * bj_DEGTORAD ), 0.0355 * Sin( 90. * bj_DEGTORAD ) )
             call SetTextTagFadepoint (t, 2.00 )
         elseif (i == 3) then  // Intelligence
             call UnitModifyInt(u, 2) //adding the bonus
             call SetTextTagPosUnit( t, u, 10 )
             call SetTextTagText( t, "+2 Intelligence", 0.023 )
             call SetTextTagColor( t, 255, 255, 10, 0 )
             call SetTextTagPermanent (t, false)
             call SetTextTagLifespan (t, 2.00)
             call SetTextTagVelocity( t, 0.0355 * Cos( 90. * bj_DEGTORAD ), 0.0355 * Sin( 90. * bj_DEGTORAD ) )
             call SetTextTagFadepoint (t, 2.00 )
         elseif (i == 4) then //All Stats
             call UnitModifyStr (u, 1)
             call UnitModifyAgi (u, 1)
             call UnitModifyInt (u, 1)
             call SetTextTagPosUnit( t, u, 10 )
             call SetTextTagText( t, "+1 All Stats", 0.023 )
             call SetTextTagColor( t, 200, 10, 50, 0 )
             call SetTextTagPermanent (t, false)
             call SetTextTagLifespan (t, 2.00)
             call SetTextTagVelocity( t, 0.0355 * Cos( 90. * bj_DEGTORAD ), 0.0355 * Sin( 90. * bj_DEGTORAD ) )
             call SetTextTagFadepoint (t, 2.00 )
         endif
         set u = null
         set t = null
     endfunction

     private function Init takes nothing returns nothing
         local trigger t=CreateTrigger()
         call TriggerRegisterPlayerUnitEvent(t,Player(12),EVENT_PLAYER_UNIT_DEATH,null)
         call TriggerAddCondition(t,Condition(function condition))
         call TriggerAddAction(t,function action)
     endfunction
endscope
 

jig7c

Stop reading me...-statement
Reaction score
123
can you post the upgraded jass?


maybe i have to declare UnitProperties trigger somewhere so it can use UnitModifyStr, UnitModifyAgi and UnitModifyInt functions in my script???

JASS:
scope AttributeModifier initializer Init
    function Attribute_Conditions takes nothing returns boolean
        return IsUnitType(GetKillingUnit(), UNIT_TYPE_HERO)
    endfunction

    function Attribute_Actions takes nothing returns nothing
        local unit u = GetKillingUnit()
        local integer i = GetRandomInt(1,4)//creating integer for random attribute
        local texttag t = CreateTextTag () //floating text
    //showing a floating text over killing unit, based on the bonus given!!
   
        if (i == 1) then //Strenght
            call UnitModifyStr(u, 2) //adding the bonus
            call SetTextTagText( t, "+2 Strength", 0.023 )
            call SetTextTagPosUnit( t, u, 10 )
            call SetTextTagColor( t, 10, 255, 255, 0 )
            call SetTextTagVelocity( t, 0.0355 * Cos( 90. * bj_DEGTORAD ), 0.0355 * Sin( 90. * bj_DEGTORAD ) )
            call SetTextTagVisibility(t, true)
            call SetTextTagFadepoint (t, 2.00 )
            call SetTextTagLifespan (t, 2.00)
            call SetTextTagPermanent (t, false)
        elseif (i == 2) then//Agility
           call UnitModifyAgi(u, 2) //adding the bonus
            call SetTextTagText( t, "+2 Agility", 0.023 )
            call SetTextTagPosUnit( t, u, 10 )
            call SetTextTagColor( t, 10, 255, 255, 0 )
            call SetTextTagVelocity( t, 0.0355 * Cos( 90. * bj_DEGTORAD ), 0.0355 * Sin( 90. * bj_DEGTORAD ) )
            call SetTextTagVisibility(t, true)
            call SetTextTagFadepoint (t, 2.00 )
            call SetTextTagLifespan (t, 2.00)
            call SetTextTagPermanent (t, false)
        elseif (i == 3) then  // Intelligence
            call UnitModifyInt(u, 2) //adding the bonus
            call SetTextTagText( t, "+2 Intelligence", 0.023 )
            call SetTextTagPosUnit( t, u, 10 )
            call SetTextTagColor( t, 10, 255, 255, 0 )
            call SetTextTagVelocity( t, 0.0355 * Cos( 90. * bj_DEGTORAD ), 0.0355 * Sin( 90. * bj_DEGTORAD ) )
            call SetTextTagVisibility(t, true)
            call SetTextTagFadepoint (t, 2.00 )
            call SetTextTagLifespan (t, 2.00)
            call SetTextTagPermanent (t, false)
        elseif (i == 4) then //All Stats
            call UnitModifyStr (u, 1)
            call UnitModifyAgi (u, 1)
            call UnitModifyInt (u, 1)
            call SetTextTagText( t, "+1 All Stats", 0.023 )
            call SetTextTagPosUnit( t, u, 10 )
            call SetTextTagColor( t, 10, 255, 255, 0 )
            call SetTextTagVelocity( t, 0.0355 * Cos( 90. * bj_DEGTORAD ), 0.0355 * Sin( 90. * bj_DEGTORAD ) )
            call SetTextTagVisibility(t, true)
            call SetTextTagFadepoint (t, 2.00 )
            call SetTextTagLifespan (t, 2.00)
            call SetTextTagPermanent (t, false)
        endif   

        set u = null //removing unit from var
        set t = null
    endfunction

//===========================================================================
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterPlayerUnitEvent( t, Player(12), EVENT_PLAYER_UNIT_DEATH, null )
        call TriggerAddCondition( t, Condition( function Attribute_Conditions) )
        call TriggerAddAction( t, function Attribute_Actions )
    endfunction
endscope
 

Laiev

Hey Listen!!
Reaction score
188
I just want f*ck this code LOL

So i get it and fix it :)

the problem? you set alpha to zero LOL

JASS:
scope AttributeModifier initializer Init
   private function Attribute_Conditions takes nothing returns boolean
        return IsUnitType(GetKillingUnit(), UNIT_TYPE_HERO)
    endfunction

   private function Attribute_Actions takes nothing returns nothing
        local unit u = GetKillingUnit()
        local integer i = GetRandomInt(1,4)//creating integer for random attribute
        local texttag t = CreateTextTag () //floating text
    //showing a floating text over killing unit, based on the bonus given!!
    
        if (i == 1) then //Strenght
            call UnitModifyStr(u, 2) //adding the bonus
            call SetTextTagText( t, "+2 Strength", 0.023 )
            call SetTextTagPosUnit( t, u, 10 )
            call SetTextTagColor( t, 10, 255, 255, 255 )
            call SetTextTagVelocity( t, 0.0355 * Cos( 90. * bj_DEGTORAD ), 0.0355 * Sin( 90. * bj_DEGTORAD ) )
            call SetTextTagVisibility(t, true)
            call SetTextTagFadepoint (t, 2.00 )
            call SetTextTagLifespan (t, 2.00)
            call SetTextTagPermanent (t, false)
        elseif (i == 2) then//Agility
            call UnitModifyAgi(u, 2) //adding the bonus
            call SetTextTagText( t, "+2 Agility", 0.023 )
            call SetTextTagPosUnit( t, u, 10 )
            call SetTextTagColor( t, 10, 255, 255, 255 )
            call SetTextTagVelocity( t, 0.0355 * Cos( 90. * bj_DEGTORAD ), 0.0355 * Sin( 90. * bj_DEGTORAD ) )
            call SetTextTagVisibility(t, true)
            call SetTextTagFadepoint (t, 2.00 )
            call SetTextTagLifespan (t, 2.00)
            call SetTextTagPermanent (t, false)
        elseif (i == 3) then  // Intelligence
            call UnitModifyInt(u, 2) //adding the bonus
            call SetTextTagText( t, "+2 Intelligence", 0.023 )
            call SetTextTagPosUnit( t, u, 10 )
            call SetTextTagColor( t, 10, 255, 255, 255 )
            call SetTextTagVelocity( t, 0.0355 * Cos( 90. * bj_DEGTORAD ), 0.0355 * Sin( 90. * bj_DEGTORAD ) )
            call SetTextTagVisibility(t, true)
            call SetTextTagFadepoint (t, 2.00 )
            call SetTextTagLifespan (t, 2.00)
            call SetTextTagPermanent (t, false)
        elseif (i == 4) then //All Stats
            call UnitModifyStr (u, 1)
            call UnitModifyAgi (u, 1)
            call UnitModifyInt (u, 1)
            call SetTextTagText( t, "+1 All Stats", 0.023 )
            call SetTextTagPosUnit( t, u, 10 )
            call SetTextTagColor( t, 10, 255, 255, 255 )
            call SetTextTagVelocity( t, 0.0355 * Cos( 90. * bj_DEGTORAD ), 0.0355 * Sin( 90. * bj_DEGTORAD ) )
            call SetTextTagVisibility(t, true)
            call SetTextTagFadepoint (t, 2.00 )
            call SetTextTagLifespan (t, 2.00)
            call SetTextTagPermanent (t, false)
        endif   
        set u = null //removing unit from var
        set t = null
    endfunction

//===========================================================================
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterPlayerUnitEvent( t, Player(12), EVENT_PLAYER_UNIT_DEATH, null )
        call TriggerAddCondition( t, Condition( function Attribute_Conditions) )
        call TriggerAddAction( t, function Attribute_Actions )
    endfunction
endscope


tested and working
 

jig7c

Stop reading me...-statement
Reaction score
123
the text shows up, but the stats don't get added!
+rep added to laiev for that...
 

Laiev

Hey Listen!!
Reaction score
188
well i read in egui forum part... that system is broken what add attribute to hero :p or something like that
 

jig7c

Stop reading me...-statement
Reaction score
123
i fixed it
decided not to use unitproperties...

did it using bjs.. atleast its working now..
 
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
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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