Warcraft III resources & community, 2003–2006 · archived

TaaZ's Item System

13 posts
#1

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
#2
Code:
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>

How can you put multiple actions in the then spot?I get everything else,just this one thing. :evil:
#3
If/Then/Else multiple functions is what it is called :D
#4
Too many variables. Use arrays.
#5
Xander-If/Then/Else multiple functions is what it is called :D

I can't find it...I even searched it...
EDIT:
In my other computer....I found it...but that computer sucks,crapload of lag...so...should I download the latest patch,or something?
#6
Death's AdvocateI can't find it...I even searched it...

lol, you dont search if/then/else multiple functions, here ill show you how to get it.

  • open up a new trigger
  • right when that trigger opens click the scroll down list
  • if/then/else multiple functions should be about 8 lines down

Thats it! hope that helped
#7
Yea this was posted a very long time ago. I will update the tutorial, and answer all of your questions soon, so keep checking this thread :)

Edit: Fixed grammar, capitalization, periods, etc.

I will rewrite so it uses arrays later.
#8
UltiDM
Death's AdvocateI can't find it...I even searched it...

lol, you dont search if/then/else multiple functions, here ill show you how to get it.

  • open up a new trigger
  • right when that trigger opens click the scroll down list
  • if/then/else multiple functions should be about 8 lines down

Thats it! hope that helped

Actually,I found it!I also fixed that problem I posted in the Site Discussion forum.I got the latest patch for the game,and I found it in the Trigger Editor.
#9

Thx

Thx theat is exzacly wath i needed!
#10
Just so you know, the else in the trigger "Able2PickUpAfterDrop1" will
allow the user to pick up another weapon after they drop any non-artifact item.

So if some one wants 6 weapons, they get 1 weapon and
any other item. Drop the other item and pick up another weapon. And repeat.
#11

thx

that helped ALOT for the rpg map i am making.
#12
Very useful for the map idea I have.

I was wondering if it possible for someone to give me a basic idea of how to make an upgradable item script similar to the Dota Allstars idea though.

I want to make a map, RPG based, that uses a similar system for at least one quest in it.

Basically, if you have gathered the right items, you can get an upgrade to them from a specific NPC.

SInce the Dota line of maps is protected it is impossible for me to just sneak a peak at the system they use and I doubt that they would help me out if I asked.

Any help would be great and if this has been placed in the wrong thread please let me know, since I am new here and all.
#13
Kinda confusing, plus, might take a while just to get it in your map... Can you maybe make it so that one trigger per wep works for every character?
The conversation continued. After wc3sear.ch closed, 1 further reply was posted to this thread on The Hive Workshop. Read them there →