wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Code Resources > Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 11-08-2009, 12:00 PM   #46
Sinnergy
User
 
Sinnergy's Avatar
 
Join Date: Apr 2009
Posts: 173

Sinnergy has little to show at this moment (8)

Default

hi, I have this trigger that doesn't work combined with xecast when I used SpellEvent.TargetX and SpellEvent.TargetY using a no target spell (Roar Spell), but when I used GetUnitX(unit) and GetUnitY(unit), it crashes the game

I reported this also in xe system because I thought it has something to do with xecast, so if you want to see the real problem then go here
__________________
Current Project:
Rise of Sinnergy v1.00
Sinnergy is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 11-09-2009, 12:50 PM   #47
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Try replacing local unit c = SpellEvent.CastingUnit with local unit c = GetTriggerUnit()
and call RegisterSpellEffectResponse(spell,act) with this:
Collapse JASS:
        local trigger t = CreateTrigger()
        call TriggerAddCondition( t, Condition( function cond ) )
        call TriggerAddAction( t, function act )
And add this function to the script:
Collapse JASS:
    private function SpellCastCondition takes nothing returns boolean
        return GetSpellAbilityId()==spell
    endfunction

If, after these changes, the problem disappears, then there's a problem with SpellEvent and I'll look into it.
__________________

Last edited by Anitarf : 11-09-2009 at 12:51 PM.
Anitarf is offline   Reply With Quote
Old 11-11-2009, 08:53 AM   #48
Sinnergy
User
 
Sinnergy's Avatar
 
Join Date: Apr 2009
Posts: 173

Sinnergy has little to show at this moment (8)

Default

looks like I found the problem in my trigger, there's another trigger I created that acts like an amplifier, each time the buffed unit receives damage, it deals an additional 35% damage from the damage received, and I thought that it would cause an infinite loop

but I'm still wondering why does Spell Event doesn't work, again here's the full trigger I'm using with the damage amplifier trigger
Collapse JASS:
scope HowlDamn initializer init
    globals
        private constant integer spell = 'A00J'
        private constant integer dspell= 'A00K'
        private constant integer buffer= 'B007'
    endglobals
    
    private function con2 takes nothing returns boolean
        return GetSpellAbilityId() == spell
    endfunction
    
    private function act takes nothing returns nothing
        local unit c = GetTriggerUnit()
        local real x = GetUnitX(c)
        local real y = GetUnitY(c)
        local xecast xe = xecast.createA()
        set xe.abilityid = dspell
        set xe.orderstring = "unholyfrenzy"
        set xe.owningplayer = GetOwningPlayer(c)
        set xe.recycledelay = 2.0
        if GetUnitAbilityLevel(c,superBeing) > 0 then
            set xe.level = 2
        else
            set xe.level = 1
        endif
        call xe.castOnAOE(x,y,600.0)
        set c = null
    endfunction
    
    private function con takes nothing returns boolean
        local unit c = GetTriggerUnit()
        local unit t = GetEventDamageSource()
        local real f = GetEventDamage()
        if GetUnitAbilityLevel(c,buffer) > 0 then
            call UnitDamageTarget(t,c,f*0.35,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,null)
        endif
        set c = null
        set t = null
        return false
    endfunction
    
    private function init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(t, Condition(function con2))
        call TriggerAddAction(t,function act)
        //call RegisterSpellEffectResponse(spell,act)
        call XE_PreloadAbility(dspell)
        call AddOnDamageFunc(Condition(function con))
    endfunction
endscope
__________________
Current Project:
Rise of Sinnergy v1.00
Sinnergy is offline   Reply With Quote
Old 11-11-2009, 09:26 AM   #49
Anachron
User
 
Anachron's Avatar
 
Join Date: Mar 2009
Posts: 1,079

Anachron will become famous soon enough (51)Anachron will become famous soon enough (51)

Default

I already answered that in the Trigger&Scripts forum.

To the system: What about an 3rd parameter including a condition?
__________________
CustomInventory [Discussion - Download] - Got Directors Cut!
CustomMissle [Discussion - [Download (not yet)] - In development!
Other systems [Spawn System] [Move System] [CustomBar] [SpellBar]
Anachron is offline   Reply With Quote
Old 11-11-2009, 09:45 AM   #50
Sinnergy
User
 
Sinnergy's Avatar
 
Join Date: Apr 2009
Posts: 173

Sinnergy has little to show at this moment (8)

Default

ok now I found the problem why it doesn't work when using SpellEvent.TargetX, and SpellEvent.TargetY, simply because there is no target, while I used a no target spell (Roar) as the base ability

I even have this line of code in my trigger to check the coordinates of SpellEvent.TargetX and SpellEvent.TargetY

call BJDebugMsg("Coordinates at: " + R2S(x) + ", " + R2S(y))
and it displays "Coordinates at: 0.000, 0.000", too bad SpellEvent.TargetX and SpellEvent.TargetY cannot detect if the spell has no target or not
__________________
Current Project:
Rise of Sinnergy v1.00
Sinnergy is offline   Reply With Quote
Old 11-11-2009, 09:53 AM   #51
Anachron
User
 
Anachron's Avatar
 
Join Date: Mar 2009
Posts: 1,079

Anachron will become famous soon enough (51)Anachron will become famous soon enough (51)

Default

Well, 0.000 and 0.000 are PRETTY sure no targets, because which unit stands on that exact coordinate? You are over complicating things.

oh and btw, you still have these variables to check if they are null:
Collapse JASS:
        unit TargetUnit
        item TargetItem=null
        destructable TargetDestructable=null 
If all are null, its pretty sure a non target spell.
__________________
CustomInventory [Discussion - Download] - Got Directors Cut!
CustomMissle [Discussion - [Download (not yet)] - In development!
Other systems [Spawn System] [Move System] [CustomBar] [SpellBar]
Anachron is offline   Reply With Quote
Old 11-11-2009, 10:58 PM   #52
Sinnergy
User
 
Sinnergy's Avatar
 
Join Date: Apr 2009
Posts: 173

Sinnergy has little to show at this moment (8)

Default

yeah I already fixed it by replacing SpellEvent.TargetX and Y with GetUnitX and Y, I just posted this to let Anitarf know, or maybe motivate him to make SpellEvent.TargetX and y detect non targeted spells
__________________
Current Project:
Rise of Sinnergy v1.00
Sinnergy is offline   Reply With Quote
Old 11-11-2009, 11:08 PM   #53
Bobo_The_Kodo
oO
 
Bobo_The_Kodo's Avatar
 
Join Date: Jul 2008
Posts: 580

Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)

Default

theres no target point for a "no target spell" imo
Bobo_The_Kodo is offline   Reply With Quote
Old 11-20-2009, 08:45 AM   #54
Viikuna-
User
 
Viikuna-'s Avatar
 
Join Date: Feb 2009
Posts: 203

Viikuna- will become famous soon enough (44)Viikuna- will become famous soon enough (44)

Default

Ey, Anitarf. I was just thinking that your SpellChaos example, and I thought that it would be cool to have some event priority stuff, like in Dusks IDDS damage detection system, so you can actually make sure that Chaos stuff is called before other onChannel thingies.

Would something like that be possible to add tho this system, or is there some other way to do these thingies or something?


edit Nevermind, I read the code.

If spellId is 0 it adds that instance thingy to a list, which is itarated through before that hashtable stuff, which calls those specific ability thingies or something.
__________________
No Marlo, no game.

Last edited by Viikuna- : 11-20-2009 at 08:49 AM.
Viikuna- is offline   Reply With Quote
Old 11-20-2009, 12:29 PM   #55
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
Originally Posted by Viikuna-
edit Nevermind, I read the code.

If spellId is 0 it adds that instance thingy to a list, which is itarated through before that hashtable stuff, which calls those specific ability thingies or something.
Correct, spell-specific event responses will run after the general responses. Also, the general responses will run in the order they were registered, which you can control with library requirements (since a library initializer of a library that requires another library will run after the initializer of that other library) or struct initializers (since they run before library initializers).
__________________
Anitarf is offline   Reply With Quote
Old 11-23-2009, 09:34 AM   #56
Viikuna-
User
 
Viikuna-'s Avatar
 
Join Date: Feb 2009
Posts: 203

Viikuna- will become famous soon enough (44)Viikuna- will become famous soon enough (44)

Default

Thats all I need. Cool.
__________________
No Marlo, no game.
Viikuna- is offline   Reply With Quote
Old 01-04-2010, 10:38 PM   #57
Deaod
User
 
Join Date: Jan 2007
Posts: 542

Submissions (11)

Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)

Default

Maybe omit the check of .exists() here:
Collapse JASS:
        if $name$Table.exists(id) then
            call Response($name$Table[id]).evaluate()
        endif

Shouldnt cause any problems. And it should give a speed boost.
__________________
Deaod is offline   Reply With Quote
Old 01-07-2010, 11:23 AM   #58
Sinnergy
User
 
Sinnergy's Avatar
 
Join Date: Apr 2009
Posts: 173

Sinnergy has little to show at this moment (8)

Default

Ok. I've got something to report about a Debug Message displaying "Attempt to destroy a null struct SpellEvent__spellevent" each time I successively cast 2 spells. (I already posted this the other day, but looks like it failed to post)

The spells' information:
Energy Blink
Uses Zerogath's limited energy to instantly move to the target location increasing his attack speed. After a set amount of seconds, Zerogath reverts back to its normal state and position.

Level 1 - 50% attack speed, 3 seconds.
Level 2 - 100% attack speed, 4 seconds.
Level 3 - 150% attack speed, 5 seconds.
Base: Carrions Swarm
Bonus Spell: Item attack speed bonus
Code:
//! zinc
library EnergyBlink requires TimerUtils, SpellEvent{
    constant integer spell = 'A014';
    constant integer bonus = 'A015';
    constant string sfx = "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl";
    constant string area = "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl";
    
    struct data{
        unit c;
        real x,y;
    }
    
    function act(){
        unit c = SpellEvent.CastingUnit;
        timer t = NewTimer();
        real x = SpellEvent.TargetX;
        real y = SpellEvent.TargetY;
        integer l = GetUnitAbilityLevel(c,spell);
        data d = data.create();
        d.c = c;
        d.x = GetUnitX(c);
        d.y = GetUnitY(c);
        SetUnitX(c,x);
        SetUnitY(c,y);
        DestroyEffect(AddSpecialEffectTarget(sfx,c,"origin"));
        DestroyEffect(AddSpecialEffect(area,x,y));
        DestroyEffect(AddSpecialEffect(area,d.x,d.y));
        UnitAddAbility(c,bonus);
        SetUnitAbilityLevel(c,bonus,l);
        SetTimerData(t,d);
        TimerStart(t,2+l,false,function(){
            timer t = GetExpiredTimer();
            data d = GetTimerData(t);
            UnitRemoveAbility(d.c,bonus);
            if(GetWidgetLife(d.c) > 0.405){
                DestroyEffect(AddSpecialEffect(area,GetUnitX(d.c),GetUnitY(d.c)));
                SetUnitX(d.c,d.x);
                SetUnitY(d.c,d.y);
                DestroyEffect(AddSpecialEffect(area,d.x,d.y));
                DestroyEffect(AddSpecialEffectTarget(sfx,d.c,"origin"));
            }
            ReleaseTimer(t);
            d.destroy();
            t = null;
        });
        c = null;
        t = null;
    }
    
    function onInit(){
        RegisterSpellEffectResponse(spell,act);
    }
}
//! endzinc

Panther Rush
Causes this unit to move 20% faster and will gain 40% evasion but will take 20% more damage.
Base: Berserk
Bonus Spell: Evasion inside a Spell Book
Code:
//! zinc
library PantherRush requires TimerUtils,xepreload,SpellEvent{
    constant integer spell = 'A00Z';
    constant integer bap = 'B009';
    constant integer dspell = 'A011';
    
    struct data{
        unit c;
    }
    
    function act(){
        unit c = SpellEvent.CastingUnit;
        data d = data.create();
        timer t = NewTimer();
        d.c = c;
        UnitAddAbility(c,dspell);
        SetPlayerAbilityAvailable(GetOwningPlayer(c),dspell,false);
        SetTimerData(t,d);
        TimerStart(t,0.033,true,function(){
            timer t = GetExpiredTimer();
            data d = GetTimerData(t);
            if(GetUnitAbilityLevel(d.c,bap) < 1){
                SetPlayerAbilityAvailable(GetOwningPlayer(d.c),dspell,true);
                UnitRemoveAbility(d.c,dspell);
                ReleaseTimer(t);
                d.destroy();
            }
            t = null;
        });
        c = null;
        t = null;
    }
    
    function onInit(){
        RegisterSpellEffectResponse(spell,act);
        XE_PreloadAbility(dspell);
    }
}
//! endzinc

The problem is, each time I used Energy Blink and right after the effect of the spell I quickly used Panther Rush, the debug message keeps on displaying.

Edit:
Any ideas? I can't update my map until fixing the problem. :(

Edit 2:
Tried changing Energy Blink base spell from carrion swarm to blink still with the same trigger, and still has problems. Looks like the error triggers when I quickly used Panther Rush while the cast period is not yet done.

Edit 3:
ok now it really pisses me off, made both the spells not using spell event, and still the error keeps on popping out?
__________________
Current Project:
Rise of Sinnergy v1.00

Last edited by Sinnergy : 01-08-2010 at 10:49 AM.
Sinnergy is offline   Reply With Quote
Old 01-11-2010, 01:54 AM   #59
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Sorry for taking this long to get back to you.

When I was developing SpellEvent, I could find no way for a unit to be casting two spells at once (since casting a new spell would always interrupt the previous cast), so the code was not designed to handle that. As it now turns out, spells such as Berserk that do not interrupt orders also do not interrupt other spells, leading to this problem.

Now that I've discovered this weird spell behaviour, I will need to do some further testing before I decide how to fix this, in the meantime, you can fix the problem by using a different base spell.
__________________
Anitarf is offline   Reply With Quote
Old 01-11-2010, 03:04 AM   #60
Sinnergy
User
 
Sinnergy's Avatar
 
Join Date: Apr 2009
Posts: 173

Sinnergy has little to show at this moment (8)

Default

Ok, thanks. Now waiting for the new update.
__________________
Current Project:
Rise of Sinnergy v1.00

Last edited by Sinnergy : 01-11-2010 at 03:04 AM.
Sinnergy is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 08:08 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

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