Wc3C.net

Wc3C.net (http://www.wc3c.net/forums.php)
-   vJass Spells (http://www.wc3c.net/forumdisplay.php?f=647)
-   -   Black Hole (http://www.wc3c.net/showthread.php?t=97775)

Malf 11-11-2007 04:02 AM

Black Hole
 
2 Attachment(s)
Zoom (requires log in)
B l a c k H o l e
Download
Blackhole.w3x
Requested by darkwulfv and spawned from the Spell Request thread.
Requires cohadar's ABC System to be used.
Thread
Spell Request Thread
The hero tears a hole in the fabric of space, creating a black hole that sucks enemy units within a X AOE radius. Enemy units who stray too near and get within Y units near the black hole will get sucked in. After Z seconds, the black hole collapses and explodes, dealing XX damage in a YY AOE radius and knocking them backwards. Units sucked in the hole will also get damaged and be thrown out of the void it was sucked into.
Written by
Malf

waaaks 11-11-2007 10:59 AM

ive seen 2 black hole spells already, and tried to import in my map, but they affect structures which i dont want to affect, i tried configuring them but still affect the structures

i hope this doesnt affect structures

is this a system?

Malf 11-11-2007 12:01 PM

If you've configured them then it might be a problem with those spells.

This is a normal spell, doesn't follow the JESP standard since I was too lazy to add the JESP manifest.
The spell itself is 100% configurable though.

Btw, I'm noypi as well =

cohadar 11-11-2007 12:06 PM

Always post the spell code.

moyack 11-11-2007 03:21 PM

I've done a quick review, and this is what I've found:
  • You are not indicating that your system uses ABC from cohadar (yes cohadar, kill him :P) Please add this to the first post.
  • If I cast the spell very near to the caster, the caster is knockbacked with the enemies, weird!!
  • You use this formula to calculate the movement:
    Collapse JASS:
    set x = x + d.expiration * Cos(a*0.01745)
    set y = y + d.expiration * Sin(a*0.01745)

    You are summing distance with velocity. If you want to be more accurate, you should use d.expiration * SUCK_INTERVAL and it's more unit homogeneous (sum distance with distance).
  • You must set the dust effect as a constant global.
  • Just a suggestion, your indent makes look your code messy, try to add more spaces, it helps a lot to read the code.
  • There's already a BlackHole spell (a JESP one) done by Blade.dk. You can see it here

Because this spell has been done, in theory I should graveyard this, so I need a good justification why it should be approved.

darkwulfv 11-11-2007 03:41 PM

Because the spells are different.

Blade's removes the units entirely and damages nearby ones.

This one sucks enemies in and holds them there, then the black hole implodes, sending the ones sucked in flying and damaging other units.

Quote:

Originally Posted by Moyack
If I cast the spell very near to the caster, the caster is knockbacked with the enemies, weird!!

I think this was intended. If you made a black hole in your face, I think you'd be eaten by it as well.

cohadar 11-11-2007 03:44 PM

I will let him live for now.

Mainly because he knows how to import ABC.
(You would be surprised at the amount of people who copy whole ABC text on top of their trigger text, they think it is a macro or something!? )

He also used private actions and conditions, that is a big plus.

He did not use local trigger:
Collapse JASS:
function InitTrig_Black_Hole takes nothing returns nothing
 set gg_trg_Black_Hole = CreateTrigger(  )
 call Preload(BlackHole_FX)
 call Preload(Explode_FX)
 call Preload("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl")
 call TriggerRegisterAnyUnitEventBJ( gg_trg_Black_Hole, EVENT_PLAYER_UNIT_SPELL_EFFECT )
 call TriggerAddCondition( gg_trg_Black_Hole, Condition( function Conditions ) )
 call TriggerAddAction( gg_trg_Black_Hole, function Actions )
endfunction

Collapse JASS:
public function InitTrig takes nothing returns nothing
    local trigger trig = CreateTrigger()
    call Preload(BlackHole_FX)
    call Preload(Explode_FX)
    call Preload("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl")
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( trig, Condition( function Conditions ) )
    call TriggerAddAction( trig, function Actions )
endfunction

// InitTrig is public, remember that.


The greatest remark is terrible indentation of the code.
Learn to use tabs instead of spaces.
(or use 4 spaces if your editor does not support tabs)

------
This is close to being JESP, he just needs some more work.

EDIT:
You should use this for a spell icon:
ReplaceableTextures\CommandButtons\BTNGenericSpellImmunity.blp
It is an active spell after all.

moyack 11-11-2007 03:52 PM

Quote:

Originally Posted by darkwulfv
Because the spells are different.

Blade's removes the units entirely and damages nearby ones.

This one sucks enemies in and holds them there, then the black hole implodes, sending the ones sucked in flying and damaging other units.

I see... then I'll let continue this thread :)

Quote:

Originally Posted by darkwulfv
I think this was intended. If you made a black hole in your face, I think you'd be eaten by it as well.

The caster is not eaten, only knockbacked. I think this should be configurable in the spell too.

Quote:

// InitTrig is public, remember that.
It's not necessary to make it public.

cohadar 11-11-2007 04:24 PM

Quote:

Originally Posted by moyack
It's not necessary to make it public.

Yes it is.
(when you are naming it only InitTrig to avoid WE dependence.)

Malf 11-12-2007 09:30 AM

I didn't use a local trigger because:

a. The global is created anyways
b. Some people may want to disable triggers dynamically


Oh and I know about Blade.dk's blackhole, I ripped off the model from his demo map =
_________________________

You can determine which units are sucked in, it's just below some constant functions and is explicitly named Filter

The InitTrig is called 'InitTrig_Blackhole' so I do not need to add a public/private prefix.

My calculations are fine, d.expiration*SUCK_INTERVAL just determines the speed travelled per second in wc3 units(for example, 800 units per second)
Which means I'd have to do something like this
Collapse JASS:
    if d.expiration < d.distance then //d.distance == d.expiration*SUCK_INTERVAL
        set x = d.x + d.expiration * Cos(a*0.01745) //Uses a local var 'x'
        set y = d.y + d.expiration * Sin(a*0.01745) //and local var 'y' instead of d.x and d.y
        set d.expiration = d.expiration + SUCK_INTERVAL
    endif

Oh and sorry cohadar, I forgot to say in the first post that I use ABC.

Check first post for the new link for the newer version of the demo map. I've included some minor changes and added a filter for units who should be knocked back.

waaaks 11-13-2007 03:00 AM

ok i tested the spell...it was cool but its lag

Malf 11-13-2007 08:08 AM

It's not laggy, even on my computer. It just so happens that I've amassed trolls in the map so the units are the ones who are affecting your computer's lag issues.

waaaks 11-13-2007 10:04 AM

ah ok
maybe ill use that in my map :D

lol - moyack removed it :P

Pyritie 11-21-2007 06:42 PM

This would be sweeter if it had some levels.

Malf 11-23-2007 12:07 PM

That's why I split some constant globals into constant functions. There you can just set a formula like 50+10*level

It supports levels.


All times are GMT. The time now is 06:20 PM.

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services