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

[JASS] Ping system crash wc3

Status
Not open for further replies.
Level 10
Joined
Feb 20, 2008
Messages
448
...... FIRST OF ALL i am noob Jasser :) lol i tryed to make a ping system that work on abilities which ping all hero and boss :)

BUT ITS CRASH WC3.... what do i did wrong ? can some1 explain my error ?.... trying to learn jass so i can learn Vjass :)
..... i also know in GUI i would have made it work so e-z.... but i hate gui more than jass..... i use gui becuz im not pro jasser D:



JASS:
function Trig_Sense_Nearby_aura_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'Add3'
endfunction

function Trig_Sense_Nearby_aura_Group_Conditions takes nothing returns boolean
    return GetOwningPlayer(GetEnumUnit()) != Player(12)
    return GetOwningPlayer(GetEnumUnit()) != Player(15) 
    return IsUnitType(GetEnumUnit(), UNIT_TYPE_HERO) == true 
    return IsUnitEnemy(GetEnumUnit(), GetTriggerPlayer()) == true 
endfunction

function Trig_Sense_Nearby_aura_Group takes nothing returns nothing
    local location loc = GetUnitLoc(GetEnumUnit())
    local real x = GetLocationX(loc)
    local real y = GetLocationY(loc)
    local real d = 5.00
    if ( Trig_Sense_Nearby_aura_Conditions() ) then
      call PingMinimapLocForForce( GetForceOfPlayer(GetTriggerPlayer()), loc, 5 )
     // call PingMinimapForForce(GetForceOfPlayer(GetOwningPlayer(GetEnumUnit())), x, y,d)
    endif
    call RemoveLocation(loc)
endfunction

function Trig_Sense_Nearby_aura_Actions takes nothing returns nothing
local group g = CreateGroup()
local rect  r = GetEntireMapRect()
      set g = GetUnitsInRectAll(r)
       call ForGroup( g, function Trig_Sense_Nearby_aura_Group )

   
call DestroyGroup(g)
call RemoveRect(r)

endfunction

//===========================================================================
function InitTrig_Sense_Nearby_aura takes nothing returns nothing
    local trigger t
    set t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Trig_Sense_Nearby_aura_Conditions ) )
    call TriggerAddAction(t, function Trig_Sense_Nearby_aura_Actions )
    set t = null
endfunction
 
Last edited:
Level 22
Joined
Feb 3, 2009
Messages
3,292
JASS:
function Trig_Sense_Nearby_aura_Conditions takes nothing returns boolean
   return GetSpellAbilityId() == 'Add3'
endfunction

function Trig_Sense_Nearby_aura_Group_Conditions takes nothing returns boolean
    return GetOwningPlayer(GetEnumUnit()) != Player(12)
    return GetOwningPlayer(GetEnumUnit()) != Player(15) 
    return IsUnitType(GetEnumUnit(), UNIT_TYPE_HERO) == true
    return IsUnitEnemy(GetEnumUnit(), GetTriggerPlayer()) == true
endfunction

function Trig_Sense_Nearby_aura_Group takes nothing returns nothing
    local unit u = GetEnumUnit()
    local location loc = GetUnitLoc(u)
    local real x = GetLocationX(loc)
    local real y = GetLocationY(loc)
    local real d = 5.00
    if ( Trig_Sense_Nearby_aura_Conditions() ) then

        call PingMinimapForForce(GetForceOfPlayer(GetTriggerPlayer()), x, y,d)
    else
    endif
    set u = null
    call RemoveLocation(loc)
endfunction

function Trig_Sense_Nearby_aura_Actions takes nothing returns nothing
local integer i 
     set i = 0
    
    loop
        exitwhen i > 12


        call ForGroup(GetUnitsOfPlayerAll(ConvertedPlayer(i)), function Trig_Sense_Nearby_aura_Group )

   
        set i = i+ 1
    endloop

endfunction

//===========================================================================
function InitTrig_Sense_Nearby_aura takes nothing returns nothing
    local trigger t
    set t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Trig_Sense_Nearby_aura_Conditions ) )
    call TriggerAddAction(t, function Trig_Sense_Nearby_aura_Actions )
    set t = null
endfunction
GetEnumUnit() doesn't do anything here... Since you didn't pick any units in this function...
In fact, no offense, this trigger is completely wrong, except if I missed something, but I'll let this to the others since I'm too tired to think atm.
 
Try something like this:
JASS:
function Sense_Nearby_AuraCond takes nothing returns boolean
   return GetSpellAbilityId() == 'Add3'
endfunction
function SenseNearbyAuraGroupCond takes nothing returns boolean
    return IsUnitType(GetEnumUnit(), UNIT_TYPE_HERO) and IsUnitEnemy(GetEnumUnit(),Player(bj_cineModeSavedSeed))
endfunction

function SenseNearbyAuraGroup takes nothing returns nothing
    local unit u = GetEnumUnit()
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local force f = CreateForce()
    if GetLocalPlayer() == Player(bj_cineModeSavedSeed) then
        call PingMinimap(x,y,5)
    endif
    call DestroyForce(f)
    set f = null
    set u = null
endfunction

function SenseNearbyAuraAct takes nothing returns nothing
    local group g = CreateGroup()
    local integer i = 0
    loop
        exitwhen i>11
        set bj_cineModeSavedSeed = i
        call GroupEnumUnitsOfPlayer(g,Player(i),Condition(function SenseNearbyAuraGroupCond))
        call ForGroup(g,function SenseNearbyAuraGroup)
        set i = i+1
    endloop
    call DestroyGroup(g)
    set g = null
    set bj_cineModeSavedSeed = 0
endfunction

//===========================================================================
function InitTrig_Sense_Nearby_aura takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t,Condition(function Sense_Nearby_AuraCond))
    call TriggerAddAction(t,function SenseNearbyAuraAct)
    set t = null
endfunction

It might work, I didn't test it.
 
Isn't it supposed to be GetFilterUnit()?

Also, what's the point of the force f variable?

Bleh, yeah I had some code left over that I forgot to remove, thanks.

@M_Vegeta:

Try this:
JASS:
function Sense_Nearby_AuraCond takes nothing returns boolean
   return GetSpellAbilityId() == 'Add3'
endfunction
function SenseNearbyAuraGroupCond takes nothing returns boolean
    return IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) and IsUnitEnemy(GetFilterUnit(),Player(bj_cineModeSavedSeed))
endfunction

function SenseNearbyAuraGroup takes nothing returns nothing
    local unit u = GetEnumUnit()
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    if GetLocalPlayer() == Player(bj_cineModeSavedSeed) then
        call PingMinimap(x,y,5)
    endif
    set u = null
endfunction

function SenseNearbyAuraAct takes nothing returns nothing
    local group g = CreateGroup()
    local integer i = 0
    loop
        exitwhen i>11
        set bj_cineModeSavedSeed = i
        call GroupEnumUnitsOfPlayer(g,Player(i),Condition(function SenseNearbyAuraGroupCond))
        call ForGroup(g,function SenseNearbyAuraGroup)
        set i = i+1
    endloop
    call DestroyGroup(g)
    set g = null
    set bj_cineModeSavedSeed = 0
endfunction

//===========================================================================
function InitTrig_Sense_Nearby_aura takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t,Condition(function Sense_Nearby_AuraCond))
    call TriggerAddAction(t,function SenseNearbyAuraAct)
    set t = null
endfunction
 
Level 10
Joined
Feb 20, 2008
Messages
448
there is something wrong, there is no ping, i thought it was my item ability but its not i tryed with an ability itself

it's something about
JASS:
    if GetLocalPlayer() == Player(bj_cineModeSavedSeed) then
        call PingMinimap(x,y,5)
   endif

or
JASS:
  return IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO)// and IsUnitEnemy(GetFilterUnit(),Player(bj_cineModeSavedSeed))

i removed those line and now the trigger work but its also ping ally :/

im wondering why do u use
JASS:
Player(bj_cineModeSavedSeed)
its should be ennemy of triggering player o_O since we want to ping ennemy if player that use the trigger o_O

i did now and it work :D

thx for ur help + rep hope return :)
 
Status
Not open for further replies.
Top