(Keeps Hive Alive)
Go Back   The Hive Workshop - A Warcraft III Modding Site > 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
 
LinkBack Thread Tools Display Modes
Old 07-27-2005, 05:08 AM   #1 (permalink)

User
 
Join Date: Jul 2005
Posts: 16

TaaZ is an unknown quantity at this point (0)


TaaZ's Item System

TaaZ's ITEM SYSTEM

Well, I know some of you have been looking for a decent item system that lets people only use one weapon at a time or one armor, or whatever, so this tutorial was produced from being bored.

This tut might give you beginners more knowledge with triggers and/or variables.

What you need:
  • A. Basic Knowledge of the Object Editor

    B. Basic Knowledge of Variables

    C. Basic Knowledge of the Trigger Editor

-----------------------------------------------------------

First and foremost, we are going to start with a few variables...
If you are going to have 5 players in your map that cant pick up two weapons (I'll be using weapons as an example) then you need 5 variables.
I named my variables
  • Only1Weapon1
    Only1Weapon2
    Only1Weapon3
    Only1Weapon4
    Only1Weapon5
The numbers at the end represents the player number, ex. player 1 red = 1
These variables need to be boolean and false as default

Lets get started on the triggers...

Make a trigger called "Only1Weapon1"
And another trigger called "Able2PickUpAfterDrop1"
NOTE: these triggers will be for player 1 red

Go into the trigger Only1Weapon1 and create a new Event:
Unit - A unit owned by Player 1 (Red) Acquires an item
Simple Event, no need to explain it.

Now create a few Actions, this is what it should look like after I explain some of it:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-class of (Item being manipulated)) Equal to Artifact
Only1Weapon1 Equal to False
Then - Actions
Set Only1Weapon1 = True
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-class of (Item being manipulated)) Equal to Artifact
Only1Weapon1 Equal to True
Then - Actions
Trigger - Turn off able to pick up after drop1 <gen>
Item - Move (Item being manipulated) to (Position of (Triggering unit))
Game - Display to Player Group - Player 1 (Red) the text: You can only wield ...
Wait 0.01 seconds
Trigger - Turn on able to pick up after drop1 <gen>
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-class of (Item being manipulated)) Equal to Artifact
Only1Weapon1 Equal to False
Then - Actions
Set Only1Weapon1 = True
Else - Actions
Do nothing

Let's get started on it.
First make an if/then/else Action.
This helps it when a unit picks up an item, if the unit already has a weapon it wont pick up the new weapon.
Now for the If - Conditions you need to make:

(Item-class of (Item being manipulated)) Equal to Artifact
Only1Weapon1 Equal to False

What this does is it lets the trigger know if the item being picked up is a weapon and checks if there is already a weapon being wielded.

Now we got that down we need to make a Then - Action this is what it should be:

Set Only1Weapon1 = True

This simply tells it that the unit has picked up a weapon.

Now for the Else - Actions you need another if/then/else.

After you make another if/then/else in the else action you now make some If - Conditions.

(Item-class of (Item being manipulated)) Equal to Artifact
Only1Weapon1 Equal to True

This will tell it that there is a weapon in the inventory yet and doesn't not let the unit pick up the weapon, goody? nope, its not over yet

now for the Then - Actions you make the following action

Then - Actions
Trigger - Turn off able to pick up after drop1 <gen>
Item - Move (Item being manipulated) to (Position of (Triggering unit))
Game - Display to Player Group - Player 1 (Red) the text: You can only wield one weapon at a time.
Wait 0.01 seconds
Trigger - Turn on able to pick up after drop1 <gen>

Well, this is just a helpful thing for the second trigger you made, "Able2PickUpAfterDrop1"
and tells it what to do with a weapon if the unit is not able to pick it up, also a little user friendly text message that informs the owner of the unit trying to pick up 2 weapons that you can only wield one weapon at a time.

in the Else - Action create another if/then/else action.

For the If - Conditions in the newly created if/then/else, do this:

(Item-class of (Item being manipulated)) Equal to Artifact
Only1Weapon1 Equal to False

This lets it know that there is no weapon in the inventory and that the item being picked up is a weapon, easy?

Now for the Then - Actions:

Set Only1Weapon1 = True

Nice huh? This tells it that a weapon has been picked up and put into the inventory of unit owned by player 1 red.

And in the Else - Actions:

Do nothing

Short and sweet.

Now lets get to that second trigger. "Able2PickUpAfterDrop1"

Create an Event:

Unit - A unit owned by Player 1 (Red) Loses an item

Now create an if/then/else action, and do the following:

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-class of (Item being manipulated)) Equal to Artifact
Only1Weapon1 Equal to True
Then - Actions
Set Only1Weapon1 = False
Wait 0.01 seconds
Else - Actions
Set Only1Weapon1 = False

NOTE: My weapon classes are artifacts, you can also use permanent or charged or whichever class you want, but all weapon have to be in one class and armors in another class, don't use anything BUT weapons in class artifact if your weapon class is an artifact.

To use this trigger for all 5 players you need to use different variables and more triggers. EX: Player 2 blue's trigger - One1Weapon2, P2 Blues Variable - Only1Weapon2

Credits: World Editor (Of course :))

Written by TaaZ

Last edited by TaaZ; 03-26-2007 at 12:03 AM. Reason: Replaced all [code] tags with [trigger] tags.
TaaZ is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Item Equipment System? akasixcon Requests 4 03-26-2008 01:02 PM
Item System help Cool Joe Smith Requests 3 09-29-2007 03:41 AM
[JASS] Item System Problem Flame_Phoenix Triggers & Scripts 20 09-28-2007 09:48 PM
[Trigger] Item combination system KoE-Death Triggers & Scripts 4 08-05-2007 09:00 PM
Item Reload System Help Burger_Bling World Editor Help Zone 3 04-29-2007 04:49 PM

All times are GMT. The time now is 05:37 PM.






Your link here 
Houses for Sale | Aflac Auto Insurance | Web Advertising | Loans | Loan
Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Copyright©Ralle