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

Blast Nova v0.3b

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
THIS SPELL IS FOR NEWBIES OR EVEN FOR OLDER PEOPLES THAT WORKING IN WORLD EDITOR FEEL FREE TO USE THIS SPELL!!

This is just a small easy to make spell.
It's GUI/MUI and I believe there is no leaks in it :)!.

[trigger=Blast Nova]
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Blast Nova
Actions
Set BN_Caster = (Triggering unit)
Set BN_Point = (Target point of ability being cast)
Unit - Create 1 Dummy_Frost Nova for (Owner of BN_Caster) at BN_Point facing Default building facing degrees
Unit - Set level of Dummy_Blast Nova for (Last created unit) to (Level of Blast Nova for (Triggering unit))
Unit - Order (Last created unit) to Human Mountain King - Thunder Clap
Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_BN_Point)[/trigger]
[trigger=Blast Nova]Blast Nova
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Blast Nova
Actions
Set BN_Caster = (Triggering unit)
Set BN_Point = (Target point of ability being cast)
Unit - Create 1 Dummy_Frost Nova for (Owner of BN_Caster) at BN_Point facing Default building facing degrees
Unit - Set level of Dummy_Blast Nova for (Last created unit) to (Level of Blast Nova for BN_Caster)
Unit - Order (Last created unit) to Human Mountain King - Thunder Clap
Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
Custom script: set udg_BN_Caster = null
Custom script: call RemoveLocation(udg_BN_Point)
[/trigger]
[trigger=Blast Nova]Blast Nova
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Blast Nova
Actions
Set BN_Caster = (Triggering unit)
Set BN_Point = (Target point of ability being cast)
Unit - Create 1 Dummy_Frost Nova for (Owner of BN_Caster) at BN_Point facing Default building facing degrees
Set BN_LCU = (Last created unit)
Unit - Set level of Dummy_Blast Nova for BN_LCU to (Level of Blast Nova for BN_Caster)
Unit - Order BN_LCU to Human Mountain King - Thunder Clap
Unit - Add a 3.00 second Generic expiration timer to BN_LCU
Custom script: call RemoveLocation(udg_BN_Point)
[/trigger]


If you feel like you can let a comment!.

Keywords:
Blast Nova
Contents

Madietor - Blast Nova (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 06:22, 31st Jul 2012 Magtheridon96: I've come to the conclusion that this can't be approved. If I approve, I'd have to approve another thousand or so spells just as simple as this that we...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

06:22, 31st Jul 2012
Magtheridon96: I've come to the conclusion that this can't be approved.
If I approve, I'd have to approve another thousand or so spells just as simple as this that we have rejected in the past. :/
 
Level 25
Joined
Jun 5, 2008
Messages
2,572
This is really plain, but i guess it's ok.
You are also leaking a unit pointer, you didn't null BN_Caster.

With that said, 2/5.

Edit:

And before anyone starts arguing whether you should null BN_Caster or not, in the end if you don't null it, it will point to the last unit that cast the spell, thus it is taking up space without any need, thus it leaks.
 
^No worries, globals don't need to be nulled.

One thing that could be improved though is using the BN_Caster variable instead of (Triggering unit) on the fourth line.
Another would be to store the last created unit into a variable after creating it and using that variable instead of calling (Last created unit) over and over again.


I really don't know what to do here.
It's an incredibly simple spell.
 
Level 7
Joined
Nov 13, 2011
Messages
127
You are also leaking a unit pointer, you didn't null BN_Caster.

And before anyone starts arguing whether you should null BN_Caster or not, in the end if you don't null it, it will point to the last unit that cast the spell, thus it is taking up space without any need, thus it leaks.

Thanks for the feedback btw where did i not use it? + one more thing it doesn't take that big space.. i would say like it takes 00000000.1 space for example :/ thus it doesn't leak i checked it out in leak check v3.1 :/

I really don't know what to do here.
It's an incredibly simple spell.

As the description says :p thanks for the feedback!
 
Last edited by a moderator:
Level 33
Joined
Mar 27, 2008
Messages
8,035
So which theory should I hear ?
Kingz or Magtheridon ?

As long as I know, only local variable needs to be nulled, global does not.
But, can someone explain to me detail about this workings ?

I mean, how does Kingz got the idea that global variable needs to be nulled.
And how does Magtheridon got the idea that global variable should not be nulled.

@OT
As others said, it's pretty simple.
But I guess it's good for starters ?

Hell yeah my first spell uploaded on THW, it was... a lol spell.

I think you guys should be lenient, hey at least he's not leaking the trigger + it's MUI !
That sounds good enough.

Although he could improve over time, improve on ideas and concepts of spells.
If I am a moderator, I would approve his spell, true story.
 
Don't null globals.
Null locals all the time.

^Fundamental Rule.

Of course, we have exceptions.
In vJASS structs, we null the struct members in case they don't get overwritten.
(Because they're arrays, the data can pile up)

edit
Let me explain it to you.

Globals variables are present throughout the game.
Their memory locations are constant. They can be overwritten. Nulling them will not make a difference because they will get overwritten again.

Local variables are only present in the scope of the currently executing function.

When you declare a local unit, it's going to point to memory location A for example.
If you give it a value, that value will be found in memory location A.
When the function executes another time, the local unit will point to an empty memory location, meaning not A, but B.
If you give it a value, that value will be found in memory location B.

See? They're just being written to memory and remaining there.
Nothing is removing them.

With globals, it's perfectly fine, because global A will always point to memory location Q all game.
You don't need to null it.

Locals need to be nulled, else that unit will remain in memory forever.

There's also one side-effect.

If a unit is still referenced in memory, it's handle Id will not be recycled.
Meaning that handle Ids will be incredibly high and get higher throughout the game.

This is why you need to null locals.
Globals are overwritten and don't need to be nulled.


The only time globals should be nulled is when they're arrays.
No one really cares for this though, because when they are arrays, they still get overwritten later.
(Spell data is a good example)

In vJASS, we always null non-static struct members.

I hope this explains it.

edit
If I will approve this, I have to give it a bare-minimum rating.
But it has to be perfect, so, tip:

- Don't null the caster.
- Store the last created unit in a TempUnit variable and use that variable instead of repeating (Last created unit) 3 times.
 
Last edited:
Level 7
Joined
Nov 13, 2011
Messages
127
This spell is so simple.This reminds me of DotA's Crystal Nova.
This spell shouldnt be approved.

i never said i wanted this spell to be approved it.. this is a spell FOR NEWBIES and even for older world editor players just read the god damnit description -.- it's not hard..

Magtheridon96 said:
Store the last created unit in a TempUnit variable and use that variable instead of repeating (Last created unit) 3 times.

bro i don't know why but when i create a variable for last created unit the first time i cast the spell it does not work the second time it works but the third time and the other times the dummy unit it's created in the middle of the map or sometimes at the last potision that i cast it.. any suggestions??
 
Last edited by a moderator:
Just one tip: Edit your posts rather than making new ones. Making double/triple posts is against the rules :/

Your trigger should look like this:

  • Blast Nova
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blast Nova
    • Actions
      • Set BN_Caster = (Triggering unit)
      • Set BN_Point = (Target point of ability being cast)
      • Unit - Create 1 Dummy_Frost Nova for (Triggering player) at BN_Point facing Default building facing degrees
      • Set TempUnit = (Last created unit)
      • Unit - Set level of Dummy_Blast Nova for TempUnit to (Level of Blast Nova for BN_Caster)
      • Unit - Order TempUnit to Human Mountain King - Thunder Clap
      • Unit - Add a 3.00 second Generic expiration timer to TempUnit
      • Custom script: call RemoveLocation(udg_BN_Point)
Note: I also changed the owner of the caster to the triggering player because it's a faster function.
 
Level 7
Joined
Nov 13, 2011
Messages
127
Just one tip: Edit your posts rather than making new ones. Making double/triple posts is against the rules :/

Your trigger should look like this:

  • Blast Nova
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blast Nova
    • Actions
      • Set BN_Caster = (Triggering unit)
      • Set BN_Point = (Target point of ability being cast)
      • Unit - Create 1 Dummy_Frost Nova for (Owner of BN_Caster) at BN_Point facing Default building facing degrees
      • Set TempUnit = (Last created unit)
      • Unit - Set level of Dummy_Blast Nova for TempUnit to (Level of Blast Nova for BN_Caster)
      • Unit - Order TempUnit to Human Mountain King - Thunder Clap
      • Unit - Add a 3.00 second Generic expiration timer to TempUnit
      • Custom script: call RemoveLocation(udg_BN_Point)

thanks!! btw you edited my triple posts when i was trying to make it look like that too xD version will be updated soon!
 
Level 25
Joined
Jun 5, 2008
Messages
2,572
With globals, it's perfectly fine, because global A will always point to memory location Q all game.
You don't need to null it.

But what if you never again need the global A? It willl still point to memory location Q which isn't needed anymore making it not needed.

Idk but i am used to null globals also, it might not be the best practice but it doesn't hurt either.

Edit:

Also because this is an instant spell Last Created Unit should work perfectly as it is a variable (bj_LastCreatedUnit) meaning he doesn't even need the TempUnit variable so it can still be optimized, am i right?
 
Not exactly.

GetLastCreatedUnit() is actually what gets used.

If it used bj_lastCreatedUnit, yes, it would be more efficient to use (Last created unit) directly, but Blizzard really hates us :(

But what if you never again need the global A? It willl still point to memory location Q which isn't needed anymore making it not needed.

Idk but i am used to null globals also, it might not be the best practice but it doesn't hurt either.

It's all up to you.
Nulling globals wouldn't hurt at all, but the benefits aren't that good either, so do whatever you want and we will both get similar results, except, in your case, if there are thousands of globals, your map might end up being a teenie-tiny bit faster than mine ;p (Assuming most of the variables will come to a point in which they reference dead and removed units :eek:)
 
Top