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 > Tutorials > Trigger (GUI)/ AI editor Tutorials
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 03-20-2005, 01:21 AM   #1
johnfn
Taur is... MY SISTER!!!


Respected User
 
Join Date: Jan 2004
Posts: 1,633

Submissions (3)

johnfn has a spectacular aura about (129)

Send a message via AIM to johnfn
Default More effecient triggering

I'm just going to go through a few of the biggest things in triggering that will literally save you hours of time when you trigger.


I'll update this whenever I have time/feel like it :P

The Structure

"The structure," you say, "It sounds like a building!" Well, unfortunately, it has nothing to do with a construction. However it is an incredibly helpful triggering tool that not very many people know about. In the most basic terms, its like several arrays of data, accessable by the array index. You'll get used to this from practice.

Why would I want one?

Well, lets say you were making a TD. You wanted to have different units every level, but you also wanted to have a different amount of units every level. Without knowing anything about a structure, you might write something like this

Trigger:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Level Equal to 1
Collapse Then - Actions
Unit - Create 15 Footman for Player 9 (Gray) at (SpawnRegion) facing Default building facing degrees
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Level Equal to 2
Collapse Then - Actions
Unit - Create 20 Priest for Player 9 (Gray) at (SpawnRegion) facing Default building facing degrees
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Level Equal to 3
Collapse Then - Actions
Unit - Create 50000 Rifleman for Player 9 (Gray) at (SpawnRegion) facing Default building facing degrees //ouch
Collapse Else - Actions
//and so on
Looks terrible, doesnt it?


Well, you should realize the need for a structure when you see a lot of repeating code like this. Thats the first and most obvious sign that you need one.

So how do I go about making one of these?

Well, first you need to make two arrays. They will be an array of unit types (the unit type in the TD) and an array of integers (the amount of units). Why are you doing this? Well, a structure is when you combine two or more related data types into one. So I am going to have the integers correspond to the unit-types, so that instead of a lot of if statements, I can just use the index to get the stats of whatever level I like.


This will naturally come at the beginning of the map. So lets see where this will take us:

Trigger:
Collapse Init
Collapse Events
Time - Elapsed game time is 0.10 seconds
OR
Map initialization
Conditions
Collapse Actions
--------Footman Info--------
Set Units[1] = Footman
Set AmountOfUnits[1] = 15
--------Priest Info--------
Set Units[2] = Priest
Set AmountOfUnits[2] = 20
--------Rifleman Info--------
Set Units[3] = Rifleman
Set AmountOfUnits[3] = 50000 //still ouch

Destroy (This trigger) //effeciency

You should be starting to see where this is going, no?

Well, now what we are going to do access the structure with the index number of the level that the TD is. You will be suprised just how short the code got:

Trigger:
NewLevel
Collapse Events
Time - TmrNewLevel expires
Conditions
Collapse Actions
Set Level = Level + 1 //just for clarification
Unit - Create AmountOfUnits[Level] Units[Level] for Player 9 (Gray) at (SpawnRegion) facing Default building facing degrees



"But wait!" I say. "What if you want them to come out of a different region each time?". Surely you now know where I am going with this. Time to add another variable to the structure, and you should be able to guess at this code (if not, then reread the tutorial)

Trigger:
Init
Collapse Events
Time - Elapsed game time is 0.10 seconds
Conditions
Collapse Actions
--------Footman Info--------
Set Units[1] = Footman
Set AmountOfUnits[1] = 15
Set SpawnRegion[1] = (SpawnRegion1)
--------Priest Info--------
Set Units[2] = Priest
Set AmountOfUnits[2] = 20
Set SpawnRegion[2] = (SpawnRegion2)
--------Rifleman Info--------
Set Units[3] = Rifleman
Set AmountOfUnits[3] = 500000 //...
Set SpawnRegion[3] = (SpawnRegion3)

And then the last piece:

Trigger:
NewLevel
Collapse Events
Time - TmrNewLevel expires
Conditions
Collapse Actions
Unit - Create AmountOfUnits[(Level)] Units[(Level)] for Player 9 (Gray) at (Center of SpawnRegion[Level]) facing Default building facing degrees


Alright, I hope that helps with your understanding of triggers and general, and saves you time when you have a lot of repititive triggers to write.
__________________
Zone Control. Give it a try!

Taur: btw dun tell anyone but I bribed the wc3c admins with a life supply of packaged peanuts to host UL ^^

Taur | Unsung Legends says:
guess what blade?
Blade.dk says:
JOHN IS YO BRO!


johnfn is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 03-21-2005, 07:20 PM   #2
Hunter_Destruction
 
Posts: n/a
Default

Wow I'd give ya rep if I could but:
"You must spread some rep before giving it to johnfn again"
So until I can give ya rep I'll post :D
Ok wow this helps A LOT instead of having to do time elapsed...create unit...at region... it cuts it down A LOT ;) and please do update it if you have time (and if you don't mind get into the variables ^_^ ) But you don't have to. Anyways..
Thx for the tutorial johnfn~
~Piece
  Reply With Quote
Old 07-07-2005, 02:09 PM   #3
MeTaCo
User
 
Join Date: Aug 2003
Posts: 80

MeTaCo has little to show at this moment (0)

Default

Well explained, and yes a lot of time saved, not only that but File size would definately be saved too, and less leaks!
__________________

Oh yeh baby.. YoUr AsIaN mAsTuH!
MeTaCo is offline   Reply With Quote
Old 12-30-2005, 05:58 AM   #4
DD_Draco
User
 
Join Date: Dec 2005
Posts: 213

DD_Draco has little to show at this moment (7)

Default

Nice tutorial serves its purpose an well explained, as MeTaCo said is saves file size and will reduce leaks gj.
DD_Draco is offline   Reply With Quote
Old 12-30-2005, 10:40 AM   #5
AnarkiNet
User
 
Join Date: Sep 2003
Posts: 705

AnarkiNet is on a distinguished road (22)

Default

good for beginners. i'd reccomend editing it with the new trigger tags though :)
AnarkiNet is offline   Reply With Quote
Old 01-15-2006, 09:05 PM   #6
johnfn
Taur is... MY SISTER!!!


Respected User
 
Join Date: Jan 2004
Posts: 1,633

Submissions (3)

johnfn has a spectacular aura about (129)

Send a message via AIM to johnfn
Default

Done!

It looks a lot better now :)
__________________
Zone Control. Give it a try!

Taur: btw dun tell anyone but I bribed the wc3c admins with a life supply of packaged peanuts to host UL ^^

Taur | Unsung Legends says:
guess what blade?
Blade.dk says:
JOHN IS YO BRO!


johnfn is offline   Reply With Quote
Old 01-16-2006, 03:41 AM   #7
Ignitedstar
Moderator
 
Ignitedstar's Avatar


RP Section Moderator
 
Join Date: Jul 2005
Posts: 1,755

Ignitedstar has a spectacular aura about (102)Ignitedstar has a spectacular aura about (102)Ignitedstar has a spectacular aura about (102)Ignitedstar has a spectacular aura about (102)

Send a message via MSN to Ignitedstar Send a message via Yahoo to Ignitedstar
Default

Good job. It's nice to see something that will save time and space. :)
Ignitedstar is offline   Reply With Quote
Old 02-02-2006, 05:42 PM   #8
MrApples
Banned
 
MrApples's Avatar
 
Join Date: Jul 2005
Posts: 343

Submissions (3)

MrApples is on a distinguished road (16)

Default

Why do you do stuff at Elapsed Game Time is 0.10 seconds, thats not efficent triggering. Using Map Initlization may increase your loading time by a quater second, but its worth it over the lag your going to get for doing starting triggers at 0.10.
MrApples is offline   Reply With Quote
Old 02-02-2006, 06:09 PM   #9
Captain Griffen
Dread Lord of the Cookies
 
Captain Griffen's Avatar


Content Director
 
Join Date: Sep 2003
Posts: 5,375

Submissions (2)

Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)

Approved Map: Warlords[Quicksilver #2] - 1st Place

Default

It would also be more efficient to destroy single time running triggers afterwards.
Captain Griffen is offline   Reply With Quote
Old 02-03-2006, 01:23 AM   #10
johnfn
Taur is... MY SISTER!!!


Respected User
 
Join Date: Jan 2004
Posts: 1,633

Submissions (3)

johnfn has a spectacular aura about (129)

Send a message via AIM to johnfn
Default

Quote:
Originally Posted by MrApples
Why do you do stuff at Elapsed Game Time is 0.10 seconds, thats not efficent triggering. Using Map Initlization may increase your loading time by a quater second, but its worth it over the lag your going to get for doing starting triggers at 0.10.

Yeah, me using 0.10 stems from me doing EVERYTHING in init (that includes initializing multiboards) Also, certain triggers have a tendency to screw up Map Init, so I just lean on the safe side. Also, I haven't noticed any lagging yet (although if I ever do, I'll certainly take your advice )


Quote:
It would also be more efficient to destroy single time running triggers afterwards.

That's a good idea, I'll put that in there.
__________________
Zone Control. Give it a try!

Taur: btw dun tell anyone but I bribed the wc3c admins with a life supply of packaged peanuts to host UL ^^

Taur | Unsung Legends says:
guess what blade?
Blade.dk says:
JOHN IS YO BRO!


johnfn is offline   Reply With Quote
Old 08-16-2006, 07:54 AM   #11
Waynebebay
User
 
Waynebebay's Avatar
 
Join Date: Mar 2004
Posts: 101

Waynebebay has little to show at this moment (8)

Send a message via AIM to Waynebebay
Default

Not only good for someone who wants to make a TD but great for a firm lesson in arrays.
Waynebebay is offline   Reply With Quote
Old 09-02-2006, 08:06 AM   #12
Tobbz
User
 
Tobbz's Avatar
 
Join Date: Jun 2006
Posts: 10

Tobbz has little to show at this moment (0)

Default

Quote:
(and if you don't mind get into the variables ^_^ )

Yes it would be nice if you did so Jonfn
Im not so good in mapmaking atleast not triggering =/
But it would be nice to get my started TD finished i only have the Levels left but..I cant get it to work.

anyway Good Tutorial.
__________________

Which FF Character Are You?

FF is the BEST!!

Last edited by Tobbz : 09-02-2006 at 08:07 AM.
Tobbz is offline   Reply With Quote
Old 01-22-2007, 04:25 PM   #13
scythetleppo
User
 
Join Date: Nov 2006
Posts: 23

scythetleppo has little to show at this moment (1)

Default

efficient


not effecient
scythetleppo is offline   Reply With Quote
Old 12-06-2008, 06:59 PM   #14
LordChicken
User
 
Join Date: Sep 2008
Posts: 2

LordChicken has little to show at this moment (0)

Default

wow looks good
LordChicken is offline   Reply With Quote
Old 07-20-2009, 05:20 PM   #15
Scaly-D
User
 
Join Date: Jul 2009
Posts: 1

Scaly-D has little to show at this moment (0)

Default

I guess I'm the only one who feels this way, but this was very difficult for me to follow. Alone, it didn't offer any help - I had to learn about arrays elsewhere to even understand this. And still this seems incomplete to me. I'm not new to map-making, but this goes right over my head (well, kinda hits my forehead and slides past). You should either put more elaborate descriptions of each step or warn the reader that they need to be familiar with arrays at the beginning (then again, it seems to me that if I were familiar with them, I wouldn't need this tutorial).
Scaly-D 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:20 PM.


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