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 > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 07-30-2007, 09:57 PM   #1
TurtleGlove
User
 
TurtleGlove's Avatar
 
Join Date: Jul 2007
Posts: 26

TurtleGlove has little to show at this moment (0)

Default Trigger based AOE targets

Hey, I'm making a "Corpse Explosion" spell and it works perfectly, except for the fact that it also damages allies. I have it built in GUI and it's based off of raise dead. You cast raise dead, and triggers create the explosion effect and have the spell caster deal damage in a circular area around the target of the ability being cast. The only problem with it is it deals damage to the caster and allied units also. I've tried assigning units to a group, and then dealing damage to that group, but I couldn't get it to work, if this method does work could someone help me figure out what I did wrong? Also, if there is a way to set which units are damaged in the "Unit- Cause unit to deal damage in an area" trigger, where is it?
TurtleGlove is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 07-30-2007, 10:05 PM
Beardo
This message has been deleted by Beardo.
Old 07-30-2007, 10:22 PM   #2
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

If you use the function "Unit- Cause unit to deal damage in an area", you can't control which units will receive damage or not. You have to catch the units via group units.
moyack is offline   Reply With Quote
Old 07-30-2007, 10:23 PM   #3
Naakaloh
User
 
Naakaloh's Avatar
 
Join Date: Jun 2003
Posts: 619

Submissions (2)

Naakaloh is a jewel in the rough (155)Naakaloh is a jewel in the rough (155)

Spell Making Session 09 WinnerSpell Making Session 05 Winner

Send a message via AIM to Naakaloh
Default

It's been a while since I've done anything in GUI, but can't you do something like.

Trigger:
Actions
Collapse Unit Group - Pick every unit in (Units within [SomeDistance] of [SomePoint] matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)) and do (Actions)
Collapse Loop - Actions
Do Damage and Stuff
__________________
"The geeks will play their game."
- Kowalski
Naakaloh is offline   Reply With Quote
Old 07-30-2007, 11:22 PM   #4
TurtleGlove
User
 
TurtleGlove's Avatar
 
Join Date: Jul 2007
Posts: 26

TurtleGlove has little to show at this moment (0)

Default

Hmmm. . . alright, lets see, I'm havin' some trouble assigning just enemies to the group now, any suggestions? Also, I'm not completely new to JASS and I'd be very greatful if you posted a JASS solution, I could definately learn from that.

Off topic, but how do you post triggers like Naakaloh?

Last edited by TurtleGlove : 07-30-2007 at 11:22 PM.
TurtleGlove is offline   Reply With Quote
Old 07-30-2007, 11:53 PM   #5
TheSecretArts
Galaxy Scripter
 
TheSecretArts's Avatar
 
Join Date: Mar 2007
Posts: 1,077

Submissions (2)

TheSecretArts will become famous soon enough (38)TheSecretArts will become famous soon enough (38)

Send a message via AIM to TheSecretArts Send a message via MSN to TheSecretArts Send a message via Yahoo to TheSecretArts
Default

the [trigger] tags
__________________
I have officially moved exclusively to Starcraft 2 mapmaking.
Project: Escape Velocity: Nova Reloaded
Don't expect me to finish this project lol...
TheSecretArts is offline   Reply With Quote
Old 07-31-2007, 12:20 AM   #6
Naakaloh
User
 
Naakaloh's Avatar
 
Join Date: Jun 2003
Posts: 619

Submissions (2)

Naakaloh is a jewel in the rough (155)Naakaloh is a jewel in the rough (155)

Spell Making Session 09 WinnerSpell Making Session 05 Winner

Send a message via AIM to Naakaloh
Default

Here's just a simple example of how you might want to damage a group of enemy non-magic-immune units at a given point( x and y) within a given range.

JASS Example

Collapse JASS:
// This is the list of conditions for choosing targets when you enumerate them
// if it returns false the unit is not enumerated.  I used bj_lastReplacedUnit, 
// as the source of the spell, you can use whatever global you want there.
function TargetConditions takes nothing returns boolean

// This checks to see if the unit is an ally of whichever unit you assigned to
// your global that represents the spell's source
    if(IsUnitAlly(GetFilterUnit(), GetOwningPlayer(bj_lastReplacedUnit)))then
        return false
    endif

// This checks to see if the unit is immune to magic
    if(IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE))then
        return false
    endif

    return true

endfunction

// This function actually does the damage; I just used a ForGroup iteration
// Another popular method is a FirstOfGroup iteration, but this should work fine.
// The difference is that ForGroup requires a callback while the FirstOfGroup
// looping can be done inside a function.
function DamageEnumUnit takes nothing returns nothing
    local unit u = GetEnumUnit()

    call UnitDamageTarget(bj_lastReplacedUnit, u, [Damage amount], ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL, null)

    set u = null
endfunction

// This is where you will enumerate the group.  Probably a main function.
function Stuff takes nothing returns nothing
    local boolexpr bx = Condition(function TargetConditions)
    local group g = CreateGroup()
    local real x = [The x value at the center of your area]
    local real y = [The y value at the center of your area]
    local real range = [The radius of the circle in which units are enumerated]

    set bj_lastReplacedUnit = [The source of the spell or damage]
    call GroupEnumUnitsInRange( x, y, range, bx)
    call ForGroup(g, function DamageEnumUnit)

// Cleaning Up the Handles
    call DestroyBoolExpr(bx)
    call DestroyGroup(g)
    set g = null
    set bx = null
endfunction

__________________
"The geeks will play their game."
- Kowalski
Naakaloh is offline   Reply With Quote
Old 07-31-2007, 12:34 AM   #7
TurtleGlove
User
 
TurtleGlove's Avatar
 
Join Date: Jul 2007
Posts: 26

TurtleGlove has little to show at this moment (0)

Default

Hmm, I see what you mean. Could you use GetUnitLoc(GetSpellTargetUnit()) for the x and y instead? or is it something like GetUnitLoc(GetSpellTargetUnit(X)) and GetUnitLoc(GetSpellTargetUnit(Y))? Also, you could use GetUnitAbilityLevelSwapped to create formulas for radius and damage correct?

~Thanks by the way TheSecretarts

Last edited by TurtleGlove : 07-31-2007 at 12:44 AM.
TurtleGlove is offline   Reply With Quote
Old 07-31-2007, 12:44 AM   #8
Naakaloh
User
 
Naakaloh's Avatar
 
Join Date: Jun 2003
Posts: 619

Submissions (2)

Naakaloh is a jewel in the rough (155)Naakaloh is a jewel in the rough (155)

Spell Making Session 09 WinnerSpell Making Session 05 Winner

Send a message via AIM to Naakaloh
Default

Well, I would suggest something like GetLocationX(whichLocation) or GetUnitX(whichUnit)
Edit: And, yes, formulas would be easy to do. For example this returns 50, 75, 100 for levels 1, 2, 3, respectively.

Collapse JASS:
function GetDamageByLevel takes integer level returns real

    return level*25 + 25

endfunction
__________________
"The geeks will play their game."
- Kowalski

Last edited by Naakaloh : 07-31-2007 at 12:47 AM.
Naakaloh is offline   Reply With Quote
Old 07-31-2007, 12:55 AM   #9
TurtleGlove
User
 
TurtleGlove's Avatar
 
Join Date: Jul 2007
Posts: 26

TurtleGlove has little to show at this moment (0)

Default

How would you define the location or unit's x and y values if the effects have to take place at the target of the ability? "level" requires designation somewhere earlier in the script correct? Or does JASS automatically know you're talking about the ability used to trigger the trigger in the first place?

Man, I really need to spend some serious time learning JASS it would be so helpful.

Thanks Naakaloh, even though I've not solved my quandry yet. . .
TurtleGlove is offline   Reply With Quote
Old 07-31-2007, 01:06 AM   #10
Naakaloh
User
 
Naakaloh's Avatar
 
Join Date: Jun 2003
Posts: 619

Submissions (2)

Naakaloh is a jewel in the rough (155)Naakaloh is a jewel in the rough (155)

Spell Making Session 09 WinnerSpell Making Session 05 Winner

Send a message via AIM to Naakaloh
Default

Sorry, I didn't realize I was discussing things you wouldn't get. Note, the variable names are arbitrary, and the ellipses are just denoting that this is a segment of the function.

You would get the casting unit or target unit or location like this:
Collapse JASS:
...
local unit source = GetSpellAbilityUnit()
local unit targetunit = GetSpellAbilityTarget()
local location targetloc = GetSpellTargetLoc()
...
In most cases, GetTriggerUnit() will also work for the casting unit.

You would get the level by declaring an integer and then assigning the level to it like this
Collapse JASS:
...
local integer level = GetUnitAbilityLevel( source, [AbilityCode])
...
The ability code is the four character code associated with the ability, if you need to know what it is you can hit Ctrl+D in the object editor to see it in the ability tree on the left.
__________________
"The geeks will play their game."
- Kowalski
Naakaloh is offline   Reply With Quote
Old 07-31-2007, 02:15 AM   #11
TurtleGlove
User
 
TurtleGlove's Avatar
 
Join Date: Jul 2007
Posts: 26

TurtleGlove has little to show at this moment (0)

Default

Yea, I should have flat out said I'm horrible with JASS. I've only fiddled with JASS and wrote maybe two line triggers before, thanks for sticking with me on this one, I'ma compile what you've added to my knowledge, remake the spell, and then come back with any further questions. Expect to hear from me soon with tales of my failure
TurtleGlove is offline   Reply With Quote
Old 07-31-2007, 06:52 AM   #12
Jazradel
Superuser
 
Jazradel's Avatar
 
Join Date: Dec 2005
Posts: 651

Submissions (1)

Jazradel has a spectacular aura about (110)Jazradel has a spectacular aura about (110)Jazradel has a spectacular aura about (110)Jazradel has a spectacular aura about (110)

Send a message via AIM to Jazradel Send a message via MSN to Jazradel
Default

This is a way to do it in GUI if you care.
Trigger:
Unit Group - Pick every unit in (Units within 512.00 of (Target point of ability being cast) matching (((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)) and do (Actions)
Collapse Loop - Actions
Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Normal
__________________


Table:
Jump Map
Point System
Warcraft III Model Archive

W3 Model Archive should be available from https://www.mediafire.com/folder/cd5..._III_Resources, PM me if it doesn't work.
Jazradel is offline   Reply With Quote
Old 07-31-2007, 10:42 PM   #13
TurtleGlove
User
 
TurtleGlove's Avatar
 
Join Date: Jul 2007
Posts: 26

TurtleGlove has little to show at this moment (0)

Default

Zomg, awesome. I'ma still try to make it in JASS to expand my knowledge but if it doesn't work, GUI is where I'm gonna end up, thanks man.
TurtleGlove is offline   Reply With Quote
Old 07-31-2007, 11:45 PM   #14
Naakaloh
User
 
Naakaloh's Avatar
 
Join Date: Jun 2003
Posts: 619

Submissions (2)

Naakaloh is a jewel in the rough (155)Naakaloh is a jewel in the rough (155)

Spell Making Session 09 WinnerSpell Making Session 05 Winner

Send a message via AIM to Naakaloh
Default

That's basically what I suggested first... though, I don't think Picked Unit works in the filter (the "matching" part), I think you'd have to use Matching Unit
__________________
"The geeks will play their game."
- Kowalski
Naakaloh is offline   Reply With Quote
Old 08-01-2007, 06:15 AM   #15
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


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

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

No, you use Picked Unit.
__________________
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
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 09:34 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2018, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services