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 09-26-2006, 04:16 AM   #1
darkwulfv
Alpha Male of Wc3c
 
darkwulfv's Avatar


Official Map Reviewer
 
Join Date: Mar 2006
Posts: 3,646

Submissions (6)

darkwulfv is just really nice (270)darkwulfv is just really nice (270)

Send a message via AIM to darkwulfv
Default Why does this not work?

I've had alot of problems with just one set of triggers. I fixed one trigger, but the other one I just don't know how to fix (nor do I see why it wouldn't work)
Collapse JASS:
function Trig_Flame_Stomp_Damage_Conditions takes nothing returns boolean
    if ( GetSpellAbilityId() == 'A004' ) then
    endif
    return true
endfunction

function Buff_Check takes nothing returns boolean
    return ( UnitHasBuffBJ(GetFilterUnit(), 'B001') == true )
endfunction

function Damage takes nothing returns nothing
  local integer i = GetUnitAbilityLevel(GetTriggerUnit(), 'A004')
  local real r = i
    call UnitDamageTargetBJ( GetTriggerUnit(), GetEnumUnit(), ( 2.00 + ( r * 2 ) ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNKNOWN )
endfunction

function Trig_Flame_Stomp_Damage_Actions takes nothing returns nothing
  local unit u = GetTriggerUnit()
  local group g = GetUnitsInRangeOfLocMatching(300.00, GetUnitLoc(u), Condition(function Buff_Check))
  local timer t = CreateTimer()
    call TimerStart( t, 5.00, false, null )
   loop
   exitwhen TimerGetRemaining(t) == 0  
     call ForGroupBJ( g, function Damage )
     call PolledWait( 1.00 )
   endloop
  call RemoveLocation(GetUnitLoc(u))
  set u = null
  set g = null
  set t = null
endfunction
What it is supposed to do:
After a unit beings the effect of Flame Stomp (A004), this trigger kicks in, checking for every unit with the Flame Stomp buff (B001), and puts them in the group variable g. It then loops picking every unit in g and damaging them.

What it does:
nothing.

I'm not too great at JASS, but I just can't seem to find out whats wrong here.
__________________
The Spell Request Thread
Quote:
Originally Posted by Joe-Black-5
a dota like map but with unique stuff
(There was no map attached, and that was all the thread said.)
Spells I've Made

Darkwulfv's Lightning Grapple || Tritanis' Lazy Bolt


Last edited by darkwulfv : 09-26-2006 at 04:18 AM.
darkwulfv is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 09-26-2006, 05:10 AM   #2
Daelin
Kelani Mage
 
Daelin's Avatar
 
Join Date: Oct 2003
Posts: 737

Submissions (48)

Daelin is a glorious beacon of light (474)Daelin is a glorious beacon of light (474)Daelin is a glorious beacon of light (474)Daelin is a glorious beacon of light (474)

Hero Contest - First place

Default

In timer's actions event-responses from main function are all lost. The only reponse you can use is GetExpiredTimer(). Conclusion, you'll have to link to the timer the local variables you want to pass. Use Vexorian's CSCache.

You also have a lot of leaks. group g leaks, location GetUnitLoc(u) is deleted wrongly. Doing something like this:

Collapse JASS:
CreateUnit(blah blah, GetUnitLoc(u)... blah blah)
call RemoveLocation(GetUnitLoc(u))

The remove location is completely wrong. You just create a second location and destroy it. Atleast I think so, if I remember location behaviour correctly. Conclusion? Store the location into a variable, use it, and then remove it through the variable. Because the variable helps you keep the track of the location. Elsewhere it is lost!

Stop using non-BJs uselessly. And optimize that condition function. :)

~Daelin
__________________
I am Grand Magister Daelin Silverwing not Grand Admiral Daelin Proudmoore!!!



Daelin is offline   Reply With Quote
Old 09-26-2006, 05:46 AM   #3
darkwulfv
Alpha Male of Wc3c
 
darkwulfv's Avatar


Official Map Reviewer
 
Join Date: Mar 2006
Posts: 3,646

Submissions (6)

darkwulfv is just really nice (270)darkwulfv is just really nice (270)

Send a message via AIM to darkwulfv
Default

Quote:
In timer's actions event-responses from main function are all lost. The only reponse you can use is GetExpiredTimer(). Conclusion, you'll have to link to the timer the local variables you want to pass. Use Vexorian's CSCache
I didn't quite understand what you were trying to say here, other than the timer's actions were lost, and I should use Vex's CSCache (for what and how?)
Quote:
You also have a lot of leaks. group g leaks, location GetUnitLoc(u) is deleted wrongly. Doing something like this:
Easy to fix. I tend to get a little overzealous and forget to patch some leaks.
EDIT: How does Group g leak?
Quote:
The remove location is completely wrong. You just create a second location and destroy it. Atleast I think so, if I remember location behaviour correctly. Conclusion? Store the location into a variable, use it, and then remove it through the variable. Because the variable helps you keep the track of the location. Elsewhere it is lost!
Good point. I don't know why I didn't do that in the first place. (fixed)
Quote:
Stop using non-BJs uselessly. And optimize that condition function. :)
Every time I use BJs, I'm told not to, so i didn't. What do you mean stop using non-BJs uselessly?? Amd how am I supposed to optimize my condition function? (other than making things into variables, unless that is what you mean)

Thanks for the help, but I'm atrocious at JASS (as you can see), and some of what you said made little/no sense to me. I'll fix the leaks, etc. but the timer problem I will probably need some help with.
__________________
The Spell Request Thread
Quote:
Originally Posted by Joe-Black-5
a dota like map but with unique stuff
(There was no map attached, and that was all the thread said.)
Spells I've Made

Darkwulfv's Lightning Grapple || Tritanis' Lazy Bolt


Last edited by darkwulfv : 09-26-2006 at 05:49 AM.
darkwulfv is offline   Reply With Quote
Old 09-26-2006, 07:40 AM   #4
The)TideHunter(
SpeakerGames.com
 
The)TideHunter('s Avatar
 
Join Date: Mar 2006
Posts: 1,328

Submissions (1)

The)TideHunter( is a jewel in the rough (160)The)TideHunter( is a jewel in the rough (160)

Send a message via MSN to The)TideHunter(
Default

The code seems fine.
You will laugh at this, but...
Its the condition thats causing this to do nothing
Look:

Collapse JASS:
function Trig_Flame_Stomp_Damage_Conditions takes nothing returns boolean
    if ( GetSpellAbilityId() == 'A004' ) then
    endif
    return true
endfunction

It should be:

Collapse JASS:
function Trig_Flame_Stomp_Damage_Conditions takes nothing returns boolean
    if ( GetSpellAbilityId() == 'A004' ) then
        return true
    endif
    return false
endfunction

EDIT: Or maybe you did that for testing...
__________________
Big plans...

Last edited by The)TideHunter( : 09-26-2006 at 07:40 AM.
The)TideHunter( is offline   Reply With Quote
Old 09-26-2006, 08:04 AM   #5
MeanMachine
User
 
Join Date: Feb 2006
Posts: 66

MeanMachine has little to show at this moment (7)

Default

Em, your formula does 4 damage at level 1. That's the problem. Your function can be optimized a lot. Like this.
Optimized Code

Collapse JASS:
function Trig_Flame_Stomp_Damage_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A004' //Optimized, still does the same.
endfunction

function Trig_Flame_Stomp_Damage_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit f
    local group g = CreateGroup() //BJ's are evil. And the location is useless
    // No timer needed for this spell. 5 secs is long enough to be accurate.
    call GroupEnumUnitsInRange(g, GetUnitX(u), GetUnitY(u), 300, null) // This is the native for getting units in range. Passing null for the boolexpr means no condition.
    // And we don't need location, so no leaks here.
    call PolledWait(5.) //A simple wait will be enough here. It leaks a pointer though. You may want to write your own polled wait.
    loop
        set f = FirstOfGroup(g)
        exitwhen f == null // ForGroup and ForForce are almost useless.
        if GetUnitAbilityLevel(f,'B001') > 0 then // Yes. You get a buff level with get unit ability. UnitHasBuffBJ() returns exactly that.
            call UnitDamageTarget(u,f, 2.00 + (GetUnitAbilityLevel(u, 'A004') * 2), false, false, ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,null) // note that your formula does 4 damage at level 1.
        endif
        call GroupRemoveUnit(g,f)
    endloop
    call DestroyGroup(g)
    set u = null
    set g = null
    set f = null
endfunction

__________________
Current Project :

Green TD eXtreme , a made from scratch Green TD :
Status : Creating Units and towers, working on the units' AI
Terrain : 75%
Triggers : 100%
Creeps : 40%
Towers : 70&
Balancing : 0%

Last edited by MeanMachine : 09-26-2006 at 08:06 AM.
MeanMachine is offline   Reply With Quote
Old 09-26-2006, 11:23 AM   #6
darkwulfv
Alpha Male of Wc3c
 
darkwulfv's Avatar


Official Map Reviewer
 
Join Date: Mar 2006
Posts: 3,646

Submissions (6)

darkwulfv is just really nice (270)darkwulfv is just really nice (270)

Send a message via AIM to darkwulfv
Default

My formula is supposed to deal 4 damage at level 1. I'm completely aware of the amount of damage dealt by the formula at every level. That's why I made it. Oh, and I just noticed something. Your code doesn't do the sme thing as mine. The timer was there for a reason. I had a loop that died when the timer hit zero. This trigger is supposed to damage a unit over time, once every second for 5 seconds. I'll still add what optimazations I can but... Your code wasn't entirely correct. Thanks still.

@Tide
Jesus was that all? I've been doing it the way I had it for everything and it seemed to work fine but... Ah well. I'll go fix it now.
__________________
The Spell Request Thread
Quote:
Originally Posted by Joe-Black-5
a dota like map but with unique stuff
(There was no map attached, and that was all the thread said.)
Spells I've Made

Darkwulfv's Lightning Grapple || Tritanis' Lazy Bolt


Last edited by darkwulfv : 09-26-2006 at 11:28 AM.
darkwulfv 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 05:23 AM.


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

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