• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Text error ingame

Status
Not open for further replies.
Level 9
Joined
Apr 7, 2010
Messages
480
what does this error mean?

`UNIT INDEX ERROR : ATTEMPT TO LOCK NULL INDEX
`UNIT INDEX ERROR : ATTEMPT TO UNLOCK UNLOCKED INDEX
 
Level 9
Joined
Apr 7, 2010
Messages
480
How can i fix this? ' i dont think theres a problem with Mckill2009's spell

JASS:
//Spell Name: Combat Knife
//Created by: Mckill2009

scope CombatKnife initializer init

globals
    private constant integer        SPELL_ID = 'A000'
    private constant attacktype          ATK = ATTACK_TYPE_PIERCE
    private constant damagetype          DMG = DAMAGE_TYPE_NORMAL
    private constant string              SFX = "Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl"
    private constant string       ATTACHMENT = "chest"
    private constant real                AOE = 90
    private unit TEMP_UNIT
endglobals

private function GetDamageMin takes integer i returns real
    return 1 + i * 2.
endfunction

private function GetDamageMax takes integer i returns real
    return 3 + i * 9.
endfunction

private function OrganicUnit takes unit u returns boolean
    return not IsUnitType(u, UNIT_TYPE_MECHANICAL) and not IsUnitType(u, UNIT_TYPE_ANCIENT) and /*
         */not IsUnitType(u, UNIT_TYPE_TOWNHALL)
endfunction

private function FilterUnit takes nothing returns boolean
    local unit u = GetFilterUnit()
    local boolean b = GetWidgetLife(u) > 0.405 and IsUnitEnemy(TEMP_UNIT, GetOwningPlayer(u)) and not IsUnitType(u, UNIT_TYPE_FLYING)
    set u = null
    return b
endfunction

private function Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit first
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real x1
    local real y1
    local real facing = GetUnitFacing(u)*bj_DEGTORAD
    local integer level = GetUnitAbilityLevel(u, SPELL_ID)
    local real damage = GetRandomReal(GetDamageMin(level), GetDamageMax(level))
    local texttag tag
    set x1 = x+90*Cos(facing)
    set y1 = y+90*Sin(facing)
    set TEMP_UNIT = u
    call GroupEnumUnitsInRange(bj_lastCreatedGroup, x1, y1, AOE, function FilterUnit)
    set first = FirstOfGroup(bj_lastCreatedGroup)
    if first !=null then
        set tag = CreateTextTag() 
        call UnitDamageTarget(u, first, damage, false, false, ATK, DMG, null)
        if OrganicUnit(first) then
            call DestroyEffect(AddSpecialEffectTarget(SFX, first, ATTACHMENT))        
        endif        
        call SetTextTagPosUnit(tag, first, 0.) 
        call SetTextTagText(tag, I2S(R2I(damage)), 0.02)
        call SetTextTagPermanent(tag, false)
        call SetTextTagVelocity(tag, 0.03, 0.03)
        call SetTextTagLifespan(tag, 3)
        call SetTextTagFadepoint(tag, 0.01) 
    endif
    call IssueImmediateOrder(u, "stop")
    set u = null
    set  first = null
    set tag = null
endfunction

private function Cond 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_CAST)
    call TriggerAddCondition(t, Condition(function Cond))
    call TriggerAddAction(t, function Actions)
    set t = null
endfunction

endscope
 
Last edited:
Status
Not open for further replies.
Top