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

[JASS] 3days off jassing

Status
Not open for further replies.
Level 2
Joined
Jan 20, 2007
Messages
18
this is what i got out of 3 days with jass

JASS:
function trg_spell takes nothing returns boolean
    return GetSpellAbilityId() == 'SPELL ID'
endfunction

function trg_spell_Condition takes nothing returns boolean
    return IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false and IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL) == false and IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()), GetWidgetLife(GetFilterUnit()) > 0.405
endfunction

function trg_spell_Actions takes nothing returns nothing
    local unit c = GetTriggerUnit() 
    local real y = GetUnitY(c)
    local real x = GetUnitX(c)
    local integer i = GetUnitAbilityLevel(c, 'SPELL ID') 
    local group g = CreateGroup()
    local group g = GetUnitsInRangeOfLocAll(300*i(c()), Condition(function trg_spell_Condition)
    local unit u
    call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl", x, y))
    call GroupEnumUnitsInRangeOfLoc(g, c, 300*i)
    loop
        set u = FirstOfGroup(g)
        exitwhen f == null
        call UnitDamageTarget(c, u, 100*i, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, null
        call GroupRemoveUnit(n, F)
    endloop
endfunction
//======================================================================
function Init_spell takes nothing returns nothing
    set gg_trg_spell = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_spell, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_spell, Condition( function trg_spell_Condition ) )
    call TriggerAddAction( gg_trg_spell, function trg_spell_Actions )
    call Preload("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl")
endfunction

22 problems detected :sad:
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
local group g = CreateGroup()
local group g = GetUnitsInRangeOfLocAll(300*i(c()), Condition(function trg_spell_Condition)

2 locals with the same name tsk tsk tsk. . .

call GroupEnumUnitsInRangeOfLoc(g, c, 300*i)

INVALID IMPUT. . .
Says LOCATION and recieves a groupe, a unit, and a integer. . .
Check its imput for that function

exitwhen f == null
f. . . WTF you have not defined f. . .

call GroupRemoveUnit(n, F)
You have defined no locals called "n" OR "F"! ! !

local integer i = GetUnitAbilityLevel(c, 'SPELL ID')

'SPELL ID' is invalid and has to be changed to your spells raw data code which is 4 letters long. Like 'A001' is what it should be (like).

Hopes this helps you. . .
 
Last edited:
Level 2
Joined
Jan 20, 2007
Messages
18
fixed those thing u said
JASS:
*********************************************************
*16*function trg_spell takes nothing returns boolean
*17*    return GetSpellAbilityId == 'Aroc'
*18*endfunction
*19*
*20*function trg_spell_Condition takes nothing returns boolean
*21*    return IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false and IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL) == false and IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()), GetWidgetLife (GetFilterUnit()) > 0.405
*22*
*23*function trg_spell_Actions takes nothing returns nothing
*24*   local unit c = GetTriggerUnit() 
*25*    local real y = GetUnitY(c)
*26*    local real x = GetUnitX(c)
*27*    local integer i = GetUnitAbilityLevel(c, 'Aroc)
*28*    local group g = GetUnitsInRangeOfLocAll(300*i(c()), Condition(function trg_spell_Condition)
*29*    local unit u
*30*    call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl", x, y))
*31*    call GroupEnumUnitsInRangeOfLoc(c, g, 300*i)
*32*    loop
*33*        set u = FirstOfGroup(g)
*34*        exitwhen g == null
*35*        call UnitDamageTarget(c, u, 100*i, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, null
*36*        call GroupRemoveUnit(g, u)
*37*    endloop
*38*//======================================================================
*39*function Init_spell takes nothing returns nothing
*40*    set gg_trg_spell = CreateTrigger( )
*41*    call TriggerRegisterAnyUnitEventBJ( gg_trg_spell, EVENT_PLAYER_UNIT_SPELL_EFFECT )
*42*    call TriggerAddCondition( gg_trg_spell, Condition( function trg_spell_Condition ) )
*43*    call TriggerAddAction( gg_trg_spell, function trg_spell_Actions )



but i got 17 errors

line 17: Expected a valid argument list
line 19: Invalid type for specified operator
line 21: Expected expression
line 22: Expected a code statement
line 24: Expected a code statement
line 25: Expected a code statement
line 26: Expected a code statement
line 27: Expected a code statement
line 28: Expected a code statement
line 29: Expected a code statement
line 30: Expected a name
line 31: Expected a name
line 33: Expected a varibable name
line 34: Expected a name
line 35: Expected a name
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
local group g = GetUnitsInRangeOfLocAll(300*i(c()), Condition(function trg_spell_Condition)
300*i(c())

i is a INTEGER not a FUNCTION so you can nott pass peramiters to it.
c is a UNIT not a FUNCTION so you can not pass peramiters to it

return GetSpellAbilityId == 'Aroc'

GetSpellAbilityId is a FUNCTION not an INTEGER so it has to passed stuff (nothing has to be passed it just has to be as if stuff was being passed)

Fixed it should look like
return GetSpellAbilityId() == 'Aroc'

GetUnitsInRangeOfLocAll() TAKES NO CONDITION!
IT NEEDS A REAL AND A LOCATION AND NOTHING ELSE!

You must be after
GetUnitsInRangeOfLocMatching(radius, whichLocation, null)
Since that uses a condition and the other one DOES NOT!

You also left out an endfunction. . .

also your one condition is BADLY messed up
IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()), GetWidgetLife(GetFilterUnit()) > 0.405

You messed up baddly there REDO it totaly. . .

You refer to fillterunit in a CONDITION for triggering a function. . . .

I got annoyed with how many mistakes you made so i decided to fix it so that WE should save but weather it works like you want is entirly YOUR FAULT since I kept everything doing the same as in your script.

JASS:
function trg_spell_Condition takes nothing returns boolean
    return GetSpellAbilityId() == 'Aroc'
endfunction

function trg_spell_Pick_Condition takes nothing returns boolean
    return IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) == false and IsUnitType(GetFilterUnit(),UNIT_TYPE_MECHANICAL) == false and IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()),GetOwningPlayer(GetFilterUnit())) and GetWidgetLife(GetFilterUnit()) > 0.405
endfunction

function trg_spell_Actions takes nothing returns nothing
    local unit c = GetTriggerUnit() 
    local real y = GetUnitY(c)
    local real x = GetUnitX(c)
    local integer i = GetUnitAbilityLevel(c,'Aroc')
    local group g = CreateGroup()
    local unit u
    local boolexpr b = Condition(function trg_spell_Pick_Condition)
    call GroupEnumUnitsInRange(g,x,y,300*i,b)
    call DestroyBoolExpr(b)
    call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl",x,y))
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        call UnitDamageTarget(c,u,100*i,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_MAGIC,null)
        call GroupRemoveUnit(g,u)
    endloop
    call DestroyGroup(g)
    set c = null
    set g = null
    set u = null
    set b = null
endfunction

function Init_spell takes nothing returns nothing
    set gg_trg_spell = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_spell,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_spell,Condition( function trg_spell_Condition))
    call TriggerAddAction(gg_trg_spell,function trg_spell_Actions)
endfunction
 
Last edited:
Level 2
Joined
Jan 20, 2007
Messages
18
sry

sry im a total noob on jass but im getting there

BTW you jass trigger dont work :grin: 26 problems detected
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
26 problems detected can be caused by 1 problem so that number means nothing. . .

Well it passed the syntax check of jass shop pro so I thought it would work. . .
Guess I was wrong. . .

EDIT

I guess YOU WERE WRONG!!!

Your int function you renamed so it was refering to a non existed function. . .

Code:
function trg_spell_Condition takes nothing returns boolean
    return GetSpellAbilityId() == 'Aroc'
endfunction

function trg_spell_Pick_Condition takes nothing returns boolean
    return IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) == false and IsUnitType(GetFilterUnit(),UNIT_TYPE_MECHANICAL) == false and IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()),GetOwningPlayer(GetFilterUnit())) and GetWidgetLife(GetFilterUnit()) > 0.405
endfunction

function trg_spell_Actions takes nothing returns nothing
    local unit c = GetTriggerUnit() 
    local real y = GetUnitY(c)
    local real x = GetUnitX(c)
    local integer i = GetUnitAbilityLevel(c,'Aroc')
    local group g = CreateGroup()
    local unit u
    local boolexpr b = Condition(function trg_spell_Pick_Condition)
    call GroupEnumUnitsInRange(g,x,y,300*i,b)
    call DestroyBoolExpr(b)
    call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl",x,y))
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        call UnitDamageTarget(c,u,100*i,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_MAGIC,null)
        call GroupRemoveUnit(g,u)
    endloop
    call DestroyGroup(g)
    set c = null
    set g = null
    set u = null
    set b = null
endfunction

function InitTrig_spell takes nothing returns nothing
    set gg_trg_spell = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_spell,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_spell,Condition( function trg_spell_Condition))
    call TriggerAddAction(gg_trg_spell,function trg_spell_Actions)
endfunction

NOW it MUST work since it fully passes WE save with NO problems if you name the trigger "spell". . .
 
Last edited:
Status
Not open for further replies.
Top