[Log in / Register]
| News | Chat | Pastebin | Donations | Tutorials | Rules | Forums |
| Maps | Skins | Icons | Models | Spells | Tools | Jass | Packs | Hosted Projects | Starcraft II Modding | Starcraft II Resources | Galaxy Wiki |
(Keeps Hive Alive)
Go Back   The Hive Workshop > Warcraft III Modding > WarCraft III Tutorials > Trigger (GUI) Editor Tutorials


Trigger (GUI) Editor Tutorials Contains tutorials concerning the usage of GUI features.
Read the Rules before posting.

Closed Thread
 
Thread Tools
Old 11-15-2007, 05:32 AM   #1 (permalink)
Registered User OneEight7even
User
 
OneEight7even's Avatar
 
Join Date: Oct 2007
Posts: 25
OneEight7even has little to show at this moment (4)
Arrow Key Movement / Camera System

this has been done before but i didnt really like any of the others ons so i made one myself.

Arrow Key Movement

1.0
1) Create 3 Variables , named "Up", "Right" , "Left". Make those 3 boolean arrays for the type and make a new variable called Players_Hero with type Unit Array. and another variable named TempPoint and its type point array.

2) Create a map init trigger and set some unit into the Players_Hero variable

3) Create a new trigger named "Up Pressed"

4) add this event to the trigger : Player - Player 1 (Red) Presses the Up Arrow key

5) add the variable up in the actions part and make it look like this
Set Up[(Player number of (Triggering player))] = True

6) Make that for all the arrow keys exept for down.
Example:
SPOILER

]Up Press
Events
Player - Player 1 (Red) Presses the Up Arrow key
Player - Player 2 (Blue) Presses the Up Arrow key
Player - Player 3 (Teal) Presses the Up Arrow key
Player - Player 4 (Purple) Presses the Up Arrow key
Conditions
Actions
Set Up[(Player number of (Triggering player))] = True
Right Press
Events
Player - Player 1 (Red) Presses the Right Arrow key
Player - Player 2 (Blue) Presses the Right Arrow key
Player - Player 3 (Teal) Presses the Right Arrow key
Conditions
Actions
Set Right[(Player number of (Triggering player))] = True
Left Press
Events
Player - Player 1 (Red) Presses the Left Arrow key
Player - Player 2 (Blue) Presses the Left Arrow key
Player - Player 3 (Teal) Presses the Left Arrow key
Player - Player 4 (Purple) Presses the Left Arrow key
Conditions
Actions
Set Left[(Player number of (Triggering player))] = True


1.1
Now we are going to create the "release triggers" you will basicly be doing the same thing as the pressed ones but like this
Up Release
Events
Player - Player 1 (Red) Releases the Up Arrow key
Player - Player 2 (Blue) Releases the Up Arrow key
Player - Player 3 (Teal) Releases the Up Arrow key
Player - Player 4 (Purple) Releases the Up Arrow key
Conditions
Actions
Set Up[(Player number of (Triggering player))] = False
Unit - Order PlayersHero[(Player number of (Triggering player))] to Stop

Now do that for all the arrow keys. exept dont add the Unit - Order Stop action in any of the other ones.

2.0
Create a new trigger named Movement. this trigger will be detecting the variables to order a unit to move. for example :
if the variable Up is = True then it will move that unit up.
1) create the event Time - Every 0.25 seconds of game time

2) add the action Player Group - Pick all players and do actions
Loop actions

3) in the loop actions part create an If/Then/Else action. so far it should look like this :
Untitled Trigger 001
Events
Time - Every 0.25 seconds of game time
Conditions
Actions
Player Group - Pick every player in (All players) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Then - Actions
Else - Actions

in the If - Conditions part of the trigger add these conditions
Up[(Player number of (Picked player))] Equal to True
Left[(Player number of (Picked player))] Equal to False
Right[(Player number of (Picked player))] Equal to False
.

4) after that , create under the Then -Actions part the variable TempPoint like this
Set TempPoint[(Player number of (Picked player))] = (Position of PlayersHero[(Player number of (Picked player))])
after that action were going to add the moving part of it it should look like this
Unit - Order PlayersHero[(Player number of (Picked player))] to Move To (TempPoint[(Player number of (Picked player))] offset by 90.00 towards (Facing of PlayersHero[(Player number of (Picked player))]) degrees)

Now do the same thing in more loops for all the variables. it should look like this at the end :
SPOILER
Movement
Events
Time - Every 0.25 seconds of game time
Conditions
Actions
Player Group - Pick every player in (All players) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Up[(Player number of (Picked player))] Equal to True
Left[(Player number of (Picked player))] Equal to False
Right[(Player number of (Picked player))] Equal to False
Then - Actions
Set TempPoint[(Player number of (Picked player))] = (Position of PlayersHero[(Player number of (Picked player))])
Unit - Order PlayersHero[(Player number of (Picked player))] to Move To (TempPoint[(Player number of (Picked player))] offset by 90.00 towards (Facing of PlayersHero[(Player number of (Picked player))]) degrees)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Right[(Player number of (Picked player))] Equal to True
Then - Actions
Set TempPoint[(Player number of (Picked player))] = (Position of PlayersHero[(Player number of (Picked player))])
Unit - Order PlayersHero[(Player number of (Picked player))] to Move To (TempPoint[(Player number of (Picked player))] offset by 90.00 towards ((Facing of PlayersHero[(Player number of (Picked player))]) + -90.00) degrees)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Left[(Player number of (Picked player))] Equal to True
Then - Actions
Set TempPoint[(Player number of (Picked player))] = (Position of PlayersHero[(Player number of (Picked player))])
Unit - Order PlayersHero[(Player number of (Picked player))] to Move To (TempPoint[(Player number of (Picked player))] offset by 90.00 towards ((Facing of PlayersHero[(Player number of (Picked player))]) + 90.00) degrees)
Else - Actions


You're still not done. now for the diaganol movement part. we wont be actually ordering the unit to move diaganol we will move him instantly to point. this is pretty simple so im just going to post the trigger for diaganols.

Stop Turn
Events
Time - Every 0.30 seconds of game time
Conditions
Actions
Player Group - Pick every player in (All players) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Up[(Player number of (Picked player))] Equal to True
Left[(Player number of (Picked player))] Equal to True
Then - Actions
Unit - Make PlayersHero[(Player number of (Picked player))] face ((Facing of PlayersHero[(Player number of (Picked player))]) + 65.00) over 0.10 seconds
Set TempPoint[(Player number of (Picked player))] = ((Position of PlayersHero[(Player number of (Picked player))]) offset by 10.00 towards (Facing of PlayersHero[(Player number of (Picked player))]) degrees)
Unit - Move PlayersHero[(Player number of (Picked player))] instantly to TempPoint[(Player number of (Picked player))]
Animation - Play PlayersHero[(Player number of (Picked player))]'s walk animation
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Up[(Player number of (Picked player))] Equal to True
Right[(Player number of (Picked player))] Equal to True
Then - Actions
Unit - Make PlayersHero[(Player number of (Picked player))] face ((Facing of PlayersHero[(Player number of (Picked player))]) + -65.00) over 0.10 seconds
Set TempPoint[(Player number of (Picked player))] = ((Position of PlayersHero[(Player number of (Picked player))]) offset by -10.00 towards (Facing of PlayersHero[(Player number of (Picked player))]) degrees)
Unit - Move PlayersHero[(Player number of (Picked player))] instantly to TempPoint[(Player number of (Picked player))]
Animation - Play PlayersHero[(Player number of (Picked player))]'s walk animation
Else - Actions

There you go you made an arrow key movement system. in case you didnt understand it or i didnt explain well take a look at the triggers your self in the demo map (Camera system is in demo map also). im pretty sure i spelled alot of things wrong so dont tell me about it. idk if im good or not at explaining things either soooo
Attached Files
File Type: w3x 187 Arrow Key Movement 1.1.w3x (32.0 KB, 2671 views)

Last edited by Wolverabid; 02-10-2008 at 01:18 AM.
OneEight7even is offline  
Old 11-15-2007, 03:58 PM   #2 (permalink)
Registered User madcat2
I'm, Mad like a Cat.
 
madcat2's Avatar
 
Join Date: Aug 2005
Posts: 1,181
madcat2 is on a distinguished road (88)madcat2 is on a distinguished road (88)
Good Tutorial but it'd probably be better with some pictures here and there.

~/\/\@D
madcat2 is offline  
Old 11-16-2007, 11:13 PM   #3 (permalink)
Registered User PurplePoot
The only way to be sure.
 
PurplePoot's Avatar
 
Join Date: Dec 2005
Posts: 11,287
PurplePoot has a brilliant future (1581)PurplePoot has a brilliant future (1581)PurplePoot has a brilliant future (1581)PurplePoot has a brilliant future (1581)PurplePoot has a brilliant future (1581)PurplePoot has a brilliant future (1581)
Former Staff Member: This user used to be on the Hive Workshop staff. Paired Mapping Contest #4 - Winner: Fallen Angel - Lucifer's Keep Map Development Mini-Contest #1 - Winner: Stand of the Elements 
I suggest replacing the [code] tags with [trigger] tags, which are specifically built for GUI.

For the spoilers, you could use [hidden=Spoiler](content)[/hidden], which would produce:

Spoiler
(content)


Also, Unit - Move Unit (Instantly) resets animations as far as I know, so that would look a little jumpy.
PurplePoot is offline  
Old 11-17-2007, 08:03 PM   #4 (permalink)
Registered User SoCal_420
User
 
Join Date: Jun 2007
Posts: 8
SoCal_420 has little to show at this moment (1)
nice system i could use it.
SoCal_420 is offline  
Old 11-24-2007, 01:42 AM   #5 (permalink)
Registered User Kieve
Void Mage
 
Kieve's Avatar
 
Join Date: Nov 2007
Posts: 8
Kieve has little to show at this moment (2)
Is [that] how button (hold) functions work? Hm. Need the pair of Press and Release event triggers.
Seems so obvious, and yet it never occurred to me before. Wonderful.
Not too keen on the rest of the code, but that's personal preference - easy to understand at least.
__________________

Be constructive, or be silent.
Kieve is offline  
Old 11-25-2007, 05:14 PM   #6 (permalink)
Registered User Need_O2
User
 
Need_O2's Avatar
 
Join Date: Aug 2007
Posts: 2,986
Need_O2 is a jewel in the rough (240)Need_O2 is a jewel in the rough (240)Need_O2 is a jewel in the rough (240)Need_O2 is a jewel in the rough (240)
would be better with JASS
hey dont look at me like that Im a Lamer
My job is causing annoying situations

Ups including much leaks too
__________________
really dont care
Need_O2 is offline  
Old 12-06-2007, 12:22 AM   #7 (permalink)
Registered User CombatTheWombat
User Title
 
CombatTheWombat's Avatar
 
Join Date: Jul 2007
Posts: 898
CombatTheWombat is on a distinguished road (75)CombatTheWombat is on a distinguished road (75)
hmmmm, dont use jass for anything you can do in gui, as the saying goes, "don't fix what isn't broken"
__________________
CombatTheWombat is offline  
Old 12-07-2007, 08:38 PM   #8 (permalink)
Registered User PurplePoot
The only way to be sure.
 
PurplePoot's Avatar
 
Join Date: Dec 2005
Posts: 11,287
PurplePoot has a brilliant future (1581)PurplePoot has a brilliant future (1581)PurplePoot has a brilliant future (1581)PurplePoot has a brilliant future (1581)PurplePoot has a brilliant future (1581)PurplePoot has a brilliant future (1581)
Former Staff Member: This user used to be on the Hive Workshop staff. Paired Mapping Contest #4 - Winner: Fallen Angel - Lucifer's Keep Map Development Mini-Contest #1 - Winner: Stand of the Elements 
Quote:
hmmmm, dont use jass for anything you can do in gui, as the saying goes, "don't fix what isn't broken"
That's absolutely not true, but on the other hand, some people use GUI too, so GUI tuts are useful too...
PurplePoot is offline  
Old 02-10-2008, 01:15 AM   #9 (permalink)
Registered User Wolverabid
 
Wolverabid's Avatar
 
Join Date: Oct 2006
Posts: 8,426
Wolverabid has a brilliant future (1352)Wolverabid has a brilliant future (1352)Wolverabid has a brilliant future (1352)
Medal of Honor: This user has proven himself through his deeds and contributions on wc3sear.ch and/or The Hive Workshop, and is thus awarded this Medal of Honor in adulation of his perpetual legend. Super Donor: This user has donated at least $100 to The Hive. Former Staff Member: This user used to be on the Hive Workshop staff. User of the Year: 2007 
Thumbs up Tutorial Approved!

Map makers should find this tutorial helpful and useful.

~ Thread moved to Trigger (GUI) Editor Tutorials.
Wolverabid is offline  
Old 02-15-2008, 01:07 PM   #10 (permalink)
Registered User Deathcom3s
Insert Title Here
 
Deathcom3s's Avatar
 
Join Date: Dec 2007
Posts: 1,066
Deathcom3s is a jewel in the rough (181)Deathcom3s is a jewel in the rough (181)
PayPal Donor: This user has donated to The Hive. Former Staff Member: This user used to be on the Hive Workshop staff. 
Nice tut, I'm going to use this in my RPG.
__________________
Deathcom3s is offline  
Old 02-15-2008, 09:44 PM   #11 (permalink)
Registered User ~Void~
Me
 
~Void~'s Avatar
 
Join Date: Jul 2007
Posts: 6,391
~Void~ has disabled reputation
Terraining Contest #5 - Winner: Winter Wonderland Contest 
Quote:
Originally Posted by CombatTheWombat View Post
hmmmm, dont use jass for anything you can do in gui, as the saying goes, "don't fix what isn't broken"
But GUI is leaktastic!
~Void~ is offline  
Old 03-18-2008, 01:04 AM   #12 (permalink)
Registered User underscore
Soldier
 
underscore's Avatar
 
Join Date: Mar 2008
Posts: 154
underscore has little to show at this moment (8)
Thank you for the tutorial. It helped me make my Role-playing a little nice. 5/5
__________________
Quote:
Community Friendliness
The Hive is a friendly community: all users are expected to treat one another with dignity and respect.
underscore is offline  
Old 03-21-2008, 12:03 AM   #13 (permalink)
Registered User Kidd|WhiteHeaven|
Era of Gods
 
Kidd|WhiteHeaven|'s Avatar
 
Join Date: Nov 2006
Posts: 271
Kidd|WhiteHeaven| has little to show at this moment (6)
Great and usefull. Especially for dodgeball type games.
Note: FPS view cameras really are hard.
__________________

Projects working on
7 Monster Siege - Updating
Afraid of Monsters - Under Construction
Kidd|WhiteHeaven| is offline  
Old 04-13-2008, 01:35 AM   #14 (permalink)
Registered User Pandarian-Warrior
User
 
Pandarian-Warrior's Avatar
 
Join Date: Apr 2008
Posts: 4
Pandarian-Warrior is an unknown quantity at this point (0)
dude...i just learned how to make an arrow-key movement system.
thank you, thank you very much
Pandarian-Warrior is offline  
Old 04-30-2008, 08:59 PM   #15 (permalink)
Registered User Bill_14
User
 
Join Date: Jan 2008
Posts: 7
Bill_14 has little to show at this moment (6)
my opinion is do not try to make such a system

i made one for my rpg map, and the unit is walking awfully, it is like right clicking 4 times a seconds in front of the unit. Also if there is an obstacle in front of the unit, it won't go str8.

it's good however to show to people how to do this, even for practice, good work
Bill_14 is offline  
Closed Thread

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[JASS] Arrow Key Movement Cov3r70ps Triggers & Scripts 2 02-17-2008 12:55 AM
Arrow-key movement Control Creative.S World Editor Help Zone 3 02-05-2008 10:50 PM
Arrow key movement animation Xzife_TD01 World Editor Help Zone 3 01-09-2008 06:26 AM
Useing arrow key movement Xzife_TD01 World Editor Help Zone 11 03-04-2007 10:42 AM
Help with arrow key movement? creg216 Map Development 8 02-23-2005 08:32 PM

All times are GMT. The time now is 03:25 AM.





Powered by vBulletin
Copyright 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.5.1 PL2
Copyright © Ralle