|
|
#1 |
|
master of fugue
Join Date: Jun 2007
Posts: 2,558
![]() ![]() ![]() ![]()
|
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:
Focus/Multishot
Last edited by cohadar : 01-20-2012 at 09:58 PM. |
|
|
|
| Sponsored Links - Login to hide this ad! |
|
|
|
|
#2 |
|
Procrastination Incarnate
Development Director
|
Here you go:
__________________ 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. |
|
|
|
|
|
#3 |
|
master of fugue
Join Date: Jun 2007
Posts: 2,558
![]() ![]() ![]() ![]()
|
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 ![]() |
|
|
|
|
|
#4 | |||||
|
Procrastination Incarnate
Development Director
|
Quote:
Quote:
Quote:
Quote:
Quote:
|
|||||
|
|
|
|
|
#5 | |
|
master of fugue
Join Date: Jun 2007
Posts: 2,558
![]() ![]() ![]() ![]()
|
Quote:
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. |
|
|
|
|
|
|
#6 |
|
la la la
Terrain Moderator
Join Date: Jan 2006
Posts: 428
![]() ![]()
|
So grateful for someone trying to help, now I want to help you too!
|
|
|
|
|
|
#7 |
|
master of fugue
Join Date: Jun 2007
Posts: 2,558
![]() ![]() ![]() ![]()
|
But you can't because of all other important stuff you are doing on wc3c right now...
__________________ |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
|
Donate |