| 06-05-2006, 01:22 AM | #1 |
I need to thank The)TideHunter( for the original JASS code, which I changed after modding my GUI. Could anyone please check these 2 JASS codes for problems? I'm a JASS noob, and I just basically copied what Tide had put in. Here's the 2 spells. Fire Bolt JASS:function Trig_Fire_Bolt_Backup_Conditions takes nothing returns boolean if ( not ( GetSpellAbilityId() == 'A001' ) ) then return false endif return true endfunction function Trig_Fire_Bolt_Backup_Actions takes nothing returns nothing local location ll = GetSpellTargetLoc() local effect SFX3 = AddSpecialEffectTagetUnitBJ( "origin", "Doodads\\Cinematic\\Lightningbolt\\Lightningbolt.mdl" ), GetLocationX(ll), GetLocationY(ll) call PauseUnitBJ( true, GetTriggerUnit() ) call PauseUnitBJ( true, GetSpellTargetUnit() ) call UnitDamageTargetBJ( GetTriggerUnit(), GetSpellTargetUnit(), 500, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE ) call DestroyEffect(SFX3) call PauseUnitBJ( false, GetTriggerUnit() ) call PauseUnitBJ( false, GetSpellTargetUnit() ) call RemoveLocation(ll) set SFX3 = null set ll = null endfunction //=========================================================================== function InitTrig_Fire_Bolt_Backup takes nothing returns nothing set gg_trg_Fire_Bolt_Backup = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Fire_Bolt_Backup, EVENT_PLAYER_UNIT_SPELL_CAST ) call TriggerAddCondition( gg_trg_Fire_Bolt_Backup, Condition( function Trig_Fire_Bolt_Backup_Conditions ) ) call TriggerAddAction( gg_trg_Fire_Bolt_Backup, function Trig_Fire_Bolt_Backup_Actions ) endfunction Hot Ice JASS:function Trig_Hot_Ice_JASS_2_Conditions takes nothing returns boolean if ( not ( GetSpellAbilityId() == 'A002' ) ) then return false endif return true endfunction function Trig_Hot_Ice_JASS_2_Actions takes nothing returns nothing local timer t = CreateTimer() local location l = GetSpellTargetLoc() local effect SFX1 = AddSpecialEffect("Doodads\\Cinematic\\TownBurningFireEmitterBlue\\TownBurningFireEmitterBlue.mdl" GetLocationX(l), GetLocationY(l)) local effect SFX2 = AddSpecialEffect("Doodads\\Cinematic\\TownBurningFireEmitter\\TownBurningFireEmitter.mdl" GetLocationX(l), GetLocationY(l)) call PauseUnitBJ( true, GetTriggerUnit() ) call PauseUnitBJ( true, GetSpellTargetUnit() ) call UnitDamageTargetBJ( GetTriggerUnit(), GetSpellTargetUnit(), 250.00, ATTACK_TYPE_SPELL, DAMAGE_TYPE_COLD ) call PauseUnitBJ( false, GetTriggerUnit() ) call PauseUnitBJ(false, GetSpellTargetUnit() ) call TimerStart(t, 3., false, null) loop exitwhen (TimerGetRemaining(t) == 0.) call UnitDamageTargetBJ( GetTriggerUnit(), GetSpellTargetUnit(), 35.00, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_FIRE ) call TriggerSleepAction(0.1) endloop call DestroyTimer(t) call DestroyEffect(SFX1) call DestroyEffect(SFX2) call RemoveLocation(l) set t = null set SFX1 = null set SFX2 = null set l = null endfunction //=========================================================================== function InitTrig_Hot_Ice_JASS_2 takes nothing returns nothing set gg_trg_Hot_Ice_JASS_2 = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Hot_Ice_JASS_2, EVENT_PLAYER_UNIT_SPELL_CAST ) call TriggerAddCondition( gg_trg_Hot_Ice_JASS_2, Condition( function Trig_Hot_Ice_JASS_2_Conditions ) ) call TriggerAddAction( gg_trg_Hot_Ice_JASS_2, function Trig_Hot_Ice_JASS_2_Actions ) endfunction I'm pretty sure these are OK, but you neevr know, do ya? (If your me that is ) |
| 06-05-2006, 01:57 AM | #2 |
Erm, are you looking for criticism or checking for errors? I don't notice any errors. As long as there's no problem with leaving your real values as ( 3. ) instead of ( 3.0 ) I don't think there's anything wrong. I would advise assigning the spell target unit in the ice spell to a local variable, since, unless I'm mistaken, the global variables related to abilities are not thread-specific meaning there could be some instanceability issues. The Firebolt thing appears to be working, though it works as soon as the unit casts, so if there's a missile, the damage will be applied before the missile hits. One last thing, I have no idea what you're doing with the PauseUnit functions... Pausing and unpausing a unit without a wait seems rather pointless doesn't it? |
| 06-05-2006, 02:24 AM | #3 |
He thinks that you need to pause the unit in case he dies during the trigger's execution time ><. Which you don't need to do (someone told you this in that other thread). Think of the trigger as running instantly. It would be well under a millisecond that it runs, so he's not going to die during it. Sooo you can take out all the PauseUnitBJ()'s. |
| 06-05-2006, 02:29 AM | #4 |
OVerall these spells are ok. However, i dont really understand the rationale beinhd pausing the two units in the first spell. The conditions could just simply be put as JASS:function Trig_Fire_Bolt_Backup_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A001' endfunction You can use the native JASS:native UnitDamageTarget takes unit whichUnit, widget target, real amount, boolean attack, boolean ranged, attacktype attackType, damagetype damageType, weapontype weaponType returns boolean instead of the BJ version where the weapontype is WEAPON_TYPE_WHOKNOWS If you insist on pausing the unit, then i suggest u remove the useless BJ behind the PauseUnitBJ and swap the values inside the parenthesis. JASS:call PauseUnit(GetTriggerUnit(), true) I think your special effect is wrong. It doesnt call for real x and real y. And i dont understand why there are commas after the parenthesis. it should be JASS:call AddSpecialEffectTarget "Doodads\\Cinematic\\Lightningbolt\\Lightningbolt.mdl", GetSpellTargetUnit(), "origin") So for the second spell, i am assuming that you want to dmage the target twice, once when the spell is cast and once after 3 seconds. The it's ok since you are not using handles That's all i can find |
| 06-05-2006, 02:31 AM | #5 |
OK, no more pause *rips pauses out w/ hands*. How do I set the unit to a local like you wanted? @sheep.Spirit. Ok, you've seriously confused me beyond any comprehension. Please take into considertion, as stated in ym first post, I am a JASS noob, so I don't understand any of what you are saying, other than the pauses, which I;ve decided to get rid of. The Hot Ice spell is supposed to damage the target unit over 15 seconds, every 3 seconds it takes damage. What makes my speical effect wrong? I put the X and Y reals in to make sure it had the location correct, but if those can be ripped I'll take them out. And actually, when I wwent from GUI to JASS, the speical effect came as it is, so I don't see how that could be wrong. |
| 06-05-2006, 02:40 AM | #6 |
Oh, I thought he wanted to do 250 initial damage and then 1050 damage over 3 seconds, though it works I think handle variables woudl be better. JASS:local unit spellTargetUnit = GetSpellTargetUnit() Put that with the other locals and replace any other GetSpellTargetUnit() with spellTargetUnit. Edit: I think by wrong special effect, he means that the fire won't follow the unit unless it's attached. Also, if you want it want it to deal damage every 3 seconds for 15 seconds, then you're timer should be for 15 seconds and the wait for 3 seconds. |
| 06-05-2006, 02:43 AM | #7 |
Ok, Ive got a really big problem. According to WE, My 2 spells have a ton of errors. I don't know how! Makes no sense... If you guys can't seee anything, how come WE is picking up like 500000 errors??? I'm gonna post the erros it finds, I don't know how to fix them. THIS IS THE FIRE BOLT SPELL. Expected a name: JASS:local effect SFX3 = AddSpecialEffectTagetUnitBJ( "origin", "Doodads\\Cinematic\\Lightningbolt\\Lightningbolt.mdl" ), GetLocationX(ll), GetLocationY(ll) Expected a name: JASS:call DestroyEffect(SFX3) Expected a variable name: JASS:set SFX3 = null Expected a code statement: JASS:set ll = null Expected a code statement: (this one really makes no sense) JASS://===========================================================================Expected a code statement: JASS:call TriggerAddAction( gg_trg_Fire_Bolt_Backup, function Trig_Fire_Bolt_Backup_Actions ) I don't get it! |
| 06-05-2006, 02:56 AM | #8 |
Pardon Moderators for the double post but It's a lot more organized if I put this in a second post. THIS IS FOR THE ICE SPELL. Expected ': JASS:local effect SFX1 = AddSpecialEffect("Doodads\\Cinematic\\TownBurningFireEmitterBlue\\TownBurningFireEmitterBlue.mdl" GetLocationX(l), GetLocationY(l)) Expected ': JASS:local effect SFX2 = AddSpecialEffect("Doodads\\Cinematic\\TownBurningFireEmitter\\TownBurningFireEmitter.mdl" GetLocationX(l), GetLocationY(l)) Expected a name: JASS:call UnitDamageTargetBJ( GetTriggerUnit(), GetSpellTargetUnit(), 250.00, ATTACK_TYPE_SPELL, DAMAGE_TYPE_COLD ) Expected a name: JASS:call DestroyEffect(SFX1) Expected a name: JASS:call DestroyEffect(SFX2) Expected a variable name: JASS:set SFX1 = null Expected a variable name: JASS:set SFX2 = null Expected an 'endloop' But I;ve got an endloop! Right after my loop! WTF Expected an 'endloop' JASS://===========================================================================Expected an 'endloop' JASS:call TriggerAddAction( gg_trg_Hot_Ice_JASS_2, function Trig_Hot_Ice_JASS_2_Actions ) I really really really suck at triggers... GAH *sobs* Could somebody modify the code to make it work (not fix the erros) in that the unit takes 35 damage every 3 seconds for over 15 seconds? Please? |
| 06-05-2006, 04:12 AM | #9 |
Always ignore all the errors but the first one. Also the error's line is usually wrong and can be either the first one or the second one. Seems you forgot a ) at the end of the first error line . Else the error is caused by the previous or next line |
| 06-05-2006, 01:34 PM | #10 |
On the very first one of the first error post, you mispelled Target as Taget. Should be AddSpecialEffectTargetUnitBJ. And as Vex said, it seems you're missing a ). |
| 06-05-2006, 03:00 PM | #11 |
On the line: JASS:local effect SFX3 = AddSpecialEffectTagetUnitBJ( "origin", "Doodads\\Cinematic\\Lightningbolt\\Lightningbolt.mdl" ), GetLocationX(ll), GetLocationY(ll) You have a few problems, your using AddEffectToUnit, and passing in real X and real Y for a location, so i changed it a bit, you dont need the "origin", because a location dosent posses bone names, and i removed the GetLocationX/Y, because your targeting its targeting a location. To make the effect at a location use: JASS:local effect SFX = AddSpecialEffectLoc("Doodads\\Cinematic\\Lightningbolt\\Lightningbolt.mdl", ll) To make the effect on a unit use: JASS:local effect SFX = AddSpecialEffectTarget("Doodads\\Cinematic\\TownBurningFireEmitterBlue\\TownBurningFireEmitterBlue.mdl", GetSpellAbilityUnit(), "origin") |
| 06-05-2006, 07:20 PM | #12 |
...thank you all... I thought my spell was a huge train wreck... Just turns out it as a few typos (and the getlocationX/Y Thanks again guys. I guess I should have proofread my work. I'll fix up my code and let you guys know how it turns out. EDIT: YAY! Everyone dance now! ..OK I'll stop... Well, I'm happy to announce that the JASS code no longer has errors. I'll post them one last time to make sure I have them written for the desired effect. But before I do, I need to ask a question that I;ve asked 10 million times and never received an answer to. IS A BUILDING A UNIT OR NOT??? :) been asking this since my test, In which the towers did nothing when they used the spell. Oh, and do I need to put anything in the spell's data? (like damage, missles, etc.) Becuase I put those all to zero or blank, except fot range, ande maybe something else, i;m not sure. Fire Bolt: Lightnign appears at origin of unit, takes 500 damage, lightning bolt destroyed, SFX3 set to null. JASS:function Trig_Fire_Bolt_Backup_Conditions takes nothing returns boolean if ( not ( GetSpellAbilityId() == 'A001' ) ) then return false endif return true endfunction function Trig_Fire_Bolt_Backup_Actions takes nothing returns nothing local effect SFX3 = AddSpecialEffectTarget("Doodads\\Cinematic\\Lightningbolt\\Lightningbolt.mdl", GetSpellAbilityUnit(), "origin") call UnitDamageTargetBJ( GetTriggerUnit(), GetSpellTargetUnit(), 500, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE ) call DestroyEffect(SFX3) set SFX3 = null endfunction //=========================================================================== function InitTrig_Fire_Bolt_Backup takes nothing returns nothing set gg_trg_Fire_Bolt_Backup = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Fire_Bolt_Backup, EVENT_PLAYER_UNIT_SPELL_CAST ) call TriggerAddCondition( gg_trg_Fire_Bolt_Backup, Condition( function Trig_Fire_Bolt_Backup_Conditions ) ) call TriggerAddAction( gg_trg_Fire_Bolt_Backup, function Trig_Fire_Bolt_Backup_Actions ) endfunction Hot Ice: Fire (blue and red) appear at the unit's location, unit takes 250 damage, then a timer for 15 seconds kicks in, and a loop starts. Unit takes 35 damage, and the timer sleeps for 3 seconds, repeat. (I think that's what it does) Destroy fires, kill timer, kill location, null all. JASS:function Trig_Hot_Ice_JASS_2_Conditions takes nothing returns boolean if ( not ( GetSpellAbilityId() == 'A002' ) ) then return false endif return true endfunction function Trig_Hot_Ice_JASS_2_Actions takes nothing returns nothing local timer t = CreateTimer() local location l = GetSpellTargetLoc() local effect SFX1 = AddSpecialEffectLoc("Doodads\\Cinematic\\TownBurningFireEmitterBlue\\TownBurningFireEmitterBlue.mdl", l) local effect SFX2 = AddSpecialEffectLoc("Doodads\\Cinematic\\TownBurningFireEmitter\\TownBurningFireEmitter.mdl", l) call UnitDamageTargetBJ( GetTriggerUnit(), GetSpellTargetUnit(), 250.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_COLD ) call TimerStart(t, 15., false, null) loop exitwhen (TimerGetRemaining(t) == 0.) call UnitDamageTargetBJ( GetTriggerUnit(), GetSpellTargetUnit(), 35.00, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_FIRE ) call TriggerSleepAction(3.0) endloop call DestroyTimer(t) call DestroyEffect(SFX1) call DestroyEffect(SFX2) call RemoveLocation(l) set t = null set SFX1 = null set SFX2 = null set l = null endfunction //=========================================================================== function InitTrig_Hot_Ice_JASS_2 takes nothing returns nothing set gg_trg_Hot_Ice_JASS_2 = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Hot_Ice_JASS_2, EVENT_PLAYER_UNIT_SPELL_CAST ) call TriggerAddCondition( gg_trg_Hot_Ice_JASS_2, Condition( function Trig_Hot_Ice_JASS_2_Conditions ) ) call TriggerAddAction( gg_trg_Hot_Ice_JASS_2, function Trig_Hot_Ice_JASS_2_Actions ) endfunction |
| 06-06-2006, 03:38 AM | #13 |
Haha, didnt know i would confuse you so badly. Actually, u have already did quite a good job on this. However, several things to fix for this spells. (Actually, firebolt could just be based on stormbolt or finger of death) JASS:function Trig_Fire_Bolt_Backup_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A001' endfunction function Trig_Fire_Bolt_Backup_Actions takes nothing returns nothing local unit u = GetTriggerUnit() local unit t = GetSpellTargetUnit() // These are to make the spell look better and to minimise the possibility of spelling mistakes. local effect SFX3 = AddSpecialEffectTarget("Doodads\\Cinematic\\Lightningbolt\\Lightningbolt.mdl", u, "origin") call UnitDamageTarget( u, tu, 500., true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE, WEAPON_TYPE_WHOKNOWS) call DestroyEffect(SFX3) set SFX3 = null set u = null // set these to null if you had added the variables for the units set t = null endfunction //=========================================================================== function InitTrig_Fire_Bolt_Backup takes nothing returns nothing set gg_trg_Fire_Bolt_Backup = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Fire_Bolt_Backup, EVENT_PLAYER_UNIT_SPELL_CAST ) call TriggerAddCondition( gg_trg_Fire_Bolt_Backup, Condition( function Trig_Fire_Bolt_Backup_Conditions ) ) call TriggerAddAction( gg_trg_Fire_Bolt_Backup, function Trig_Fire_Bolt_Backup_Actions ) endfunction This is for the firebolt spell As for the icespell JASS:function Trig_Hot_Ice_JASS_2_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A002' endfunction function Trig_Hot_Ice_JASS_2_Actions takes nothing returns nothing local timer t = CreateTimer() local location l = GetSpellTargetLoc() local unit u = GetTriggerUnit() local unit tu = GetSpellAbilityUnit() local effect SFX1 = AddSpecialEffectLoc("Doodads\\Cinematic\\TownBurningFireEmitterBlue\\TownBurningFireEmitterBlue.mdl", l) local effect SFX2 = AddSpecialEffectLoc("Doodads\\Cinematic\\TownBurningFireEmitter\\TownBurningFireEmitter.mdl", l) call UnitDamageTarget( u, tu, 250., true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_COLD, WEAPON_TYPE_WHOKNOWS) call TimerStart(t, 15., false, null) loop exitwhen (TimerGetRemaining(t) == 0.) call UnitDamageTarget( u, tu, 35., true, true, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_FIRE, WEAPON_TYPE_WHOKNOWS) call PolledWait(3.0) endloop call DestroyTimer(t) call DestroyEffect(SFX1) call DestroyEffect(SFX2) call RemoveLocation(l) set t = null set SFX1 = null set SFX2 = null set l = null set tu = null set u = null endfunction //=========================================================================== function InitTrig_Hot_Ice_JASS_2 takes nothing returns nothing set gg_trg_Hot_Ice_JASS_2 = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Hot_Ice_JASS_2, EVENT_PLAYER_UNIT_SPELL_CAST ) call TriggerAddCondition( gg_trg_Hot_Ice_JASS_2, Condition( function Trig_Hot_Ice_JASS_2_Conditions ) ) call TriggerAddAction( gg_trg_Hot_Ice_JASS_2, function Trig_Hot_Ice_JASS_2_Actions ) endfunction Think that's it, if you encounter more problems, you can pst here again Edit: preloading helps alot too. Good luck! |
| 06-06-2006, 03:58 AM | #14 |
Ok, thx for the improvement changes, I'll plug them right in. I'm just wondering, in order to improve my understanding of JASS, how did your changes improve the spell? O, and what's preloading? EDIT: +rep : ) |
| 06-06-2006, 04:09 AM | #15 |
Its not really pre-loading in the sense that you load something before you play it because you really actually preload after you enter the map buts its the same concept. You know the lag you get when you first cast a spell or spawn a unit or etc... Instead of having that lag occur during the middle of an intense game, many people cast the spell or make and remove the unit instnatly at the beginning of the game so that any lag that may occur is done and over with. |
