| 03-06-2007, 08:52 PM | #1 |
Hi, im new to jass and i have got a problem. The trigger i have made with Blade.DKs tutorial for stomp + pushback doesnt work that right, it always shows up an error "Type missmatch in assignment". and yes, i have added the Code:
function H2I takes handle h returns integer
return h
return 0
endfunction
function I2G takes integer i returns group
return i
return null
endfunctionSo, the error marks this line blue: Code:
local gamecache gc = udg_AbilityCache So, here is the whole trigger, sorry if it is a nooby mistake, but it is my second spell and it is such a big one for my niveau. Hope you can help me! Cu Code:
function Trig_Stomp_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'AOw2'
endfunction
function Stomp_Filter takes nothing returns boolean
return IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()), GetOwningPlayer(GetFilterUnit())) and GetWidgetLife(GetFilterUnit()) > 0.405 and not IsUnitType(GetFilterUnit(), UNIT_TYPE_FLYING)
endfunction
function Stomp_CopyGroup takes group g returns group
set bj_groupAddGroupDest = CreateGroup()
call ForGroup(g, function GroupAddGroupEnum)
return bj_groupAddGroupDest
endfunction
function Stomp_Move takes nothing returns nothing
local string s = I2R(H2I(GetExpiredTimer()))
local gamecache gc = udg_AbilityCache
local real x = GetStoredReal (gc, s, "x")
local real y = GetStoredReal (gc, s ,"y")
local integer i = GetStoredInteger (gc, s ,"level")
local group g = Stomp_CopyGroup (I2R(GetStoredInteger (gc, s, "group")
local real dur = GetStoredReal (gc, s, "dur")+0.05
local real ux
local real uy
local real a
local unit f
if dur <1+0.5*i then
loop
set f = FFirstOfGroup(g)
exitwhen f==null
set ux = GetUnitX (f)
set uy = GetUnitY (f)
set a = Atan2(uy-y, ux-x)
call SetUnitPosition (f, ux+40*Cos(a), uy+40*sin(a))
call GroupRemoveUnit (g, f)
endloop
call StoreReal (gc, s, "dur", dur)
else
call DestroyGroup (I2G(GetStoredInteger(gc,s, "group")))
call FlushStoredMission (gc, s)
call DestroyTimer (GetExpiredTimer())
endif
call DestroyGroup (g)
set g = null
set f = null
endfunction
function Trig_Stomp_Actions takes nothing returns nothing
local unit c = GetTriggerUnit()
local real x = GetUnitX(c)
local real y = GetUnitY(c)
local integer i = GetUnitAbilityLevel(c, 'AOw2')
local boolexpr b = Condition ( function Stomp_Filter )
local group g = CreateGroup()
local group n
local unit f
local gamecache gc = udg_AbilityCache
local timer t = CreateTimer()
local string s = I2R(H2I(t))
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl", x, y))
call GroupEnumUnitsInRange(g, x, y, 100+50*i, b)
set n = Stomp_CopyGroup(g)
loop
set f = FirstOfGroup (n)
exitwhen f==null
call UnitDamageTarget (c, f, 25*i, true, false, ATTACK_TYPE_NORMAL , DAMAGE_TYPE_MAGIC, null)
call GroupRemoveUnit (n, f)
endloop
call StoreInteger(gc, s, "level", i)
call StoreInteger (gc, s, "group", H2I(g))
call StoreReal (gc, s , "x", x )
call StoreReal (gc, s, "y", y)
call TimerStart (t, 0.05, true, fucntion Stomp_Move)
set c = null
call DestroyBoolExpr (b)
set b = null
set g = null
call DestroyGroup (n)
set n = null
set f = null
set gc = null
endfunction
//===========================================================================
function InitTrig_Stomp takes nothing returns nothing
set gg_trg_Stomp = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Stomp, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Stomp, Condition( function Trig_Stomp_Conditions ) )
call TriggerAddAction( gg_trg_Stomp, function Trig_Stomp_Actions )
call Preload("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl")
endfunction
and before i wont post it, here is the GameCache Init-TriggeR: Code:
function InitTrig_InitCache takes nothing returns nothing
call FlushGameCache(InitGameCache("abilitycache.w3v"))
set udg_AbilityCache = InitGameCache("abilitycache.w3v")
endfunction |
| 03-06-2007, 09:05 PM | #2 |
That code has a few other errors. I suggest you use PJASS in conjuction with WE embedded preprocessor or a JASS editor to make syntax checking easier and faster. |
| 03-07-2007, 04:31 AM | #3 |
i downloaded Jass Shop Pro 2, made this script with it, but i think its the same like Pro Jass, just other name, isnt it? If not, im sorry, but if so, i really want to know how to use the syntax check -_-. im really sry for those noob-questions, but they are necessary^^ best wishes |
| 03-07-2007, 12:30 PM | #4 |
In Jass Shop Pro, go to Tools -> Syntax Check, a small panel will appear below the text editor with all the errors listed. |
| 03-07-2007, 07:39 PM | #5 |
So, for now i fixed a few typing mistakes, but i dont get why it marks Code:
local real dur = GetStoredReal(gc, s, "dur")+0.05 There shall be a syntax error in this line, too, but i dont find any1. And it always tells me that Code:
local gamecache gc = udg_AbilityCache I hope some1 can help me fixing these errors, thx for your patience best wishes, anX EDIT: Found all Errors, were wrong conversions (=convert X to X) because i sometimes typed convert i2r for example and nit i2g.... sin is a function and needs to have a big letter so "Sin" and "Cos" :) thx for helping me and for the tips, hope we will see us soon again^^ |
| 03-08-2007, 01:37 AM | #6 | ||
I'm wrong, nevermind.
|
| 03-08-2007, 02:30 AM | #7 |
Its the line above that line that's missing the ")". Actually its missing two of them. JASS:local group g = Stomp_CopyGroup (I2R(GetStoredInteger (gc, s, "group") local real dur = GetStoredReal (gc, s, "dur")+0.05 should be: JASS:local group g = Stomp_CopyGroup (I2R(GetStoredInteger (gc, s, "group"))) local real dur = GetStoredReal (gc, s, "dur")+0.05 |
| 03-08-2007, 01:05 PM | #8 |
Yes, as a future rule for syntax errors (not only in wc3, applies to external things too) syntax errors can only be picked up by the time the next line is reached, so if a line has an error reported and there's nothing wrong with it, check the line above it. |
