System SpellStruct

Discussion in 'Systems and Snippets' started by Jesus4Lyf, Nov 20, 2009.

  1. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
    Lol. XD

    I understand what you're saying. There is no extra evaluation on events, though. There is an extra execute on triggers from .createTrigger, and timers from startTimer. Considering that T32 works flawlessly with this, the timer thing doesn't matter as it is only for high periods. So actually, none of it is even an issue. This thing flies.

    ... Except for group usage. That's a little nasty. Nothing stops you from doing it yourself, though.

    Thanks for all the feedback. Still hoping to get this approved...
     
  2. SanKakU

    SanKakU Member

    Ratings:
    +21 / 0 / -0
    did anyone else mention yet that this test map is rather odd? everything seems ordinary to me...where's the spellstruct system? ok looking at the trigger it seems that death coil and life drain are the custom spells...

    ok maybe you should pick a different ability other than the death coil...considering you can cast it on your dark ranger and get her blown up. and it's not obvious to a tester what spells to test...why no instructions for the tester?

    anyway, wow idk if it was because of me or not...but when i played with the aoe and put it up to 1000 instead of 500 and tried life draining a footman the drain broke really fast and then later on the footman seemed to chase the dark ranger into the out of bounds area or something...idk cuz i was busy selecting my death knight to coil the ranger to see what would happen now that i changed the value of the wait from 2 seconds to 10...anyway...war3 seems to have frozen and i am pretty sure ranger left the map area but war3 doesn't know what to do. does this test map need boundsentinel?
    what was he talking about? i didn't see a blink spell...all i see is time bomb and life drain...was he talking about the life drain?

    edit: hmmm i tested it a second time and this timethe footman rather than the ranger seemed to disappear from the map completely...but the game didn't freeze up or crash.

    also, Jesus4Lyf, when i tried putting your Berserker thing in there it's not compiling for me, i'm not sure why but i get an error at the following line:
    call this.destroy() // actually has garbage collection

    all i did was put it in a trigger with the name as like berserkerwhateverthenamewas and then changed the xxxx ability id to Absk...am i missing something?

    edit: apparently i'm either looking at an out of date test map, or the test map hasn't been updated.
    edit2: ok i've tested it again with all the spoiler code informations on your first post and i'm still coming up with the same problem for the berserker spell thing. maybe you already are aware of this error, i don't know. at any rate...i don't seem to be getting the same problems i was getting before with the dark ranger spell. although i wonder at how customizable it is considering it doesn't really do what you'd expect it to. but at least it isn't bugging out in the extreme...i'm guessing i'm just too stupid to know how to customize the spell properly...
    edit3:ah there we go...rather than editing the value 500...i changed the duration...yeah that makes sense...anyways...now that we have that in order it does seem like your test map needs boundsentinel...the dark ranger can end up outside of the map bounds...
    ok i imported the boundsentinel trigger and well, although it did prevent her from going out of bounds it did come with some side effects...after the spell was over, she jumped to the location i asked her to move to instead of moving, then she wiggly walked around everywhere for a while then she started not really going where i was telling her to go...then started to obey me again...all the while oftentimes wiggly walking and then anyway when i tried to cast the spell again the map froze again like it had back when i had the trouble with the old test map when i edited the 500 value to be 1000 in the trigger.
    just for further clarification:
    when i said i edited the duration of the spell, it means the life drain object itself. just in case you were wondering where i found the duration to be edited...anyway yeah for better testing purposes with the bounds i'd recommend taking it off 8 seconds and bringing it up to a higher number. i used 30.

    well now after looking at all that i'm unsure that boundsentinel would be at fault, although it's a slight possibility...at any rate since the lifesteal spell isn't working with or without it then there should at least be an alternative.

    that's what i have to say about the system...on a more personal note...i have some issues with your test map.

    i was going to pm it to you but you say you dislike them oftentimes because then others won't be able to learn from them...so...since this is basically advice i'm giving you that others can possibly learn from i guess i'll give it to you also...maybe it's nothing you don't already know, but whatever. here it is, just in case.

    well i'll probably examine the system later on(not that i'd understand much, but who knows)...but even just testing it i've noticed a lot of problems with it. i just posted a lengthy reply in your thread there about it and to be honest i hadn't given the system much thought previously most likely because of the junk test map that it has...no offense intended but the lack of instructions for the tester is sortof lame and not very encouraging. at least fix that if nothing else.

    for one thing, it's not exactly intuitive for one thing to use death coil or life drain just because those 2 heroes only have one skill point whereas the potm has 5 simply because they each have 4 other skills to choose from...and further although having extra units around to toy with is fine...i think MOST testers would be frustrated at seeing all the enemy footmen die over and over again before figuring out what were the special spells. obviously they could look at the triggers and figure it out...but if you had only posted a simple to player red message to use the death coil and life drain spells then they wouldn't be wondering what's up with your system...like i had said...

    it looked like there was no system whatsoever while trying to test this until i actually went into the trigger editor and read the triggers.

    a VERY simple fix that would not include giving instructions...but of course would be really lazy and i wouldn't recommend it...but here it is...would've been to just at least throw in a bunch more footmen so that they don't all die while the tester is trying to figure out what spells do something special...

    and of course like i said i'm unsure if i was merely playing an older version of your test map or if your test map hasn't been updated...but anyway that wouldn't change the fact that when i did happen to download it, these things had been the case...

    anyways... aside from all that...i might as well mention that i like the idea of both of the spells.

    obviously life drain has kinks to work out, but it's a very interesting concept to have a spell like that moving both the triggering unit and the target unit of a spell...it seems novel to me, at least. nice idea.

    also the death knight thing...hmm...yeah it's cool, sure. didn't they have something like this in the fight with gotenks and buu in the hyperbolic time chamber? anything similiar to anything in that fight is really cool and i'd love to see stuff like that in warcraft 3 anytime.

    edit4: it just occured to me that i should do a little bit more testing...and...yeah...my hunch was right...if you use alternate level ground and a cliff and the ranger's back is to the cliff she's going to go up it and we get some more bugs. i didn't wait for the duration to run out during the 30 secs but during it she went up the cliff...the footman did not follow her...and then she went back and forth and they looked like a couple of units going at a tree with a saw....it was actually quite amusing, compared to the other bugs i ran into earlier. at any rate i interrupted the channeling to get her to move around to see what happens next and she was on the high ground and she was able to start to go down the cliff...i don't clearly remember what happened next but i think i tried to make her go back up the cliff again and then she got stuck. if i remember right the game didn't freeze this time...but yeah she got messed up...oh i should try casting it again...i bet that'll make the game freeze if i do...yEAH...the game froze again...just like before. actually i noticed it's funny...the first time i casted it just now when i loaded it up one more time the spell interrupted itself when it went forward, i'm supposing it was because she was too far away from the cliff when she cast it...or there was some difference in distance between her and the footmen compared to before. anyway there was no bug at that time because the spell apparently corrected itself. then i tried to do the same thing but interrupt it myself to see what would happen and she could walk up and down the cliff freely...but rather than moving normally her movement was restricted to a particular ovular sortof area around where i had casted it and where they had been moving around at. and then so her movement also wasn't so wiggly like before but it all possessed something of the attributes of what looked like she was surfing around on some water on a surfboard...really crazy stuff...anyway so yeah since her movement was befuddled and buggy i knew that it was the cue that if i cast the spell again the map would freeze and sure enough it did.
     
  3. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
    JassHelper bug. Released a new version with that documented and a small fix.

    Here's a working, compiling version.
    JASS:
    struct BerserkersCall extends SpellStruct
        implement SpellStruct
        
        private static method DURATION takes integer level returns real
            return 1.0*level
        endmethod
        
        private static trigger reorder
        private static unit move
        
        private method onDuration takes nothing returns nothing
            call SpellStruct(this).destroy() // actually has garbage collection
            // Alternatively:
            //call this.destroyTrigger(thistype.onOrder)
            //call this.stopTimer(thistype.onDuration) // actually will destroy the struct since it is no longer used
        endmethod
        private method afterZero takes nothing returns nothing
            call IssueTargetOrder(thistype.move,"attack",this.caster)
            call this.stopTimer(thistype.afterZero)
        endmethod
        private method onOrder takes nothing returns nothing
            if GetIssuedOrderId()!=OrderId("attack") or GetOrderTarget()!=this.caster then
                set thistype.move=GetOrderedUnit()
                call this.startTimer(thistype.afterZero,0.0)
            endif
        endmethod
        private method forAoE takes unit u returns nothing
            if IsUnitEnemy(u,this.owner) and not IsUnitType(u,UNIT_TYPE_DEAD) then
                call IssueTargetOrder(u,"attack",this.caster)
                call TriggerRegisterUnitEvent(thistype.reorder,u,EVENT_UNIT_ISSUED_ORDER)
                call TriggerRegisterUnitEvent(thistype.reorder,u,EVENT_UNIT_ISSUED_TARGET_ORDER)
                call TriggerRegisterUnitEvent(thistype.reorder,u,EVENT_UNIT_ISSUED_POINT_ORDER)
            endif
        endmethod
        private method onEffect takes nothing returns nothing
            set thistype.reorder=this.createTrigger(thistype.onOrder)
            call this.forUnitsInAoECaster(thistype.forAoE)
            call this.startTimer(thistype.onDuration,thistype.DURATION(this.level))
        endmethod
        
        private static method onInit takes nothing returns nothing
            set thistype.abil='A000'
            set thistype.defaultAoE=300.0
        endmethod
    endstruct

    I tried it on thunderclap. Seems to work. :thup:

    Aside from that, I'd like to remind you that the demo map is not a demo map for the spells, but for the system. It is to demonstrate that the functionality works. I don't really care if I haven't handled edge-of-map collision or cliff detection in a slide spell, for example. Actually, it's quite pointless to even include instructions, since you should read the code to see what is running and what is the effect.
     
  4. SanKakU

    SanKakU Member

    Ratings:
    +21 / 0 / -0
    while i can understand your reasoning on leaving them out, if you put yourself in someone else's shoes, you might feel differently. let us suppose they simply downloaded a lot of test maps all at once into the same folder and just check everything out all at the same time...and anything broken they ignore. when stumbling across your map...it's easy to say...uhh...what was this map again? oh whatever...and move on...completely ignoring your test map...

    because your test map didn't include the features i recommended, your system as a result doesn't get examined. that's the result that happened with me.

    i've begun examining it now of course...but like i said...i ran into some issues with one of your spells in the test map...as a result...
    i'm a man of practicality...because only half of the test map seems practical, the value of examining the system drops considerably.

    anyway, i don't fully understand what's up with the system and how can you be sure there isn't a problem with the system rather than the spell when you haven't even bothered to fix the spell? you ought to fix it...like i said previously i don't remember seeing any spell at all that moves around the caster and the target...is that what your system does or isn't it? well apparently that's what the spell does but somehow it's not working. this caught my eye as something that is really cool...and awesome. so why not fix it up?

    edit: btw i tested your new rewrite of the berserkerscall and now i'm getting an error message at the following line:
    set thistype.reorder=this.createTrigger(thistype.onOrder)
    it's saying cannot convert nothing to trigger
    did you just try to tell me jasshelper got updated AGAIN? haha...ah man i wish it was a bit more newsworthy if that were the case...i think it gets updated more often than dota does!
     
  5. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
    Short posts are practical. ;)
    Encapsulation. I know where the code for moving the unit is, and how to fix it.
    It doesn't move the target, actually. The target is under the control of the player.
    Update SpellStruct. :)
     
  6. SanKakU

    SanKakU Member

    Ratings:
    +21 / 0 / -0
    wow, are you serious? well, now that you mention it, that makes ALOT more sense now why I was getting a beshortened duration when i extended the range to 1000...

    and i can't help it if your spells leave a lot of stuff undone that needs to be mentioned...if you're the one that knows how to fix it, then doing so would decrease the size of my posts by a significant factor because i wouldn't have as many bugs to point out.

    i just happened to think the spell was fascinating...but then again now that you've pointed out a fault in my understanding of what the spell is doing... and what's to blame once again is the lack of documention for the spell...but yet again your stand is that it's irrelevant and i respect that...well now i have to reconsider what i think of the spell, haha.

    dude, it's still not compiling, why don't you stop wasting my time and confirm the compilation if you aren't doing so already, and then update the test map with a compiling version of that berserkerscall spell, and then get back to me on that.
     
  7. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
    I don't say something is compiling if it is not. I have copied the latest version of SpellStruct (without changing anything) and the exact code I posted for Berserker's Call (without changing anything except the abilid) into a blank map, which is here attached, for your convenience. Just as I previously tested before posting. :)

    Attack the troll with the footman, then have the Mountain King thunderclap near it, it will attack the Mountain King. Didn't test the continual force attack stuff.

    This is not a thread about spells.
     

    Attached Files:

  8. Troll-Brain

    Troll-Brain You can change this now in User CP.

    Ratings:
    +85 / 0 / -0
    JASS:
    method onFinish takes nothing returns nothing // When the effect finishes (or is interrupted).
                    endmethod                                     // This will only fire if the effect fired.
                    method onStopCast takes nothing returns nothing // When the spell stops being cast, or is cancelled.
                    endmethod


    You know what, i've always hated how the ENDCAST always fire, even if the spell was successfully casted.
    I definitely consider it as a "wc3" error, it doesn't make sense.

    You should fix it, just use an extra global boolean and launch this event only if the FINISH event wasn't fired first.

    Anyway, that's already how i use this event, i just wanted to give my opinion.
     
  9. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
    Hm. I thought about this carefully for a while, and figured it makes sense that there is a one-to-one relationship between beginning casting and ending casting. It doesn't make sense to fire the event earlier than casting is actually finished, so I think it makes sense the way it is...

    The end cast event is guaranteed to fire so long as the start cast has, and same with finish fires if starts effect has fired. :thup:
     
  10. Troll-Brain

    Troll-Brain You can change this now in User CP.

    Ratings:
    +85 / 0 / -0
    *Shrugs*.
    I still use the ENDCAST event like a CANCEL event (spell was interrupted before the end), i don't see anything bad with using FINISH to detect the end of the spell, but it's your script anyway.
     
  11. SanKakU

    SanKakU Member

    Ratings:
    +21 / 0 / -0
    thankyou for humouring me.

    well, isn't that interesting...you...recreated a DOTA spell...lol you're usually complaining about other people doing that. well, whatever.

    although i'm not clear exactly about what this system is for...and yeah i suppose i got off-topic and didn't ask...for that i apologize, i was distracted by the spells
    ...am i correct in understanding that this system just has structs that you can use for spells and so on? that being the case, i barely know how to use structs... so i can't really give the system a useful review until i learn them better.

    do you want to make another thread to talk about that life drain spell or shall i? because i think it's interesting. i was going to say i wonder if you could make the spellcaster move according to where the target is...so that they would stay in 500 range...or does the spell do that already? ah but although i have more i wanted to touch on about the spell i'll leave it at that for now.
     
  12. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
    That's exactly what it does (and all it does). You can make a thread if you wish.
     
  13. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
  14. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
  15. Troll-Brain

    Troll-Brain You can change this now in User CP.

    Ratings:
    +85 / 0 / -0
    Well, i don't really want read the whole code but will it bug like SpellEvent in this case (just for potential users) ?

    Also i understand why members are readonly but since it's designed for triggered spell, sometimes the user could want to change the target dynamically on some event, or such things.
    And finally have a boolean isEnded to know if the cast was sucessfully ended or not would be useful (shouldn't be readonly as well)
     
  16. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
    I believe not. It attaches instances to [Unit, AbilId] so I'm pretty sure no.

    I'll need to think about this some time. More benefit to have an event onComplete, I should think... :)
    Is it even possible to detect how it ended?
     
  17. Troll-Brain

    Troll-Brain You can change this now in User CP.

    Ratings:
    +85 / 0 / -0
    Don't believe, be sure !

    Zomg you rejected this idea of event before.
    But since now i've stolen some Anitarf's code, a boolean seems better imho.
    Also as i've said in my post, it's really spell dependant.
    Most of the spell are done when the SPELL_EFFECT event fire (if you don't stop the unit on this event).
    Let the user to decide when it's finished with this boolean, and set it to true on SPELL_FINISH event.
     
  18. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
  19. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
  20. tooltiperror

    tooltiperror Super Moderator Staff Member

    Ratings:
    +233 / 0 / -0
    So, Jesus.

    Just to give you something to add, why not try to make it so that you can effectively debug with this ingame?
     

Share This Page