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

Need help in my spell

Status
Not open for further replies.
Level 3
Joined
Aug 29, 2016
Messages
56
Hello, so i decided to create a spell like this, this is my first time making think kind of spell.

So the problem is, i can't remove a lightning effect.I used point with polar offset to create the lightning effect, is there any other way i can remove it?

My Spell
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Soul_Shock
Actions
Wait 0.01 seconds
Set Caster = (Triggering unit)
Set Cas_Loc = (Position of Caster)
Set Damage[1] = (20.00 x (Real((Level of Soul_Shock for Caster))))
Set Damage[2] = (30.00 x (Real((Level of Soul_Shock for Caster))))
Set Damage[3] = (40.00 x (Real((Level of Soul_Shock for Caster))))
Set DmgType = Normal
Set AttkType = Spells
Set Radius[1] = 500.00
Set Radius[2] = 600.00
Set Radius[3] = 700.00
For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
Set EffectRange[1] = (Cas_Loc offset by Radius[1] towards ((Real((Integer A))) x 40.00) degrees)
Set EffectRange[2] = (Cas_Loc offset by Radius[2] towards ((Real((Integer A))) x 40.00) degrees)
Set EffectRange[3] = (Cas_Loc offset by Radius[3] towards ((Real((Integer A))) x 40.00) degrees)
Set Soul = Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
Set Summon = Abilities\Spells\Undead\Unsummon\UnsummonTarget.mdl
Unit - Pause Caster
Special Effect - Create a special effect attached to the overhead of Caster using Summon
Set SpecialEff = (Last created special effect)
Trigger - Turn on Dmg <gen>
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Soul_Shock for Caster) Equal to 1
Then - Actions
For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Then - Actions
Unit - Create 1 Peasant for (Owner of Caster) at (Cas_Loc offset by Radius[1] towards ((Real((Integer A))) x 40.00) degrees) facing Default building facing degrees
Set Dummy = (Last created unit)
Animation - Play Dummy's birth animation
Unit - Add a 7.60 second Generic expiration timer to Dummy
Lightning - Create a Chain Lightning - Primary lightning effect from source Cas_Loc to target (Cas_Loc offset by Radius[1] towards ((Real((Integer A))) x 40.00) degrees)
Lightning - Change color of (Last created lightning effect) to (1.00 1.00 0.00) with 1.00 alpha
Set LightEffct = (Last created lightning effect)
Else - Actions
Wait 7.00 seconds
Trigger - Turn off Dmg <gen>
Unit - Unpause Caster
Special Effect - Destroy SpecialEff
Animation - Play Dummy's death animation
Special Effect - Destroy SpecialEff
Custom script: call RemoveLocation( udg_Cas_Loc )
Lightning - Destroy LightEffct
Else - Actions


Since i don't know how to add that trigger picture thing, im gonna add this sorry for that. :(
 
Level 3
Joined
Aug 29, 2016
Messages
56
Does it work if you remove the wait?
No, it doesn't remove the lightning and also the dummy
I've tried using Countdown timer, also doesnt work

I guess removing lightning that was created on point with polar offset is hard,,
BUT i'll do some experimenting to see if it will remove the lightning.Btw , I was also thinking of creating a dummy with Life Drain Ability and make it cast on Dummy(I would also change the lighting effect but the catch is I can't Change the color of the lighting :( ) but not considering the catch, is it ok to do?
 
Level 13
Joined
May 10, 2009
Messages
868
It's a little bit difficult to know what's inside or outside those For each (Integer A) loops.


  • For each (Integer A) from 1 to 10, do (Actions)
  • Loop - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • Then - Actions
      • Unit - Create 1 Peasant for (Owner of Caster) at (Cas_Loc offset by Radius[1] towards ((Real((Integer A))) x 40.00) degrees) facing Default building facing degrees
      • Set Dummy = (Last created unit)
      • Animation - Play Dummy's birth animation
      • Unit - Add a 7.60 second Generic expiration timer to Dummy
      • Lightning - Create a Chain Lightning - Primary lightning effect from source Cas_Loc to target (Cas_Loc offset by Radius[1] towards ((Real((Integer A))) x 40.00) degrees)
      • Lightning - Change color of (Last created lightning effect) to (1.00 1.00 0.00) with 1.00 alpha
      • Set LightEffct = (Last created lightning effect)
    • Else - Actions
  • Wait 7.00 seconds
  • Trigger - Turn off Dmg <gen>
  • Unit - Unpause Caster
  • Special Effect - Destroy SpecialEff
  • Animation - Play Dummy's death animation
  • Special Effect - Destroy SpecialEff
  • Custom script: call RemoveLocation( udg_Cas_Loc )
  • Lightning - Destroy LightEffct

Well, the problem is that you're creating 10 lightning effects, but you're registering one of them (the last one). That's why you can't remove all of them. Your variable must be an array one. Then you do this

  • Set LightEfct[Integer A] = (Last created lightning effect)
In the end, you'll have to do another loop removing those lightning effects. However, keep in mind that your spell is not MUI, so if two units cast the spell at the same time, the first one that cast it won't have their lightning effects removed.
 
Level 3
Joined
Aug 29, 2016
Messages
56
In the end, you'll have to do another loop removing those lightning effects. However, keep in mind that your spell is not MUI, so if two units cast the spell at the same time, the first one that cast it won't have their lightning effects removed.

I did not really understood how to remove those lightnings in a loop, can you do a sample trigger?
 
Level 3
Joined
Aug 29, 2016
Messages
56
Here's what he does, it damages enemies inside, You can see the lightning effect there.
 

Attachments

  • untitled.JPG
    untitled.JPG
    174.1 KB · Views: 60

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,195
For every lightning effect that is created the lightning effect needs to be destroyed. This means that a reference to each lightning created needs to be stored in a variable for its duration so it can be referenced and destroyed after the duration ends.

As BloodSoul has pointed out, you are probably storing a reference to just 1 of the 10 created lightning effects.
 
Level 13
Joined
May 10, 2009
Messages
868
I ended up remaking it entirely. However, Dr. Super Good did that change and fixed the problem related to those lightning effects not being destroyed.

Anyway, I'll post it, because it's now MUI.
 

Attachments

  • SoulShock.w3x
    27.4 KB · Views: 43
Level 3
Joined
Aug 29, 2016
Messages
56
Thank you guys for your efforts, btw im thinking of uploading the spell and I'm gonna give credits to you guys.


EDIT: i will upload the MUI one, but i will use the other one on my map(im still gonna make it tho) cause there wont be the same heroes or spells used.To be fair.
 
Level 13
Joined
May 10, 2009
Messages
868
Well, I didn't expect that...

In that case, here's some more improvements that would be nice to have in your spell:
-Change the spell to channeling "mode", so it would be possible to stop a caster with stuns or something like that. Right now, your spell only pauses casters, and they only stop when they die or finish casting it.
-Allow users to modify the lightning height for both caster and special effect side. For that, you have to change this function

  • Lightning - Create a SS_Lightning_Type lightning effect from source tpoint[0] to target tpoint[1]
to this:
JASS:
AddLightningEx takes string codeName, boolean checkVisibility, real x1, real y1, real z1, real x2, real y2, real z2 returns lightning
 
Last edited:
Level 3
Joined
Aug 29, 2016
Messages
56
Well, I didn't expect that...

In that case, here's some more improvements that would be nice to have in your spell:
-Change the spell to channeling "mode", so it would be possible to stop a caster with stuns or something like that. Right now, your spell only pauses casters, and they only stop when they die or finish casting it.
-Allow users to modify the lightning height for both caster and special effect side. For that, you have to change this function

  • Lightning - Create a SS_Lightning_Type lightning effect from source tpoint[0] to target tpoint[1]
to this:
JASS:
AddLightningEx takes string codeName, boolean checkVisibility, real x1, real y1, real z1, real x2, real y2, real z2 returns lightning

uhh, I can't read vJass
 
Level 13
Joined
May 10, 2009
Messages
868
uhh, I can't read vJass

Not exactly, that's just JASS. You can use it as a custom script in a GUI trigger. It would be something like this:

  • Custom script: set udg_SS__lightning[udg_int[2]] = AddLightningEx(udg_SS_Lightning_Type, false, GetLocationX(udg_tpoint[0]), GetLocationY(udg_tpoint[0]), GetLocationZ(udg_tpoint[0])+VAR_CasterHeight, GetLocationX(udg_tpoint[1]), GetLocationY(udg_tpoint[1]), GetLocationZ(udg_tpoint[1])+VAR_TombHeight)
However, I'll tell you to not do this anymore, because if you write around 256 characters in a custom script, that will crash your editor.
 
Level 3
Joined
Aug 29, 2016
Messages
56
Not exactly, that's just JASS. You can use it as a custom script in a GUI trigger. It would be something like this:

  • Custom script: set udg_SS__lightning[udg_int[2]] = AddLightningEx(udg_SS_Lightning_Type, false, GetLocationX(udg_tpoint[0]), GetLocationY(udg_tpoint[0]), GetLocationZ(udg_tpoint[0])+VAR_CasterHeight, GetLocationX(udg_tpoint[1]), GetLocationY(udg_tpoint[1]), GetLocationZ(udg_tpoint[1])+VAR_TombHeight)
However, I'll tell you to not do this anymore, because if you write around 256 characters in a custom script, that will crash your editor.

so i would change it to jass so editor won't crash?
 
Level 13
Joined
May 10, 2009
Messages
868
It's possible to reduce the name of those variables in order to avoid exceeding the limit: ss__lightning can be renamed to: ss_l; SS_Lightning_Type -> SS_LT; VAR_CasterHeight (well, this was an example) -> SS_CHgt; VAR_TombHeight -> SS_THgt.

You could also use temporary short-named variables to store the values of GetLocationZ(udg_tpoint[x]) + Height, which defines one side of your lightning's height, and then use them in that function. However, that will just complicate things a little bit more.

As for JASS, you won't even need to worry about it, its limit is around 2100 characters.
 
Last edited:
Status
Not open for further replies.
Top