Examples of channeling spells

shiFt

Member
Reaction score
8
Im having difficulty conceiving channeling spells done in vjass, could you please post example codes of channeling spells.

Spells that stop on end of channeling, and stop when channeling is interrupted etc, and spells that require x amount of channeling to get x effect.

Im not sure on the format of doing channeling spells exactly and examples would help alot :D
 

Dinowc

don't expect anything, prepare for everything
Reaction score
223
just use a periodic timer and keep checking if the caster's current order equals to channeling order, that's all

if you're not sure which order string it is, use this when the unit starts channeling:

if you really want an example spell, then give me some time and I'll make a simple channeling DoT
 

tooltiperror

Super Moderator
Reaction score
231
>just use a periodic timer and keep checking if the caster's current order equals to channeling order, that's all
Bad. Better to use an event to fire when a new order is issued.
 

emjlr3

Change can be a good thing
Reaction score
395
better, but can create its own problems that are difficult to remedy.

check here for an example.
 

emjlr3

Change can be a good thing
Reaction score
395
no it won't

but, if you were to register another order - things like learning an ability fire the event, and are impossible to detect w/o using a massive orderid cache

unless of course I am missing something
 

tooltiperror

Super Moderator
Reaction score
231
Nope.jpg

JASS:
function onEnd takes nothing returns boolean
    call DestroyTrigger(GetTriggeringTrigger()) // Destroy the trigger and event
    return false
endfunction
function onCast takes nothing returns boolean
    local trigger t // Used to register the order event

    if GetSpellAbilityId()!='A000' then
        return false
    endif
    set t=CreateTrigger()
    set u=GetTriggerUnit()
    call TriggerRegisterUnitEvent(t,GetTriggerUnit(),EVENT_UNIT_ISSUED_ORDER)
    call TriggerAddCondition(t,Condition(function onEnd))

    set t=null
    set u=null
    return false
endfunction


You could also do a conditional check to make sure the issued order wasn't stop or hold positions.

Destroying a trigger also destroys the events it has registered to it, so you don't have to worry about the [LJASS]event[/LJASS] that [LJASS]TriggerRegisterUnitEvent[/LJASS] creates.
 

shiFt

Member
Reaction score
8
wow, beautiful spell emjlr, ive got a similar spell in my map however it lags a bit, how did you get it to run so smoothly?
 

emjlr3

Change can be a good thing
Reaction score
395
Nope what? the issues I stated still remain

wow, beautiful spell emjlr, ive got a similar spell in my map however it lags a bit, how did you get it to run so smoothly?

magic, no seriously - the code is right there, just take a look
 

tooltiperror

Super Moderator
Reaction score
231
I said nope to your "giant orderid cache" thought.
 

shiFt

Member
Reaction score
8
Geez emj this coding is a bit advanced O_O for me atleast, but then again it is excellently done, so smooth and fast.

Hope you dont mind me asking you a few questions, as I hope to be coding like you eveeeeeentuuaaallly :).

What is the purpose of the hashtable and the linked list? I think because I mainly code with T32 module I would not use hashtable? Also linked list?? Child Hashtables?

What is encapsulation?

Also what is Pierce? Is it allowing a unit to be damaged multiple times by same damage source?

For learning purposes I have cut out many of the spell specific code to get a working backbone, do you mind this?
 

emjlr3

Change can be a good thing
Reaction score
395
the hashtable is so I can store the struct to the caster. i need to access to it in other trigger instances so I can change the casting angle and distance when the ability is recast at a different location while channeling.

the linked list is simply a more efficient way of coding a struct array stack (~15% or so). its the method T32 uses to link instances. see here.

a child hashtable is simply the handle id you are storing data to. everythign is stored to the hashtable, and you use a child marker to denote at what integer you want data stored, so you can retrieve/flush it later. (this may not be the most apt description)

encapsulation

PIERCE makes it so the needles are not destroyed on collision, and instead keep moving toward their target location.

do what you like, its open source
 

shiFt

Member
Reaction score
8
This is what I have done, it obviously does not compile how can I fix this? Having difficulty understanding the meaning of "this" and "thistype".
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
JASS:
private struct abc
endstruct

thistype refers to the struct type, abc.
this refers to the struct instance, abc.allocate()/abc.create()/abc(index).
 

Laiev

Hey Listen!!
Reaction score
188

shiFt

Member
Reaction score
8
So thistype gets an instance of the struct? Is this for MUI purposes?


Now this is undeclared in the periodic? Is "this" an actual variable type?
 

dudeim

New Member
Reaction score
22
No not really
thistype is the struct itself
and this is the current instance of the method
JASS:
struct Bla
static method a takes nothing returns nothing
local Bla b = Bla.create()
//is the same as
local thistype this = thistype.create()
 

WaterKnight

Member
Reaction score
7
but, if you were to register another order - things like learning an ability fire the event, and are impossible to detect w/o using a massive orderid cache

orderid >= 'A000'

Stun triggers an object targeted order, not sure about other things though. But why do you need the order event anyway. There is EVENT_UNIT_SPELL_ENDCAST, which is run when the unit cancels/finishes the skill in any way.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
What's all this about Issued Order events and checking it periodically?

The spell starts at [ljass]EVENT_PLAYER_UNIT_SPELL_EFFECT[/ljass] (create a struct or add the caster to a unit group or whatever), and ends at [ljass]EVENT_PLAYER_UNIT_SPELL_ENDCAST[/ljass] for any reason, whether the spell finishes or the caster is stunned, etc.

If I'm not mistaken, a channeled spell will always be started at SPELL_EFFECT and stopped at SPELL_ENDCAST without exception.

Then, just do something spell-like in the interim with the data you saved, which is a somewhat different topic. Usually it'll be something done periodically, or else there's not much point to it being a channeled spell. ;)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top