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,649
  • (1)Runes Spell.w3x
    47.8 KB · Views: 514

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,768

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.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top