| 10-21-2006, 09:04 AM | #1 |
Ok, the spell worked before i changed the condition function (Trap_Damage_Filter), now JassCraft can't find anything wrong with it, but World Editor finds 60 errors... Can you please tell me whats wrong? JASS:function Trig_Activate_Trap_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A002' endfunction function Trap_Damage_Filter takes nothing returns boolean if (IsUnitSpellImmune(GetFilterUnit())) then return false else return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) endif endfunction function Trig_Activate_Trap_Actions takes nothing returns nothing local unit caster = GetTriggerUnit() local group traps = GetUnitsOfPlayerAndTypeId(GetOwningPlayer(caster), 'e002') local unit currentTrap local group damageGroup local unit currentDamageUnit local location trapLocation local boolexpr condition = Condition(function Trap_Damage_Filter) loop set currentTrap = FirstOfGroup(traps) set trapLocation = GetUnitLoc(currentTrap) call RemoveUnit(currentTrap) call GroupRemoveUnit(traps, currentTrap) set damageGroup = GetUnitsInRangeOfLocMatching(200, trapLocation, condition) call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\Bolt\\BoltImpact.mdl", GetUnitX(currentTrap), GetUnitY(currentTrap))) loop set currentDamageUnit = FirstOfGroup(damageGroup) call UnitDamageTarget(currentTrap, currentDamageUnit, 30+(20*GetUnitAbilityLevel(caster, 'A000')), false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS) call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\Impale\\ImpaleMissTarget.mdl", GetUnitX(currentDamageUnit), GetUnitY(currentDamageUnit))) call GroupRemoveUnit(damageGroup, currentDamageUnit) exitwhen currentDamageUnit == null endloop call RemoveLocation(trapLocation) set trapLocation = null exitwhen currentTrap == null endloop set caster = null call DestroyGroup(traps) set traps = null call DestroyGroup(damageGroup) set damageGroup = null set condition = null endfunction //=========================================================================== function InitTrig_Activate_Trap takes nothing returns nothing set gg_trg_Activate_Trap = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Activate_Trap, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Activate_Trap, Condition( function Trig_Activate_Trap_Conditions ) ) call TriggerAddAction( gg_trg_Activate_Trap, function Trig_Activate_Trap_Actions ) call Preload("Abilities\\Spells\\Undead\\Impale\\ImpaleMissTarget.mdl") call Preload("Abilities\\Weapons\\Bolt\\BoltImpact.mdl") endfunction |
| 10-21-2006, 09:23 AM | #2 |
Assuming there exists a IsUnitSpellImmune function in your .j script, there should be no problems. |
| 10-21-2006, 09:37 AM | #3 |
Well, i found the IsUnitSpellImmune in JassCraft, in the list of functions... It's just very weird, because before i changed the condition to also check about spell immunity, im not allowed to save, because WE thinks there is something wrong... But i can't find it myself either . Someone must be able to find an error!EDIT: I found another way to do it, so NVM... But + rep to you for helping, i found out that the IsUnitSpellImmune function must have been from caster system :P So now i used something else, thanks alot! |
| 10-21-2006, 11:06 AM | #4 | |
Quote:
You must have a return, not in a if statement if that function returns something. Persuming you want a filter that checks if a unit is spell immune and a enemy, use this: JASS:function Trap_Damage_Filter takes nothing returns boolean return (IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) and IsUnitSpellImmune(GetFilterUnit())) endfunction Make sure you have a function called IsUnitSpellImmune like blu said, theyre isent one in common.j |
| 10-21-2006, 11:54 AM | #5 | |
Quote:
Yes, I assumed as much. If you want to turn off the searching from the Caster System, click on 'Show Options' at the bottom of the native list and uncheck the Caster System box in the 'Search In:' list. Can save you some annoyance in such cases. |
| 10-21-2006, 06:10 PM | #6 |
Btw your loop is not that good. It will loop n+1 times, n being the initial numbers of units in your group and +1 becuase of the wrong psosition of exitwhen. The exitwhen must be always placed after setting a variable to FirstOfGroup. You must destroy the boolexpr at the end of the function. And what the hell are you doing there? JASS:
set currentTrap = FirstOfGroup(traps)
set trapLocation = GetUnitLoc(currentTrap)
//*************************
call RemoveUnit(currentTrap)//REMOVE IT
//*************************
call GroupRemoveUnit(traps, currentTrap)Btw. IsUnitSpellImmune was left in CS for compatibility(?) and can easily be reaplced by JASS:IsUnitType(whichunit,UNIT_TYPE_SPELL_IMMUNE)!=null |
| 10-22-2006, 07:48 AM | #7 |
Thanks for the help all, will change the loop. Didn't notice . I'm still kind of new to JASS, so i might do some silly mistakes. |
