HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Wrong with trigger?

04-06-2006, 03:52 PM#1
Thunder_Eye
Hi, this trigger causes an WE crash, can someone see the problem?

Collapse JASS:
function Trig_SKILL_Evaluating_Intelligence_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A004' ) ) then
        return false
    endif
    return true
endfunction

function Trig_SKILL_Evaluating_Intelligence_Actions takes nothing returns nothing
    local integer i = GetPlayerId(GetOwningPlayer(GetTriggerUnit())) + 1
    local integer int = GetHeroInt(GetTriggerUnit(), true)
    local real r = GetRandomReal(0.00, 50.00)
    local string s
    local texttag t
    local real a
    if r <= udg_SKILL_Evaluating_Intelligence[i] then
        if (int >= 0) and (int <= 14) then
            set s = "You are slightly less intelligent than a rock."
        elseif  (int >= 15) and (int <= 29) then
            set s = "You are fairly stupid."
        elseif  (int >= 30) and (int <= 44) then
            set s = "You are not the brightest."
        elseif  (int >= 45) and (int <= 59) then
            set s = "You are about average."
        elseif  (int >= 60) and (int <= 74) then
            set s = "You are moderately intelligent."
        elseif  (int >= 75) and (int <= 89) then
            set s = "You are very intelligent."
        elseif  (int >= 90) and (int <= 104) then
            set s = "You are extremely intelligent."
        elseif  (int >= 105) and (int <= 119) then
            set s = "You are extraordinarily intelligent."
        elseif  (int >= 120) and (int <= 134) then
            set s = "You are like a formidable intellect, well beyond even the extraordinary."
        elseif  (int >= 135) and (int <= 149) then
            set s = "You are like a definite genius."
        elseif int == 150 then
            set s = "You are superhumanly intelligent in a manner you cannot comprehend."
        endif
    else
        set s = "You can't even evaluate your own intelligence."
    endif
    set r = GetRandomReal(0.00, 50.00)
    if r >= udg_SKILL_Evaluating_Intelligence[i] then
        set udg_SKILL_Evaluating_Intelligence[i] = udg_SKILL_Evaluating_Intelligence[i] + 0.10
        call DisplayTextToPlayer( GetOwningPlayer(GetTriggerUnit()), ( "|cff0C93BAYour Evalutaing Intelligence skill has increased by 0.1. It is now " + ( SubString(R2S(udg_SKILL_Evaluating_Intelligence[i]), 0, 4) + ".|r" ) ) )
    endif
    set t =  CreateTextTagUnitBJ( s, GetTriggerUnit(), 100.00, 10, 100, 100, 100, 30.00 )
    call TriggerSleepAction( 1.50 )
    call DestroyTextTag(t )
    set int = 0
    set i = 0
    set r = 0
    set s = ""
    set t = null
endfunction

//===========================================================================
function InitTrig_SKILL_Evaluating_Intelligence takes nothing returns nothing
    set gg_trg_SKILL_Evaluating_Intelligence = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_SKILL_Evaluating_Intelligence, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_SKILL_Evaluating_Intelligence, Condition( function Trig_SKILL_Evaluating_Intelligence_Conditions ) )
    call TriggerAddAction( gg_trg_SKILL_Evaluating_Intelligence, function Trig_SKILL_Evaluating_Intelligence_Actions )
endfunction

04-06-2006, 03:57 PM#2
Earth-Fury
Collapse JASS:
native DisplayTextToPlayer          takes player toPlayer, real x, real y, string message returns nothing

Line 38. Not enogh paramiters passed to the function. JassCraft For the Win.
04-06-2006, 04:08 PM#3
Thunder_Eye
Already have JSP which gave me the same problem, It said that the R2S didnt work.
EDIT: Ok found the problem, had to add the x,y coordinates to the function (Was previously DisplayTextToForce)
04-06-2006, 04:13 PM#4
Earth-Fury
No.... Look at the native i posted.

Now look at your function:

Collapse JASS:
call DisplayTextToPlayer( GetOwningPlayer(GetTriggerUnit()), ( "|cff0C93BAYour Evalutaing Intelligence skill has increased by 0.1. It is now " + ( SubString(R2S(udg_SKILL_Evaluating_Intelligence[i]), 0, 4) + ".|r" ) ) )

lets disect this, shall we?

call
DisplayTextToPlayer()
First paramiter: GetOwningPlayer(GetTriggerUnit())
Secont paramiter: ( "|cff0C93BAYour Evalutaing Intelligence skill has increased by 0.1. It is now " + ( SubString(R2S(udg_SKILL_Evaluating_Intelligence[i]), 0, 4) + ".|r" ) )

Now, the native i posted (which is the native you are calling) had 4 paramiters. You only supplyed 2. See the problem now? =)

Edit: Why do i even bother sometimes? xD
04-06-2006, 04:13 PM#5
Thunder_Eye
You missed the edit.
04-07-2006, 04:47 AM#6
mmx2000
You spelled Evaluate wrong.
<.<
^^