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 01-21-2010, 11:15 AM   #1
Matarael
User
 
Matarael's Avatar
 
Join Date: Oct 2006
Posts: 260

Submissions (2)

Matarael will become famous soon enough (49)Matarael will become famous soon enough (49)

Default Massive leaking on this trigger (GUI). But I can't figure where.

It's not mine (I believe I picked it up from Hive years ago when it was still called... what was it? Nvm). The idea was simple and I thought I could adapt it but it kept leaking. And so bad that by the 3rd use, the fps drops to under 10.

The trigger basically makes the unit rams towards a target location, and stops at the first enemy unit encountered, dealing damage to it based on how far it "traveled". It also kills trees.

Here is the trigger:

Trigger:
Ram Cast
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Ram
Collapse Actions
Set ramangle = (Angle from (Position of (Triggering unit)) to (Position of (Target unit of ability being cast)))
Set ramangle = (Angle from (Position of (Triggering unit)) to (Target point of ability being cast))
Set ramtarget = (Position of (Target unit of ability being cast))
Set ramtarget = (Target point of ability being cast)
Set ramdamage = 0.00
Set rammaxdistance = (Distance between (Position of (Triggering unit)) and (Target point of ability being cast))
Set ramdistance = 0.00
Set rammer = (Triggering unit)
Special Effect - Create a special effect attached to the origin of rammer using dust.mdx
Set ramdust = (Last created special effect)
Unit - Make rammer Invulnerable
Unit - Pause rammer
Unit - Turn collision for rammer Off
Trigger - Turn on Ram Movement Copy <gen>

And then

Trigger:
Ram Movement Copy
Collapse Events
Time - Every 0.10 seconds of game time
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
ramdistance Less than rammaxdistance
Collapse Then - Actions
Set ramdistance = (ramdistance + 100.00)
Set Ram_loc = ((Position of rammer) offset by 100.00 towards (Facing of rammer) degrees)
Unit - Move rammer instantly to Ram_loc, facing ramangle degrees
Collapse Destructible - Pick every destructible within 200.00 of Ram_loc and do (Actions)
Collapse Loop - Actions
Destructible - Kill (Picked destructible)
Custom script: call RemoveLocation(udg_Ram_loc)
Set ramdamage = (ramdistance / 4.00)
Animation - Play rammer's walk fast animation
Special Effect - Create a special effect attached to the chest of rammer using Abilities\Spells\Human\Defend\DefendCaster.mdl
Special Effect - Destroy (Last created special effect)
Collapse Else - Actions
Trigger - Turn off (This trigger)
Trigger - Run Ram Stop <gen> (checking conditions)

And then

Trigger:
Ram Stop
Events
Conditions
Collapse Actions
Set Ram_loc = (Position of rammer)
Collapse Unit Group - Pick every unit in (Units within 200.00 of Ram_loc matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Owner of (Matching unit)) is an enemy of (Owner of rammer)) Equal to True)))) and do (Actions)
Collapse Loop - Actions
Unit Group - Add (Picked unit) to ramtargets
Unit - Cause rammer to damage (Picked unit), dealing ramdamage damage of attack type Normal and damage type Normal
Custom script: call RemoveLocation(udg_Ram_loc)
Unit - Make rammer Vulnerable
Unit - Unpause rammer
Unit - Turn collision for rammer On
Unit Group - Remove all units from ramtargets
Custom script: call DestroyGroup(udg_ramtargets)
Special Effect - Destroy ramdust
Set ramdamage = 0.00
Set ramdistance = 0.00
Set rammer = No unit

Anyone know why this is happening?
Matarael is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 01-21-2010, 11:31 AM   #2
Anachron
User
 
Anachron's Avatar
 
Join Date: Mar 2009
Posts: 1,079

Anachron will become famous soon enough (51)Anachron will become famous soon enough (51)

Default

Quote:
Unit Group - Add (Picked unit) to ramtargets
Unit Group - Remove all units from ramtargets

I don't see the sense here.

Quote:
Set ramangle = (Angle from (Position of (Triggering unit)) to (Position of (Target unit of ability being cast)))
Set ramangle = (Angle from (Position of (Triggering unit)) to (Target point of ability being cast))
Set ramtarget = (Position of (Target unit of ability being cast))
Set ramtarget = (Target point of ability being cast)
Set rammaxdistance = (Distance between (Position of (Triggering unit)) and (Target point of ability being cast))
Set Ram_loc = ((Position of rammer) offset by 100.00 towards (Facing of rammer) degrees)
Leaks all.
__________________
CustomInventory [Discussion - Download] - Got Directors Cut!
CustomMissle [Discussion - [Download (not yet)] - In development!
Other systems [Spawn System] [Move System] [CustomBar] [SpellBar]
Anachron is offline   Reply With Quote
Old 01-21-2010, 11:54 AM   #3
Matarael
User
 
Matarael's Avatar
 
Join Date: Oct 2006
Posts: 260

Submissions (2)

Matarael will become famous soon enough (49)Matarael will become famous soon enough (49)

Default

But they're all just variables. They get destroyed afterwards.

Right?


I mean, there's that "function" in there.
Matarael is offline   Reply With Quote
Old 01-21-2010, 11:58 AM   #4
Anachron
User
 
Anachron's Avatar
 
Join Date: Mar 2009
Posts: 1,079

Anachron will become famous soon enough (51)Anachron will become famous soon enough (51)

Default

Wehrm, but you never actually destroy them.

Quote:
Set rammaxdistance = (Distance between (Position of (Triggering unit)) and (Target point of ability being cast))
Can only be destroyed if you create 2 variables of type location and then clean them up after setting the distance.

Quote:
((Position of rammer) offset by 100.00 towards (Facing of rammer) degrees)
Put the position of hammer into a new variable and then clean it after settings the new position.
__________________
CustomInventory [Discussion - Download] - Got Directors Cut!
CustomMissle [Discussion - [Download (not yet)] - In development!
Other systems [Spawn System] [Move System] [CustomBar] [SpellBar]
Anachron is offline   Reply With Quote
Old 01-21-2010, 12:07 PM   #5
Matarael
User
 
Matarael's Avatar
 
Join Date: Oct 2006
Posts: 260

Submissions (2)

Matarael will become famous soon enough (49)Matarael will become famous soon enough (49)

Default

Oh damn, so basically I have to create variables FOR variables so they wont leak? LOL I never realised that.

Let me try this. Thanks, and let me know if you can think of something else :)
Matarael is offline   Reply With Quote
Old 01-21-2010, 12:19 PM   #6
Anachron
User
 
Anachron's Avatar
 
Join Date: Mar 2009
Posts: 1,079

Anachron will become famous soon enough (51)Anachron will become famous soon enough (51)

Default

Quote:
((Position of rammer)
Isn't a variable. Its getting a handle that is never been destroyed, because you haven't saved that handle anywhere.
__________________
CustomInventory [Discussion - Download] - Got Directors Cut!
CustomMissle [Discussion - [Download (not yet)] - In development!
Other systems [Spawn System] [Move System] [CustomBar] [SpellBar]
Anachron is offline   Reply With Quote
Old 01-23-2010, 05:10 PM   #7
Matarael
User
 
Matarael's Avatar
 
Join Date: Oct 2006
Posts: 260

Submissions (2)

Matarael will become famous soon enough (49)Matarael will become famous soon enough (49)

Default

Damnit, it's still causing lags after 5-6 uses... Does anyone know of a similar trigger which does basically the same thing but doesn't lag?

I'm getting a bit sick of this one (literally, the lags is causing me to feel nauseous) but I don't wish to change it.
Matarael is offline   Reply With Quote
Old 01-24-2010, 02:32 AM   #8
thehellman
User
 
Join Date: Jan 2006
Posts: 158

Submissions (2)

thehellman has little to show at this moment (4)

Default

Post the new code.
thehellman is offline   Reply With Quote
Old 01-24-2010, 12:55 PM   #9
Matarael
User
 
Matarael's Avatar
 
Join Date: Oct 2006
Posts: 260

Submissions (2)

Matarael will become famous soon enough (49)Matarael will become famous soon enough (49)

Default

Interestingly, I managed to reduce the lag to just above 10 fps (around 14, before the changes it could go down to about 8 fps when used more than once), so whatever was changed was doing something. I suspect it has something to do with the special effect but I cannot be certain.
Anyway, here it is the "improved" yet still lagging code:

Hidden information:


Trigger:
Ram Cast
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Ram
Collapse Actions
Set rammer = (Triggering unit)
Set rammerposition = (Position of rammer)
Set ramtarget = (Position of (Target unit of ability being cast))
Set ramtarget = (Target point of ability being cast)
Set ramangle = (Angle from rammerposition to ramtarget)
Set ramdamage = 0.00
Set rammaxdistance = (Distance between rammerposition and ramtarget)
Set ramdistance = 0.00
Special Effect - Create a special effect attached to the origin of rammer using dust.mdx
Set ramdust = (Last created special effect)
Special Effect - Destroy ramdust
Animation - Play rammer's walk fast animation
Animation - Change rammer's animation speed to 0.00% of its original speed
Unit - Make rammer Invulnerable
Unit - Pause rammer
Unit - Turn collision for rammer Off
Trigger - Turn on Ram Movement ori <gen>

Trigger:
Ram Movement ori
Collapse Events
Time - Every 0.05 seconds of game time
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
ramdistance Less than rammaxdistance
Collapse Then - Actions
Set Ram_loc = (rammerposition offset by 50.00 towards (Facing of rammer) degrees)
Unit - Move rammer instantly to Ram_loc, facing ramangle degrees
Set rammerposition = (Position of rammer)
Set ramdistance = (ramdistance + 50.00)
Set ramdamage = (ramdistance / 4.00)
Collapse Unit Group - Pick every unit in (Units within 200.00 of (Position of rammer) matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Owner of (Matching unit)) is an ally of (Owner of rammer)) Equal to False)))) and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Picked unit) Not equal to rammer
Collapse Then - Actions
Unit Group - Add (Picked unit) to ramtargets
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Number of units in ramtargets) Greater than 0
Collapse Then - Actions
Trigger - Turn off (This trigger)
Trigger - Run Ram Stop <gen> (checking conditions)
Collapse Else - Actions
Do nothing
Else - Actions
Collapse Else - Actions
Trigger - Turn off (This trigger)
Trigger - Run Ram Stop <gen> (checking conditions)

Trigger:
Ram Stop
Events
Conditions
Collapse Actions
Collapse Destructible - Pick every destructible within 200.00 of Ram_loc and do (Actions)
Collapse Loop - Actions
Destructible - Kill (Picked destructible)
Collapse Unit Group - Pick every unit in (Units within 200.00 of Ram_loc matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Owner of (Matching unit)) is an enemy of (Owner of rammer)) Equal to True)))) and do (Actions)
Collapse Loop - Actions
Unit Group - Add (Picked unit) to ramtargets
Unit - Cause rammer to damage (Picked unit), dealing ramdamage damage of attack type Normal and damage type Normal
Custom script: call RemoveLocation(udg_Ram_loc)
Custom script: call RemoveLocation(udg_rammerposition)
Custom script: call RemoveLocation(udg_ramtarget)
Unit - Make rammer Vulnerable
Unit - Unpause rammer
Unit - Turn collision for rammer On
Unit Group - Remove all units from ramtargets
Custom script: call DestroyGroup(udg_ramtargets)
Special Effect - Create a special effect attached to the origin of rammer using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
Set ramdust = (Last created special effect)
Special Effect - Destroy ramdust
Animation - Change rammer's animation speed to 100.00% of its original speed
Set ramdamage = 0.00
Set ramdistance = 0.00
Set rammer = No unit

Matarael is offline   Reply With Quote
Old 01-24-2010, 07:54 PM   #10
Anitarf
Procrastination Incarnate


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

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

You are leaking the locations rammerposition and Ram_loc in the movement trigger, that is 40 locations per second.

Also, it seems like it is possible for the spell to do double or even triple damage if the rammer comes in range of multiple units with one periodic move (since Ram Stop would be run multiple times).
__________________
Anitarf is offline   Reply With Quote
Old 01-24-2010, 10:21 PM   #11
Matarael
User
 
Matarael's Avatar
 
Join Date: Oct 2006
Posts: 260

Submissions (2)

Matarael will become famous soon enough (49)Matarael will become famous soon enough (49)

Default

Holy crap 40 locs/second... No wonder it drops 10 fps per use. Can you be specific as to where it's leaking? I'm not going to lie, I'm still hazy about what causes leaks and what doesn't.

Thanks, mate.
Matarael is offline   Reply With Quote
Old 01-24-2010, 10:33 PM   #12
Anitarf
Procrastination Incarnate


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

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

"Set rammerposition = (Position of rammer)"
You are creating a new location and storing it in the rammerposition variable here without first destroying the location that was stored in that variable previously.

"Set Ram_loc = (rammerposition offset by 50.00 towards (Facing of rammer) degrees)"
Same here, only for Ram_loc.
__________________
Anitarf is offline   Reply With Quote
Old 01-24-2010, 10:36 PM   #13
blanc_dummy
User
 
blanc_dummy's Avatar
 
Join Date: Jun 2007
Posts: 106

Submissions (1)

blanc_dummy has little to show at this moment (7)

Send a message via Yahoo to blanc_dummy
Default

group also leak, do this

Trigger:
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units within 200.00 of (Position of rammer) matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Owner of (Matching unit)) is an ally of (Owner of rammer)) Equal to False)))) and do (Actions)

or store the group instantly to a variable, and then destroy it manually
Trigger:
Set GroupVar = Pick every unit in (Units within 200.00 of (Position of rammer) matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Owner of (Matching unit)) is an ally of (Owner of rammer)) Equal to False)))) and do (Actions)
Unit Group - Pick every unit in GroupVar and do (Unit - Hide (Picked unit))
Custom script: call DestroyGroup(udg_GroupVar)
__________________
blanc_dummy is offline   Reply With Quote
Old 01-24-2010, 11:07 PM   #14
Matarael
User
 
Matarael's Avatar
 
Join Date: Oct 2006
Posts: 260

Submissions (2)

Matarael will become famous soon enough (49)Matarael will become famous soon enough (49)

Default

Wait let me get this straight... Storing something in a variable doesn't delete/clear the previous one? Why did I get an impression that it overwrites the previous "set"/store function?

Is what you're saying before I store another position I have to first clear/destroy the previous position first?
Matarael is offline   Reply With Quote
Old 01-25-2010, 03:43 AM   #15
SmileyJeff
User
 
Join Date: Jan 2006
Posts: 139

SmileyJeff is on a distinguished road (11)

Send a message via MSN to SmileyJeff
Default

Nope it doesn't delete. Instead it points the variable towards the new position. Leaving that old position hanging therefore leak because you can't point it back anymore.
__________________
Disapproving all GUI systems because JASS is more efficient is like asking all people to change from Windows to Command Line Interface.
SmileyJeff 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 12:13 AM.


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

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