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 > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 01-20-2012, 09:57 PM   #1
cohadar
master of fugue
 
cohadar's Avatar
 
Join Date: Jun 2007
Posts: 2,453

Submissions (5)

cohadar is a jewel in the rough (246)cohadar is a jewel in the rough (246)cohadar is a jewel in the rough (246)cohadar is a jewel in the rough (246)cohadar is a jewel in the rough (246)

Default 4vsUndead - spell request thread.

I need some spells done for heroes in 4vsUndead.
Anyone willing to do a spells gets rep and credits in the map ofc.

Before starting to work on a spell please post that you intend to do it so we don't have two people doing same stuff.
(in case we still have 2 spellmakers left in here, heh)

Mark of Archer:
  • Normal spell, 3 levels
  • Single Unit target
  • Archer fires X (depends on spell level) arrows on marked target with bonus speed
  • If target dies before X arrows are fired, spell ends
  • if archer attacks someone else before X arrows are fired, spell ends
  • moving around does not break the spell
  • spell must be mui (two archers can mark the same target)

Focus/Multishot
  • Skill, 1 level
  • Immediate, 2 states (like defend, manashield or immolation)
  • In focused state archer attacks single targets and has critical chance
  • in multishot state archer attacks with 3 arrows but each arrow deals 50% damage
__________________
Omg database crash deleted my signature, as a side effect this immensely improved wc3c.

Last edited by cohadar : 01-20-2012 at 09:58 PM.
cohadar is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 01-21-2012, 12:21 AM   #2
Anitarf
Procrastination Incarnate


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

Submissions (19)

Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)

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

Default

Here you go:
Collapse Zinc:
//! zinc

library MarkOfArcher requires SpellEvent, Table
{
    constant integer SPELL_ABILITYID = 'A000'; //The spell ability.
    constant integer BONUS_ABILITYID = 'A001'; //The passive ability that is added to the caster.
    
    constant boolean ADD_ATTACKS = true; //If a spell is still active when its caster casts it again on
                                         //the same target, should the attack limit of the two be added
                                         //together or should the old remaining attacks be discarded?

    function AttackCount( integer level ) -> integer
    { return 5+level*5; } //The number of attacks that the spell will remain active for.
    
//----- END OF SPELL CALIBRATION -----//

    struct mark
    {

        unit target, caster; integer level; //Spell data.
        static HandleTable targetTable, casterTable; //Tables for quick instance access.
        thistype next, prev; //The next and previous instances in the target's list of spells.
        integer attacks; //How many attacks left until the spell stops.

        method destroy()
        {
            if (next==0 && prev==0) {
                targetTable.flush(target); //This is the last item in the list, flush the target table.
            } else {
                if (next!=0) next.prev=prev; //There is an item after this one in the list, relink it.
                if (prev!=0) prev.next=next; //There is an item before this one in the list, relink it.
                else targetTable[target]=integer(next); //This was the first item in list, move forward.
            }
            UnitRemoveAbility(caster, BONUS_ABILITYID); //Remove the bonus ability from the caster.
            casterTable.flush(caster); //Flush the caster table.
            target=null; caster=null; //Cleanup the handle variables.
            // do not reset next and prev, they may still be needed in the calling function.
            deallocate();
        }
        
        static method create( unit t, unit c, integer lvl ) -> thistype
        {
            thistype this;
            thistype that = thistype(targetTable[t]); //See if the caster already has this spell cast on an enemy.
            if (that!=0) {
                if (that.target==t) { //If the existing instance has the same target then simply update and return it.
                    static if (ADD_ATTACKS) that.attacks=that.attacks+AttackCount(lvl);
                    else that.attacks=AttackCount(lvl);
                    return that;
                } else { //If the existing instance has a different target then destroy it and allocate a new one.
                    that.destroy();
                    this=allocate();
                }
            }
            UnitAddAbility(c, BONUS_ABILITYID); //Add the bonus ability to the caster.
            SetUnitAbilityLevel(c, BONUS_ABILITYID, lvl); //Set the level of the bonus ability accordingly.
            UnitMakeAbilityPermanent(c, true, BONUS_ABILITYID); //Prevent morph abilities from removing this ability.
            target=t; caster=c; level=lvl; //Store spell data values.
            attacks=AttackCount(lvl);
            //Insert the spell instance at the start of the target's linked list:
            that = thistype(targetTable[t]); //See if the target is already under the effect of this spell.
            if (that==0) {
                next=0; prev=0;
            } else {
                that.prev=this;
                next=that; prev=0;
            }
            //Store the spell instance in the tables.
            targetTable[t]=integer(this); casterTable[c]=integer(this);
            return this;
        }
        
        static method onDeath()
        {
            thistype this = thistype(targetTable[GetTriggerUnit()]);
            while (this>0) //Destroy all instances in the unit's list.
            {
                this.destroy(); //When this is called on the last instance it will flush the table.
                this=this.next; //Destroy method does not reset the next value so this works.
            }
        }

        static method onAttack()
        {
            thistype this = thistype(casterTable[GetAttacker()]); 
            if (this>0) {
                if (target!=GetTriggerUnit()) destroy(); //If the caster has switched targets, destroy.
                else {
                    attacks=attacks-1;
                    if (attacks<=0) destroy(); //If the spell ran out of attacks, destroy.
                }
            }
        }

        static method onSpellEffect()
        {
            integer lvl = GetUnitAbilityLevel( SpellEvent.CastingUnit, SPELL_ABILITYID );
            thistype.create( SpellEvent.CastingUnit, SpellEvent.TargetUnit, lvl );
        }

        static method onInit()
        {
            trigger t;
            targetTable=HandleTable.create();
            casterTable=HandleTable.create();
            RegisterSpellEffectResponse( SPELL_ABILITYID, thistype.onSpellEffect );

            t=CreateTrigger();
            TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH);
            TriggerAddAction(t, function thistype.onDeath);

            t=CreateTrigger();
            TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ATTACKED);
            TriggerAddAction(t, function thistype.onAttack);
        }
    }

}

//! endzinc


P.S.: This would have been better with ABuff, but you already know that. :P
__________________

Last edited by Anitarf : 01-21-2012 at 12:23 AM.
Anitarf is offline   Reply With Quote
Old 01-21-2012, 06:56 AM   #3
cohadar
master of fugue
 
cohadar's Avatar
 
Join Date: Jun 2007
Posts: 2,453

Submissions (5)

cohadar is a jewel in the rough (246)cohadar is a jewel in the rough (246)cohadar is a jewel in the rough (246)cohadar is a jewel in the rough (246)cohadar is a jewel in the rough (246)

Default

Goddamit Anitarf, you did not announce your work, your solutions is in ZINC, and there is no demo map.
Did you even try to compile this?

Oh I am sure it is ok, but you just keep half-assing your work.
Now I have to retype this to JASS....

For the future reference, please no ZINC.
I am trying to be consistent with my map code.

PS: I finally got it, I can make you do all my buff spells,
you will do it just so you can bitch about me not using ABuff
__________________
Omg database crash deleted my signature, as a side effect this immensely improved wc3c.
cohadar is offline   Reply With Quote
Old 01-21-2012, 04:08 PM   #4
Anitarf
Procrastination Incarnate


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

Submissions (19)

Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)

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

Default

Quote:
Originally Posted by cohadar
Goddamit Anitarf, you did not announce your work, your solutions is in ZINC, and there is no demo map.
There was no mention of demo maps or Zinc in the first post, so you have no business complaining about those. As for not announcing my work, it wasn't very likely that someone else would strt coding right away like I did and even if someone else did do that then all I'd be wasting would have been my time which, again, does not concern you. I guess I'll announce any further intentions from now on so people won't think that I might be working on a spell that I actually have no intention of making.

Quote:
Did you even try to compile this?
Yes, it compiles.

Quote:
Oh I am sure it is ok, but you just keep half-assing your work.
I do not agree with that characterization. Sure, I avoid opening the object editor unless it is absolutely necessary, but as far as code is concerned I do not cut corners. I included everything from a proper calibration section to detailed comments in the code.

Quote:
For the future reference, please no ZINC.
I am trying to be consistent with my map code.
I don't know why you're asking for contributions, then. Even vJass code from other users won't be the same as yours. Furthermore, I don't see what purpose this consistency serves. If you rewrite this in vJass it won't function any differently, it will be just a waste of your time.

Quote:
PS: I finally got it, I can make you do all my buff spells,
you will do it just so you can bitch about me not using ABuff
Don't count on it, especially if you make demo maps and vJass explicit requirements. Doing that will greatly reduce the odds of me writing any further contributions.
__________________
Anitarf is offline   Reply With Quote
Old 01-21-2012, 05:56 PM   #5
cohadar
master of fugue
 
cohadar's Avatar
 
Join Date: Jun 2007
Posts: 2,453

Submissions (5)

cohadar is a jewel in the rough (246)cohadar is a jewel in the rough (246)cohadar is a jewel in the rough (246)cohadar is a jewel in the rough (246)cohadar is a jewel in the rough (246)

Default

Quote:
Originally Posted by Anitarf
I avoid opening the object editor unless it is absolutely necessary
...
especially if you make demo maps and vJass explicit requirements.

Do you honestly believe I opened this thread because I lack in coding skills?

What good are contributions if they don't save me time.
You coded this spell in about 5 minutes and that is exactly how much your contribution is worth. If you bothered to open object editor and spend 5 more minutes on it by finding appropriate abilities and icons it would double the value of your contribution.
If you even bothered to write the tooltips it would triple the value of your contribution.

So as you see pure coding may look like the most important part but in terms of value it is below half and so I call it half-assed work.

Of course me requiring the work to be done properly will greatly reduce the probability of it being done as you said.
It is because the full work has bigger time price, but than again that is what actually makes it valuable.
__________________
Omg database crash deleted my signature, as a side effect this immensely improved wc3c.
cohadar is offline   Reply With Quote
Old 01-21-2012, 08:36 PM   #6
2-P
la la la
 
2-P's Avatar


Terrain Moderator
 
Join Date: Jan 2006
Posts: 429

Submissions (14)

2-P is a glorious beacon of light (423)2-P is a glorious beacon of light (423)2-P is a glorious beacon of light (423)

Default

So grateful for someone trying to help, now I want to help you too!
2-P is offline   Reply With Quote
Old 01-21-2012, 09:10 PM   #7
cohadar
master of fugue
 
cohadar's Avatar
 
Join Date: Jun 2007
Posts: 2,453

Submissions (5)

cohadar is a jewel in the rough (246)cohadar is a jewel in the rough (246)cohadar is a jewel in the rough (246)cohadar is a jewel in the rough (246)cohadar is a jewel in the rough (246)

Default

But you can't because of all other important stuff you are doing on wc3c right now...
__________________
Omg database crash deleted my signature, as a side effect this immensely improved wc3c.
cohadar 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 03:04 AM.


Donate

Affiliates
The Hubb http://bylur.com - Warcraft, StarCraft, Diablo and DotA Blog & Forums The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

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