Spell Spell Mirror

N

no0by

Guest
Ok so awhile ago I seen someone making a "spell reflecting" spell and I got inspired, And came up with this spell.

Spell Name: Spell Mirror
Activation Type: Passive, Aura
Hotkey: N/A
Discription:
Any enemy targeted spell has chance of being reflected to a random enemy hero.

Level 1 - 17% Chance.
Level 2 - 31% Chance.
Level 3 - 45% Chance.

Screen Shot:
spellmirrorrw4.jpg


Update1: Minor revision, Added an extra function so you can specify witch if any spells not to be reflected. Added abit more comments and readme (for those realy nooby)
Update2: Minor revision, Tweaked the spell abit and made the texttag 'float upwards' (I just learnt how to do it YAY)
Update3: Minor revision, Optimized code abit and added a new constant for attachment of the effect
Update4: Revised the way the spells are blocked, It will now let the unit cast the spell insted of ordering it to stop (might bug). Two new consants added one for the blocking item id (Rune of Spell Shield) and the other for witch unit the effect is attached.
 

Attachments

  • SPELLMIRRORv1.4.w3x
    26.7 KB · Views: 445
  • SPELLMIRRORv1.5.w3x
    27.9 KB · Views: 927
N

no0by

Guest
Thank you rayquaza218

Also if anyone wants to use it they have my permision as long as they DO NOT take credit for making the spell, I dont need a mention in you're map if you use it.
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
The entire 'creating triggers' thing can be replaced with this
Code:
//===========================================================================
function InitTrig_Spell_Mirror takes nothing returns nothing
    set gg_trg_Spell_Mirror=CreateTrigger()
    call Preload(SpellMirror_EffectS())
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Spell_Mirror,EVENT_PLAYER_UNIT_SPELL_CAST)
    call TriggerAddCondition(gg_trg_Spell_Mirror,Condition(function SpellMirror_MainCond))
    call TriggerAddAction(gg_trg_Spell_Mirror,function SpellMirror_Main)
endfunction
What you do now is just unnecessary.

Other than that: Good work :)
 

SFilip

Gone but not forgotten
Reaction score
634
All those setup functions that simply return a value should be turned intro constants. Why? Vexorian's optimizer inlines all constants so something like this
Code:
constant function GetDamage takes nothing returns real
    return 50.
endfunction

function PrintDamage takes nothing returns nothing
    call BJDebugMsg(R2S(GetDamage()))
endfunction
after optimization becomes
Code:
function PrintDamage takes nothing returns nothing
    call BJDebugMsg(R2S(50.))
endfunction
which is clearly more efficient.

call DestroyTrigger(GetTriggeringTrigger())
Really not needed in InitTrig_Spell_Mirror - Init isn't really running from a trigger so this does nothing.
Actually that whole part can be simplyfied as phyrex1an said ;)

Oh and you might also want to add a screenshot or something and I'll add it to the spell index.
 
N

no0by

Guest
You're right the return functions should be constants but I got some kind of error in WE that prevented me using them, Dont know why sorry I'll change them and see if it sticks.

The learn functions where originaly thought out for reducing lag by not executing the trigger if the hero/spell is never used in the game. Never the less I'll change that too.

As for the screen shot i'll see what I can do.
 

ayumilove

Youtube account suspended! youtube.com/ayumilove8
Reaction score
110
here is a screenshot which i made the hero run merry go around
until the frost nova of the Lich kills their own Warden hero

use my screenshot hehehe <3

3yv9.jpg
 
N

no0by

Guest
Thanks for the consideration ayumilove but I've made a much nicer screen shot.

Also I've Edited my first post with info about the spell and updated a new version of the map with changes made.
 

PhoenixICE

New Member
Reaction score
0
hmmm when i import the trigger i get a multitude of errors...ie/ expected name and a few others any idea why?
 

Tinki3

Special Member
Reaction score
418
I think you need to import the dummy unit(s)? If there are any.. Pretty sure there are though

And if there's anything else you need to import into your map then import that stuff as well.

The trigger might come up with errors because certain custom data might not be there. Custom data as in c. units, abilities.
 
N

no0by

Guest
You need to set afew constants for it to work

Code:
constant function SpellMirror_Caster takes nothing returns integer
    return 'u000' //Replace with rawcode of the unit (dummyunit)
endfunction

Code:
constant function SpellMirror_AbilityId takes nothing returns integer
    return 'A000' //Replace with rawcode of the ability (Spell Mirror)
endfunction

Code:
constant function SpellMirror_BuffId takes nothing returns integer
    return 'B000' //Replace with rawcode of the buff (Spell Mirror)
endfunction

And the custom script of you're map must contain

Code:
function CreateTextTagUnitEx takes unit u, string s, real size, real offset, real speed, real angle, integer red, integer blu, integer gre, integer trans, real life, real fade, boolean show, boolean permanent, boolean suspend returns texttag
    local texttag tt=CreateTextTag()
    local real vel=(speed*.071)/128
    local real xvel=vel*Cos(angle*bj_DEGTORAD)
    local real yvel=vel*Sin(angle*bj_DEGTORAD)
    call SetTextTagText(tt,s,(size*0.023)/10)
    call SetTextTagPos(tt,GetUnitX(u),GetUnitY(u),offset)
    call SetTextTagColor(tt,red,blu,gre,255-trans)
    call SetTextTagVisibility(tt,show)
    call SetTextTagPermanent(tt,permanent)
    call SetTextTagSuspended(tt,suspend)
    call SetTextTagVelocity(tt,xvel,yvel)
    if permanent!=true then
        call SetTextTagLifespan(tt,life)
        call SetTextTagFadepoint(tt,fade)
    endif
    return tt
endfunction

function RandomGroupUnit takes group g returns unit
    local integer i=1
    local integer r
    local unit z
    set bj_groupCountUnits=0
    call ForGroup(g,function CountUnitsInGroupEnum)
    set r=GetRandomInt(1,bj_groupCountUnits)
    loop
        set z=FirstOfGroup(g)
        exitwhen i==r
        call GroupRemoveUnit(g,z)
        set i=i+1
    endloop
    call DestroyGroup(g)
    set g=null
    return z
endfunction

Also make sure the dummyunit has mana e.g 1k atleast
 

PhoenixICE

New Member
Reaction score
0
no i can't even save the map, cause there is errors in the script i copied and set all the varaibles but still doesn't work it says all the constant functions are errors i dunno why...
 

rayquaza218

New Member
Reaction score
51
Pheonix, u probably didn't import variables? I usually import everything in tis order.

Abilities.
units
Variables
trigger.

always works, if some parts are faded out just click it and hit OK, it should work
 
N

no0by

Guest
I had the same problem when making the spell... Try and remove the constants (just remove the constant bit of each function) save then add them back in.
 
G

Gman15100

Guest
im getting two errors i imported everythign and put in all the data im egtting these...

line 659 : expected a name
Code:
set tu=RandomGroupUnit(g) // THIS WILL destroy the group for you (still needs a null tho)

line 673: Expected a function name
call
Code:
CreateTextTagUnitEx(mu,SpellMirror_String(),10.,5.,64.,90.,SpellMirror_SRed(),SpellMirror_SBlu(),SpellMirror_SGre(),64,2.,1.5,true,false,false)

i tryed everything i could but i didnt want to mess around with the lines them selves since im only learning jass now.. i most the basic idea and tweak stuff but i didnt wanna mess with that. I just retyped msot of it exactly to see if it would work but obivously it didn't thanks if u can help.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top