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.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      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