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 > Resources > Code Resources > Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 09-23-2008, 06:34 PM   #1
Anitarf
Procrastination Incarnate


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

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 IsUnitSpellResistant

A simple function that should be very useful when making spells compatible with standard melee gameplay; I feel it's just long enough to warrant it's own library, which for the sake of completeness includes the function IsUnitSpellImmune.

Collapse JASS:
library IsUnitSpellResistant

//*****************************************************************
//*  IsUnitSpellResistant
//*
//*  written by: Anitarf
//*
//*  In WC3, most debuff and stun spells have a decreased duration
//*  against heroes, creeps with a high enough level and units with
//*  resistant skin, while other spells such as Polymorph don't
//*  even work against such units. This function checks if a unit
//*  matches any of these criteria that would make it resistant to
//*  such spells, so you can make triggered spells work that way.
//*****************************************************************

    globals
        private constant integer CREEP_RESISTANCE_LEVEL = 6 //the level at which creeps gain spell resistance
    endglobals

    function IsUnitSpellResistant takes unit u returns boolean
        return IsUnitType(u, UNIT_TYPE_HERO) or IsUnitType(u, UNIT_TYPE_RESISTANT) or (GetPlayerId(GetOwningPlayer(u))>11 and GetUnitLevel(u)>=CREEP_RESISTANCE_LEVEL)
    endfunction

    function IsUnitSpellImmune takes unit u returns boolean
        return IsUnitType(u, UNIT_TYPE_MAGIC_IMMUNE)
    endfunction

endlibrary
__________________
Anitarf is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 09-24-2008, 01:57 AM   #2
Here-b-Trollz
Corkscrew Chainsaw!!!
 
Join Date: Jun 2006
Posts: 711

Here-b-Trollz has a spectacular aura about (149)

Hero Contest #2 - 2nd Place

Default

Use of or would get it inlined, and be faster.
Expand JASS:
__________________
By reading this signature, you agree that I cannot be held accountable for anything that I might say or do.
Here-b-Trollz is offline   Reply With Quote
Old 09-24-2008, 02:06 PM   #3
Anitarf
Procrastination Incarnate


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

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

Actually, it won't get inlined by the current JassHelper, but Vex said that in the future it might be so I updated it anyway.
__________________
Anitarf is offline   Reply With Quote
Old 09-24-2008, 11:07 PM   #4
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,514

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

I don't know if I'm overstepping my authority, but I approve.

And we need to start cleaning up the submissions here, so moving this one on its merry way should be a good thing.
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Old 05-13-2011, 11:54 PM   #5
Jewel
User
 
Join Date: Apr 2011
Posts: 6

Jewel has little to show at this moment (4)

Default

Is there any way to change the level at which creeps become resistant? I couldn't find a gameplay constant or anything similar.

Also, does IsUnitType(u, UNIT_TYPE_RESISTANT) depend solely on whether the unit has a Resistant Skill ability?
Jewel is offline   Reply With Quote
Old 05-14-2011, 08:00 AM   #6
Anitarf
Procrastination Incarnate


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

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 Jewel
Is there any way to change the level at which creeps become resistant? I couldn't find a gameplay constant or anything similar.
I didn't find any way to do it when I looked either, but I thought I should make it a constant anyway to make it more understandable.

Quote:
Also, does IsUnitType(u, UNIT_TYPE_RESISTANT) depend solely on whether the unit has a Resistant Skill ability?
I think that's it. I seem to remember that in an earlier version of this script, before it was published, I was checking for those abilities before I discovered the resistant classification. I am fairly sure that when I replaced ability checks with the resistant check, I tested to see if the resistant classification also covers heroes and high level creeps and it turned out it didn't, but this all happened a while ago so I don't remember it very clearly.
__________________
Anitarf is offline   Reply With Quote
Old 05-18-2011, 03:29 AM   #7
DanThanh
User
 
DanThanh's Avatar
 
Join Date: Apr 2009
Posts: 137

Submissions (1)

DanThanh has little to show at this moment (7)

Send a message via Yahoo to DanThanh
Default

Thank you, this script is really useful.
__________________
DanThanh 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 01:41 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