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

Floating text and exp

Status
Not open for further replies.
Level 17
Joined
Nov 13, 2006
Messages
1,814
1.
dont work at all, so dont have floating text, question is why?


map init
JASS:
    set udg_FT = CreateTextTag()
    set udg_Xvel = 7.1 / 128 * Cos(3.14159 / 2)
    set udg_Yvel = 7.1 / 128 * Sin(3.14159 / 2)

header function
JASS:
function FT takes string txt, real fsize, unit u, integer red, integer green, integer blue, integer alpha returns nothing
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real diff = StringLength(txt) * fsize/2+1
    call SetTextTagText(udg_FT, txt, fsize * 0.023)
    call SetTextTagPos(udg_FT, x-diff, y, 100.00)
    call SetTextTagColor(udg_FT, red, green, blue, alpha)
    call SetTextTagPermanent( udg_FT, false )
    call SetTextTagLifespan( udg_FT, 4.50 )
    call SetTextTagFadepoint( udg_FT, 2.50 )
    call SetTextTagVelocity(udg_FT, udg_Xvel, udg_Xvel)
endfunction

call

JASS:
call FT ("Blocked!", 0.9 , t, 0, 0, 255, 200)


2. i can decrease experience? i mean i tryed set hero exp to 0 but at hero bar its remain same :/
 
Level 11
Joined
Jul 9, 2009
Messages
926
Try this

  • Experience Decrease
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set ExperienceDecrease = ((Hero experience of (Dying unit)) - 1000)
      • Hero - Set (Dying unit) experience to ExperienceDecrease, Hide level-up graphics
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
THREAD SOLVED

ok i made it, exp reduction, without make bug with hero bar (when u decrease hero exp more than what he need for level then sometimes write there a bit weird value :D)

if somebody need demo map how can you reduce the hero experience by that amount u want then i uploaded 1 map also here the jass code

JASS:
function GetLvExp takes unit u returns integer
    local integer exp
    local integer lv = GetHeroLevel(u)
    local integer ConstFactor = 100
    local integer StartExp = 200
    if lv > 1 then
        set exp = StartExp + ConstFactor * (lv - 3) * (lv + 2) / 2 + lv * ConstFactor
    else
        set exp = 0
    endif
    return exp
endfunction

JASS:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    local unit u = GetDyingUnit()
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local integer LevelExp = GetLvExp(u)
    local integer CurrentExp = GetHeroXP(u)
    local integer ExpReduction = 25
    local integer NewExp = (( - 1 * ( CurrentExp - LevelExp )) * (100 - ExpReduction)) / 100
if IsUnitType (u,UNIT_TYPE_HERO) then
    if CurrentExp > LevelExp then
        call AddHeroXP( u, NewExp, false )
    endif
    call DisplayTextToForce( GetPlayersAll(), "Current Experience: " + I2S(CurrentExp) )
    call DisplayTextToForce( GetPlayersAll(), "Previous Level Up Experience: " + I2S(LevelExp) )
    call DisplayTextToForce( GetPlayersAll(), "Lost Experince Reduction: " + I2S(ExpReduction) + "%" )
    call DisplayTextToForce( GetPlayersAll(), "New Experience:" + I2S(NewExp) )
    call ReviveHero( u, x , y, false )
    if GetOwningPlayer(u) == GetLocalPlayer() then
        call SelectUnit(u, true)
        call PanCameraTo( x, y )
    endif

endif
    set u = null
endfunction

//===========================================================================
function InitTrig_Hero_Exp_Reduction takes nothing returns nothing
    set gg_trg_Hero_Exp_Reduction = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Hero_Exp_Reduction, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddAction( gg_trg_Hero_Exp_Reduction, function Trig_Untitled_Trigger_001_Actions )
endfunction
 

Attachments

  • getexp.w3x
    18.1 KB · Views: 44
Last edited:
Status
Not open for further replies.
Top