Spell Runes

moyack

Cool Member
Reaction score
9
Runes
(vJASSified)
By moyack. 2009.

attachment.php

Thanks Kam for the screenshot :)


A long time ago, I did by request a spell for the project Tides of Darkness. Now I decided to vJASSify it and this is the result.

This spell resembles the one in WC2, used by the ogre magi units.


Requirements:

Spell Description:

Warcraft II Strategy: Units said:
The exact nature of the Runes used by Ogre-Magi is unknown to the Humans, but their effect is obvious: anyone straying into the area warded by the Runes is struck by a fiery explosion capable of killing or injuring the hardiest unit. Each "Rune" consists of 5 distinct points, each of which will explode only once. The Runes are also indiscriminate-any unit, friend or foe, that runs over them will be affected. Only flying units are immune to the effects. Since the Runes "float" on top of water, they are pretty good against enemy ships, especially transports.

How to install:

  1. Open the test map.
  2. Copy the trigger and the ability used in this spell into you map. If you have a dummy unit on it, set the unit rawcode in the spell description and in the ability.
  3. Voila!! spell installed.


JASS:
//***************************************************************************************************************
//*                                                                                                             *
//*                                          Runes Spell (vJASSified).                                          *
//*                                                By Moyack.                                                   *
//*                                                  V.2.2.                                                     *
//*                                                                                                             *
//***************************************************************************************************************
//*

library Runes initializer init
//***************************************************************************************************************
//* The constant data where you can modify the ability properties
//*
globals
    private constant integer SpellID = 'A000' // Returns the spell ID. Spell based on Serpent Ward
    private constant integer RuneID  = 'o000' // Returns the dummy summoned unit ID.
    private constant real    dt      = 0.2    // the rate which the runes will detect an unit
endglobals

private constant function Range takes integer lvl returns real
    return 120. + 50. * (lvl - 1) // Returns the range where the runes will detect units
endfunction

private constant function Radius takes integer lvl returns real
    return 2 * Range(lvl) // Returns the radius where the runes will be placed
endfunction

private constant function Amount takes integer lvl returns integer
    return 4 + 1 * (lvl - 1) // Returns the number of runes in the at the perimeter
endfunction

private constant function Damage takes integer lvl returns real
    return 350. + 50. * (lvl - 1) // Returns the damage dealt to units near to the runes
endfunction

private constant function Duration takes integer lvl returns real
    return 40. + 5. * (lvl - 1) // Returns the runes timed life
endfunction

//***************************************************************************************************************
//* end constant data...
//*

globals
    private group G = CreateGroup()
endglobals

private function GetFX takes integer id returns string 
    return GetAbilityEffectById(SpellID, EFFECT_TYPE_SPECIAL, id)
endfunction

private struct rune
    unit c
    player p
    effect f
    real x
    real y
    real d = 0.
    integer l
    integer i
    
    private static integer counter = 0
    private static rune array runes
    private static integer do = 0
    private static integer id = 0
    static unit dummy = null
    
    private static method GetUnits takes nothing returns boolean
        local unit u = GetFilterUnit()
        if GetWidgetLife( u ) > 0.405 and IsUnitType(u, UNIT_TYPE_FLYING) == false then
            call SetUnitOwner(rune.dummy, rune.runes[rune.id].p, false)
            if GetWidgetLife(rune.runes[rune.id].c) > 0.405 then
                call UnitDamageTarget(rune.runes[rune.id].c, u, Damage(rune.runes[rune.id].l), false, false, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_ROCK_HEAVY_BASH)
            else
                call UnitDamageTarget(rune.dummy, u, Damage(rune.runes[rune.id].l), false, false, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_ROCK_HEAVY_BASH)            
            endif
            set rune.do = rune.do + 1
        endif
        set u = null
        return false
    endmethod

    private method onDestroy takes nothing returns nothing
        call DestroyEffect(.f)
        if .d < Duration(.l) then
            call DestroyEffect(AddSpecialEffect(GetFX(1), .x, .y))
            call DestroyEffect(AddSpecialEffect(GetFX(2), .x, .y))
        endif
        set rune.counter = rune.counter - 1
        set rune.runes[rune.counter].i = .i
        set rune.runes[.i] = rune.runes[rune.counter]
    endmethod
    
    static method Start takes unit c, real x, real y returns nothing
        local rune R = rune.allocate()
        if IsPlayerAlly(GetLocalPlayer(), GetOwningPlayer(c)) then
            set R.f = AddSpecialEffect(GetFX(0), x, y)
        else
            set R.f = AddSpecialEffect("Abilities\\Spells\\NightElf\\TreeofLifeUpgrade\\TreeofLifeUpgradeTargetArt.mdl", x, y)
        endif
        set R.c = c
        set R.p = GetOwningPlayer(c)
        set R.x = x
        set R.y = y
        set R.l = GetUnitAbilityLevel(c, SpellID)
        set R.i = rune.counter
        set rune.runes[rune.counter] = integer(R)
        set rune.counter = rune.counter + 1
    endmethod
    
    static method Update takes nothing returns nothing
        local integer i = 0
        loop
            exitwhen i >= rune.counter
            set rune.id = i
            set rune.do = 0
            set rune.runes<i>.d = rune.runes<i>.d + dt
            call GroupEnumUnitsInRange(G, rune.runes<i>.x, rune.runes<i>.y, Range(rune.runes<i>.l), Condition(function rune.GetUnits))
            if rune.do &gt; 0 or rune.runes<i>.d &gt;= Duration(rune.runes<i>.l) then
                call rune.runes<i>.destroy()
            endif
            set i = i + 1
        endloop
    endmethod
endstruct

//***************************************************************************************************************
//*                                                                                                             *
//*                                         Runes Casting Functions                                             *
//*                                                                                                             *
//***************************************************************************************************************

private function Conditions takes nothing returns boolean
    return GetUnitTypeId(GetSummonedUnit()) == RuneID
endfunction

private function Actions takes nothing returns nothing
    local unit c = GetSummoningUnit()
    local unit r = GetSummonedUnit()
    local real lx = GetUnitX(r)
    local real ly = GetUnitY(r) 
    local real fc = GetUnitFacing(c) * bj_DEGTORAD
    local real a = Amount(GetUnitAbilityLevel(c, SpellID))
    local real R = Radius(GetUnitAbilityLevel(c, SpellID))
    local real angle = 2 * bj_PI / a
    local integer count = 0
    local real x
    local real y
    call RemoveUnit(r)
    call rune.Start(c, lx, ly)
    loop
        exitwhen count == a
        set x = lx + R * Cos(fc + count * angle)
        set y = ly + R * Sin(fc + count * angle)
        call rune.Start(c, x, y)
        set count = count + 1
    endloop
    set c = null
    set r = null
endfunction

//===========================================================================
private function init takes nothing returns nothing
    local trigger t= CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SUMMON )
    call TriggerAddCondition( t, Condition( function Conditions ) )
    call TriggerAddAction( t, function Actions )
    call Preload(GetFX(0))
    call Preload(GetFX(1))
    call Preload(GetFX(2))
    set rune.dummy = CreateUnit(Player(15), RuneID, 0,0,0)
    call ShowUnit(rune.dummy, false)
    call TimerStart(CreateTimer(), dt, true, function rune.Update)
    set t = null
endfunction

endlibrary</i></i></i></i></i></i></i></i>



Changelog:
  • 2.0: Initial Release
  • 2.1: Improved the killing credits and performance a little bit more.
  • 2.2: Simplified the code a little bit in the Grouping units, and if the caster is alive in that moment, the killing credit goes to him. Added to the resurrection some eyecandy :D
 

Attachments

  • Clip_4.jpg
    Clip_4.jpg
    71.3 KB · Views: 3,656
  • (1)Runes Spell.w3x
    47.8 KB · Views: 524

Viikuna

No Marlo no game.
Reaction score
265
I feel some nice and smooth wc2 nostalgia. Nice job.

edit. You could maybe make that GetUnits method return false, so you wouldnt have to clear your group.
 

moyack

Cool Member
Reaction score
9
Great spell <3

OffTopic: Hello there , you moved from WC3 to Thehelper?
I just want to post this spells in a neutral place and receive objective comments, thanks for them BTW.

I feel some nice and smooth wc2 nostalgia. Nice job.

edit. You could maybe make that GetUnits method return false, so you wouldnt have to clear your group.
hmmm, yes good idea :)
 

wraithseeker

Tired.
Reaction score
122
For the Range , Radius , Damage , Amount, Duration, you could add in a comment that shows how much those integer things do like for example

JASS:
Range
//100,200,300 (Example only!)
 

Cohadar

master of fugue
Reaction score
209
neutral place
loled.

I love wc2, have some cookies. :thup:

PS: Using timers for area detection is ... not according to my tastes.
You could use dynamic triggers like in this spell.

"Dynamics triggers are bad" is a myth created by bad coders.

EDIT:
I knew runes could look better so I used object editor to place some doodats and see what I can get, here is my best shot:
attachment.php


Doodads - Runes - 'KOdr'
Central: Variation 2, Scale 50%
Upper Left: Variation 6, Scale 110%
Upper Right: Variation 5, Scale 110%
Lower Left: Variation 3, Scale 110%
Lower Right: Variation 4, Scale 110%

Variation 1 can also be used for central rune.

So my suggestion is to make it random by placing:
central rune as Random(1, 2) at 50%
border runes as Random(4, 6) at 110%
rune rotations (around the central one and around themselves) should also be random.

Don't forget to change Runes: Editor - Minimum Scale to 50% (it is 80% by default)
 

Attachments

  • runes.png
    runes.png
    243.2 KB · Views: 1,777

moyack

Cool Member
Reaction score
9
loled.

I love wc2, have some cookies. :thup:

PS: Using timers for area detection is ... not according to my tastes.
You could use dynamic triggers like in this spell.

"Dynamics triggers are bad" is a myth created by bad coders.

EDIT:
I knew runes could look better so I used object editor to place some doodats and see what I can get, here is my best shot:
attachment.php


Doodads - Runes - 'KOdr'
Central: Variation 2, Scale 50%
Upper Left: Variation 6, Scale 110%
Upper Right: Variation 5, Scale 110%
Lower Left: Variation 3, Scale 110%
Lower Right: Variation 4, Scale 110%

Variation 1 can also be used for central rune.

So my suggestion is to make it random by placing:
central rune as Random(1, 2) at 50%
border runes as Random(4, 6) at 110%
rune rotations (around the central one and around themselves) should also be random.

Don't forget to change Runes: Editor - Minimum Scale to 50% (it is 80% by default)

Hmmm, I'll do a test with this runes. One question (I'm away from a pc with WC3) this doodad is one model with multiple animations or they're separated models?

About the dynamic triggers... there's no problem if I can do a kind of recycling (so I can use the TriggerRegisterUnitInRange() stuff or TriggerRegisterEnterRegion()) I'll do the test and I'll post the code so we can see the results and code complexity respect the current one.
 

Cohadar

master of fugue
Reaction score
209
Triggers cannot be recycled if they have events so that is out of the question in this case.
 

Viikuna

No Marlo no game.
Reaction score
265
Hm, so Cohadar, you dont believe in what they say about destroying triggers funcking up the handle indexes?

I have destroyed triggers without problems, but what they say about destroying a triggering trigger causing handle stack corruption sounds pretty convincing to me.

I just wanted to know if you have done some testing around this subject, and want to share some results..

OnTopic: Ye, Those runes look more orcish than those elven runes.
 
Reaction score
91
Cohadar, I was thinking the same until my map crashed for the first time. I ran some tests like the ones suggested at wc3c.net and found out that due to DestroyTrigger() two handles get the same indexes and thus totally screw up some specific methods (attachment systems for instance...).
 

moyack

Cool Member
Reaction score
9
In my case, if I'm going to use triggers, I won't destroy them ever. When I mean doing a recycle is with the variables realated to them (units or the Region's rects for instance), so we can reduce the trigger creation to the minimum.
 

Cohadar

master of fugue
Reaction score
209
Cohadar, I was thinking the same until my map crashed for the first time. I ran some tests like the ones suggested at wc3c.net and found out that due to DestroyTrigger() two handles get the same indexes and thus totally screw up some specific methods (attachment systems for instance...).

That is because you use stupid attachment systems. :p

In my case, if I'm going to use triggers, I won't destroy them ever. When I mean doing a recycle is with the variables realated to them (units or the Region's rects for instance), so we can reduce the trigger creation to the minimum.

That is one possible solution.

============
offtopic:
Pyramidal Defence has at least 20 spells with dynamic triggers, I have never(and this really means zero times) seen it crash.
The other map I made Archmage Survival has a whole physics engine based on dynamic triggers (missile collision with walls) and it also never crashed.

Main reasons for map crashes:
1. You use waits. (which generally means you suck at coding) : 80%
2. You attach stuff to units instead of using indexing (PUI or some other indexing system): 20%
 
Reaction score
91
That is because you use stupid attachment systems. :p
Probably... Is TT stupid? :/ Nevermind, I think it was due to some damage detection system which I removed later on.

> I have never(and this really means zero times) seen it crash.
True, I know you usually use dynamic triggers and I was kind of surprised when there were no crashes even though I played Pyramidal & Archmage over 20 times...
Well, your maps may serve as a proof that ABC/PUI/whatever are the best choices for a mapper. Since I started using a few of your products (I've been using them before but I often move from one to another...) I just wanted to recommend a timer recycling for ABC so it wouldn't require any other snippets/systems.
 

Cohadar

master of fugue
Reaction score
209
offtopic:
I just wanted to recommend a timer recycling for ABC so it wouldn't require any other snippets/systems.
Not gonna happen, I hate systems that try to be all-inclusive.

Moyack you don't really have to recode this to use dynamic triggers. (I said it was only my preference)
But you could hurry up a bit with rune models, I wanna see how it looks in game :D
 

moyack

Cool Member
Reaction score
9
Moyack you don't really have to recode this to use dynamic triggers. (I said it was only my preference)
But you could hurry up a bit with rune models, I wanna see how it looks in game :D
I'll do the testing this night.
 

Viikuna

No Marlo no game.
Reaction score
265
I think this is really cool.


Btw, I kinda like the way you use [lJASS]GetAbilityEffectById[/lJASS] for configurating those special effects, although, I can guess that some people would probably prefer constant strings, because this kinda forces you to work with object editor and everything..

But yea, the spell is cool.
 
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

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top