| 03-26-2010, 11:18 AM | #1 |
I'm a noob at JASS, though I have recently taken interest in it and seek to learn more about coding. Yesterday, I downloaded a couple of JASS-based spell maps. They open up in WE, but when I try to make even the slightest changes (or don't make any changes at all), it opens me an window with Scrip Error and listing out hundreds of compile errors. I can't even load up the map in WC3 to play it; there are no player bars in the menu below. Here's a screenshot to the 1st map. ![]() Here's the script to it: JASS:scope Impetus ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // * GLOBALS DEFINITIONS * // _______________________ // // >> Percent_Base -- The % of the distance covered by the spell's projectile to be dealt in damage to an enemy unit. By default, it is 0.04/0.08/0.12/0.16. // >> Max_Dmg -- The maximum damage the spell can deal. If you do not want a damage limitation, simply set this global to a huge number. // >> Texttag_Vlcty -- The speed in which the floating text moves at. // >> Texttag_Size -- The size of the floating text. // >> Texttag_Red -- The amount of the colour red to be used for the floating text. // >> Texttag_Green -- " " " green " " " ". // >> Texttag_Blue -- " " " blue " " " ". // >> Texttag_Trsprcy -- The transparency of the floating text. The higher the transparency, the less visible the text will be. // >> Texttag_Durtn -- The time the floating text is shown for until it is destroyed. // >> Cut_Off_Durtn -- If the spell has a high projectile speed, keep this value around 1-3. If it has a slow projectile speed (for ex, around 3-600), keep this value at around 10. It is not recommended to have a slow projectile speed at all. // >> Minimum_Mana -- **If you change the mana cost via object editor, match it here** The minimum mana required for the spell to take effect when on auto-cast mode. // >> Order_ID -- The order used when a unit turns on the auto-cast effects for the spell. To be matched via object editor, under, Text - Order String - Use/Turn On. // >> Un_Order_ID -- The order used when a unit turns off the auto-cast effects for the spell. To be matched via object editor, under, Text - Order String - Turn Off. // >> SFX -- The special effect to be created on an enemy affected by the spell. // >> SFX_Point -- The attachment point for the special effect to be created on. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// globals private constant integer Imp_ID = 'A000' private constant real Percent_Base = 0.04 private constant real Max_Dmg = 375 private constant real Texttag_Vlcty = 60 private constant real Texttag_Size = 10 private constant real Texttag_Red = 5 private constant real Texttag_Green = 80 private constant real Texttag_Blue = 85 private constant real Texttag_Trsprcy = 8 private constant real Texttag_Angle = 90 private constant real Texttag_Durtn = 1.25 private constant real Cut_Off_Durtn = 2.5 private constant real Minimum_Mana = 25 private constant string Order_ID = "flamingarrows" private constant string Un_Order_ID = "unflamingarrows" private constant string SFX = "Abilities\\Spells\\Orc\\FeralSpirit\\feralspiritdone.mdl" private constant string SFX_Point = "origin" endglobals struct Imp_Data unit U boolean b endstruct struct Imp_Data_2 unit u unit h triggeraction a real OX real OY endstruct private function Impetus_Conditions_2 takes nothing returns boolean local trigger t = GetTriggeringTrigger() local Imp_Data d = Imp_Data(GetHandleInt(t, "d")) if GetTriggerEventId() == EVENT_UNIT_SPELL_EFFECT and GetSpellAbilityId() == Imp_ID then return true elseif GetTriggerEventId() == EVENT_PLAYER_UNIT_ATTACKED and GetUnitAbilityLevel(GetAttacker(), Imp_ID) > 0 and d.b == true and IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) == false and GetAttacker() == d.U and GetUnitState(GetAttacker(), UNIT_STATE_MANA) >= Minimum_Mana and IsUnitEnemy(GetTriggerUnit(), GetOwningPlayer(GetAttacker())) then return true elseif GetTriggerEventId() == EVENT_UNIT_ISSUED_ORDER then if GetIssuedOrderId() == OrderId(Order_ID) then set d.b = true elseif GetIssuedOrderId() == OrderId(Un_Order_ID) then set d.b = false endif endif set t = null return false endfunction private function Impetus_Actions_3 takes nothing returns nothing local trigger x = GetTriggeringTrigger() local Imp_Data_2 D = Imp_Data_2(GetHandleInt(x, "D")) local real X2 = GetUnitX(D.h) local real Y2 = GetUnitY(D.h) local real dist = SquareRoot((X2-D.OX) * (X2-D.OX) + (Y2-D.OY) * (Y2-D.OY)) local real dmg = (GetUnitAbilityLevel(D.u, Imp_ID) * Percent_Base) * dist local texttag t if D.u == GetEventDamageSource() then if dmg > Max_Dmg then set dmg = Max_Dmg endif call TriggerRemoveAction(x, D.a) call FlushHandleLocals(x) call DestroyTrigger(x) call DestroyEffect(AddSpecialEffectTarget(SFX, D.h, SFX_Point)) call UnitDamageTarget(D.u, D.h, dmg, false, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_DIVINE, null) set t = CreateTextTagUnitBJ("+" + I2S(R2I(dmg)), D.h, Texttag_Vlcty, Texttag_Size, Texttag_Red, Texttag_Green, Texttag_Blue, Texttag_Trsprcy) call SetTextTagVelocityBJ(t, Texttag_Vlcty, Texttag_Angle) call SetTextTagPermanent(t, false) call SetTextTagLifespan(t, Texttag_Durtn) call D.destroy() endif set x = null set t = null endfunction private function Impetus_Actions_2 takes nothing returns nothing local trigger z = GetTriggeringTrigger() local Imp_Data d = Imp_Data(GetHandleInt(z, "d")) local Imp_Data_2 D = Imp_Data_2.create() local trigger x = CreateTrigger() if GetTriggerEventId() == EVENT_UNIT_SPELL_EFFECT then set D.h = GetSpellTargetUnit() else set D.h = GetTriggerUnit() endif set D.u = d.U set D.OX = GetUnitX(D.u) set D.OY = GetUnitY(D.u) call TriggerRegisterUnitEvent(x, D.h, EVENT_UNIT_DAMAGED) set D.a = TriggerAddAction(x, function Impetus_Actions_3) call SetHandleInt(x, "D", D) //Safety call PolledWait(Cut_Off_Durtn) call TriggerRemoveAction(x, D.a) call FlushHandleLocals(x) call DestroyTrigger(x) call D.destroy() // set z = null set x = null endfunction private function Impetus_Actions takes nothing returns nothing local unit u = GetTriggerUnit() local trigger t local Imp_Data d if GetUnitAbilityLevel(u, Imp_ID) == 1 then set d = Imp_Data.create() set d.U = u set d.b = false set t = CreateTrigger() call TriggerRegisterUnitEvent(t, d.U, EVENT_UNIT_ISSUED_ORDER) call TriggerRegisterUnitEvent(t, d.U, EVENT_UNIT_SPELL_EFFECT) call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ATTACKED) call TriggerAddCondition(t, Condition(function Impetus_Conditions_2)) call TriggerAddAction(t, function Impetus_Actions_2) call SetHandleInt(t, "d", d) set t = null endif set u = null endfunction private function Impetus_Conditions takes nothing returns boolean return GetLearnedSkill() == Imp_ID endfunction function InitTrig_Impetus takes nothing returns nothing local trigger t = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_HERO_SKILL) call TriggerAddCondition(t, Condition(function Impetus_Conditions)) call TriggerAddAction(t, function Impetus_Actions) set t = null endfunction endscope And here's the 2nd. ![]() I won't post the script to the 2nd map, because it has several spells in it and will take too much time. Somehow, I have the feeling that I am either doing something wrong, or my WE is malfunctioning. Also, there are Local Handle Vars in the maps, if this info is going to help you find an answer more quickly. I will be most thankful if you could help me solve this problem. Thank you very much in advance! |
| 03-26-2010, 10:28 PM | #2 |
Are you using the NewGen editor to open the maps? The spells seem to be written in vJass so the regular WC3 World Editor can not compile them. If you can not open the maps ingame even if you do not open them in the editor first, then I do not know what the problem could be. |
| 03-27-2010, 10:32 AM | #3 |
For the Impetus: You seem to use the standard Wc3 Worldeditor. The Impetus Spell uses vJass features. vJass is a Jass extention, which adds many useful features; however, the standard world editor cannot handle it. You need a special compiler for it, the JassHelper. Usually you use the Jass Newgen Package, which is basically an extended world editor including the Jasshelper. You might also want to have a look at this tutorial. You mentioned some of the spells use HandleVars: HandleVars is an out-dated script, which does not work with warcraft versions 1.24 and above. You can try to use Faux Handle Vars instead. Also I have to mention the Impetus spell seems to use dynamic triggers pretty carelessly, which is usually a no-go among map makers, because there is a bug with the DestroyTrigger native, which can cause a handle stack corruption bug, which can produce several errors up to crashing your map under some circumstances. I recommend to not use this spell. Look for a version, which requires a damage detection system. |
