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 05-12-2009, 07:34 PM   #1
Cheezeman
User
 
Cheezeman's Avatar
 
Join Date: Apr 2009
Posts: 179

Cheezeman has little to show at this moment (1)

Question Simple optimize question

If I would like to have several "A Unit is attacked" events,
would it be better to have just 1 trigger ('object') to check all functions I wanna add,
or a new event for every function?

Simpler:
Is this
Trigger:
Collapse Function1
Collapse Events
Unit - A unit Is attacked
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Triggering unit) has buff Banish) Equal to True
Collapse Then - Actions
Unit - Kill (Triggering unit)
Else - Actions
Collapse Function2
Collapse Events
Unit - A unit Is attacked
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Triggering unit) is A Hero) Equal to True
Collapse Then - Actions
Unit - Kill (Attacking unit)
Else - Actions
Collapse Function3
Collapse Events
Unit - A unit Is attacked
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Triggering unit)) Equal to Rifleman
Collapse Then - Actions
Unit - Explode (Triggering unit)
Else - Actions
better than this
Trigger:
Combined function
Collapse Events
Unit - A unit Is attacked
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Triggering unit) has buff Banish) Equal to True
Collapse Then - Actions
Unit - Kill (Triggering unit)
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Triggering unit) is A Hero) Equal to True
Collapse Then - Actions
Unit - Kill (Attacking unit)
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Triggering unit)) Equal to Rifleman
Collapse Then - Actions
Unit - Explode (Triggering unit)
Else - Actions
__________________
I have no signature yet

Last edited by Cheezeman : 05-12-2009 at 07:35 PM.
Cheezeman is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 05-12-2009, 07:53 PM   #2
cosmicat
Probably AFK
 
cosmicat's Avatar
 
Join Date: Feb 2009
Posts: 635

cosmicat will become famous soon enough (71)cosmicat will become famous soon enough (71)cosmicat will become famous soon enough (71)

Default

To my knowledge, they're the same, since a GUI if/else chain is a function. I may be wrong, but I think the first one is "faster" only during map initialization.
__________________
+++++++++++[>++++++>++++++++++>++++++++++<<<-]>+.>+.++++.+>-.----.------.--.<.
cosmicat is offline   Reply With Quote
Old 05-12-2009, 08:05 PM   #3
Michael Peppers
Lepus?
 
Michael Peppers's Avatar
 
Join Date: Jan 2009
Posts: 1,308

Michael Peppers is a jewel in the rough (188)Michael Peppers is a jewel in the rough (188)Michael Peppers is a jewel in the rough (188)

Default

Quote:
Originally Posted by cosmicat
To my knowledge, they're the same, since a GUI if/else chain is a function. I may be wrong, but I think the first one is "faster" only during map initialization.
Agreed.

Though if you code the 3 functions separately and put the conditions as main conditions of the trigger (and so the Actions too) (not in the If/Then/Else thing), it should be faster.

Well, if that's possible in your case, of course.
__________________
Projects:Tutorials: Competitive AI Step by Step with AI Editor (Pending)
Resources: [AI Script] Michael Peppers's Melee AI template (Pending)

Last edited by Michael Peppers : 05-12-2009 at 08:46 PM.
Michael Peppers is offline   Reply With Quote
Old 05-13-2009, 06:18 AM   #4
0zyx0
Perfectionist noob
 
0zyx0's Avatar
 
Join Date: Mar 2009
Posts: 255

0zyx0 will become famous soon enough (38)0zyx0 will become famous soon enough (38)

Default

This is kind of what he meant:

Trigger:
Collapse Function1
Collapse Events
Unit - A unit Is attacked
Collapse Conditions
((Triggering unit) has buff Banish) Equal to True
Collapse Actions
Unit - Kill (Triggering unit)
Collapse Function2
Collapse Events
Unit - A unit Is attacked
Collapse Conditions
((Triggering unit) is A Hero) Equal to True
Collapse Actions
Unit - Kill (Attacking unit)
Collapse Function3
Collapse Events
Unit - A unit Is attacked
Collapse Conditions
(Unit-type of (Triggering unit)) Equal to Rifleman
Collapse Actions
Unit - Explode (Triggering unit)
__________________
My new signature - Now easier to understand than ever!
0zyx0 is offline   Reply With Quote
Old 05-13-2009, 10:41 AM   #5
Cheezeman
User
 
Cheezeman's Avatar
 
Join Date: Apr 2009
Posts: 179

Cheezeman has little to show at this moment (1)

Default

So correct me if I'm wrong.
It is faster to have them seperated, as long as the event isn't Map Initialization?
__________________
I have no signature yet
Cheezeman is offline   Reply With Quote
Old 05-13-2009, 11:19 AM   #6
Michael Peppers
Lepus?
 
Michael Peppers's Avatar
 
Join Date: Jan 2009
Posts: 1,308

Michael Peppers is a jewel in the rough (188)Michael Peppers is a jewel in the rough (188)Michael Peppers is a jewel in the rough (188)

Default

Yes, it should be faster if you use 3 separated functions without If/Then/Else statements, as I said and 0zxy0 showed. (erm... maybe my post wasn't that clear...)
__________________
Projects:Tutorials: Competitive AI Step by Step with AI Editor (Pending)
Resources: [AI Script] Michael Peppers's Melee AI template (Pending)

Last edited by Michael Peppers : 05-13-2009 at 11:20 AM.
Michael Peppers is offline   Reply With Quote
Old 05-13-2009, 12:48 PM   #7
Bobo_The_Kodo
oO
 
Bobo_The_Kodo's Avatar
 
Join Date: Jul 2008
Posts: 580

Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)

Default

Its faster to have them together, but its really kinda insignificant

Edit: Actually not in GUI, because If/Then/Else in gui is really badly done

Last edited by Bobo_The_Kodo : 05-13-2009 at 12:49 PM.
Bobo_The_Kodo is offline   Reply With Quote
Old 05-13-2009, 03:33 PM   #8
cosmicat
Probably AFK
 
cosmicat's Avatar
 
Join Date: Feb 2009
Posts: 635

cosmicat will become famous soon enough (71)cosmicat will become famous soon enough (71)cosmicat will become famous soon enough (71)

Default

Quote:
Originally Posted by me
since a GUI if/else chain is a function.
__________________
+++++++++++[>++++++>++++++++++>++++++++++<<<-]>+.>+.++++.+>-.----.------.--.<.
cosmicat is offline   Reply With Quote
Old 05-13-2009, 06:57 PM   #9
Cheezeman
User
 
Cheezeman's Avatar
 
Join Date: Apr 2009
Posts: 179

Cheezeman has little to show at this moment (1)

Default

I see, thanks a lot guys...

lol who should I +rep? I'll go with cosmicat cause he was fastest...
__________________
I have no signature yet
Cheezeman is offline   Reply With Quote
Old 05-13-2009, 06:59 PM   #10
cosmicat
Probably AFK
 
cosmicat's Avatar
 
Join Date: Feb 2009
Posts: 635

cosmicat will become famous soon enough (71)cosmicat will become famous soon enough (71)cosmicat will become famous soon enough (71)

Default

Awful nice of you, but the others deserve some too so I'll pass it along to them.
__________________
+++++++++++[>++++++>++++++++++>++++++++++<<<-]>+.>+.++++.+>-.----.------.--.<.
cosmicat is offline   Reply With Quote
Old 05-13-2009, 07:01 PM   #11
Michael Peppers
Lepus?
 
Michael Peppers's Avatar
 
Join Date: Jan 2009
Posts: 1,308

Michael Peppers is a jewel in the rough (188)Michael Peppers is a jewel in the rough (188)Michael Peppers is a jewel in the rough (188)

Default

Quote:
Originally Posted by cosmicat
Awful nice of you, but the others deserve some too so I'll pass it along to them.
How does it feel to beat my quickness in posting? :P

However I admit that before your answer I didn't know what to say about it...
In other words, it's all your fault if I answered. :P
__________________
Projects:Tutorials: Competitive AI Step by Step with AI Editor (Pending)
Resources: [AI Script] Michael Peppers's Melee AI template (Pending)

Last edited by Michael Peppers : 05-13-2009 at 07:04 PM.
Michael Peppers is offline   Reply With Quote
Old 05-13-2009, 07:03 PM   #12
cosmicat
Probably AFK
 
cosmicat's Avatar
 
Join Date: Feb 2009
Posts: 635

cosmicat will become famous soon enough (71)cosmicat will become famous soon enough (71)cosmicat will become famous soon enough (71)

Default

Too late, sucka. I already repped you. No use arguing now.
__________________
+++++++++++[>++++++>++++++++++>++++++++++<<<-]>+.>+.++++.+>-.----.------.--.<.
cosmicat is offline   Reply With Quote
Old 05-14-2009, 04:28 PM   #13
Cheezeman
User
 
Cheezeman's Avatar
 
Join Date: Apr 2009
Posts: 179

Cheezeman has little to show at this moment (1)

Default

Quote:
Originally Posted by cosmicat
Too late, sucka. I already repped you. No use arguing now.
Lol @ arguing over righteous reputation
Thanks anyway for reping the other dudes
__________________
I have no signature yet
Cheezeman 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 07:46 PM.


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