• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Trigger - Item Combining

Status
Not open for further replies.
Level 4
Joined
Sep 29, 2004
Messages
52
Could someone, if they have the time, make a trigger where a person needs more than 1 item of the same type to make an item. For example, a hero needs 2 Copper Bars and 1 Axe Handle item to make a Copper Axe. Please send me a Private Message when the person who does this favor for me. -Thank You
 
Level 2
Joined
Dec 22, 2005
Messages
8
I learned this from a friend of mine.
This recipe involves a recipe, and two items.
You use an emerald, sword and recipe, to make a posion dagger.
There's probably a simplier way to make it, but i used a spell attached to the recipe which, when casts, "combines" the items.
It also gives a message if the user does not have the appriopriate items.

Poisoner Dagger
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Dagger
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Casting unit) has an item of type Steel Sword) Equal to True
((Casting unit) has an item of type Emerald) Equal to True
Then - Actions
Hero - Create Poisoner's Dagger and give it to (Casting unit)
Item - Remove (Item carried by (Casting unit) of type Steel Sword)
Item - Remove (Item carried by (Casting unit) of type Emerald)
Item - Remove (Item carried by (Casting unit) of type Poisoner's Dagger)
Else - Actions
Game - Display to (Player group((Owner of (Casting unit)))) the text: You do not have the...
 
Level 4
Joined
Dec 10, 2005
Messages
73
Using the code above this post, you could add a stacking
trigger. This stacking trigger goes like this

Code:
item Stacking

Event      
     A unit aciqure an item
condition 
     (item multi something) = Gold bars
     (Note you can add other stackable items here but don't forget the OR, this trigger is my universal item stacker)

Action

For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions

For each (Integer B) from 1 to 6, do (Actions)
Loop - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions

(Integer A) Not equal to (Integer B)

(Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to (Item-type of (Item carried by (Hero manipulating item) in slot (Integer B)))

Then - Action

Item - Set charges remaining in (Item carried by (Hero manipulating item) in slot (Integer A)) to ((Charges remaining in (Item carried by (Hero manipulating item) in slot (Integer A))) + (Charges remaining in (Item carried by (Hero manipulating item) in slot (Integer B))))

Item - Remove (Item carried by (Hero manipulating item) in slot (Integer B))

Else - Actions
Do nothing

Now with this stacking trigger with can see if they have 2 of the same item. Now add this condition to the combining code

Code:
(Charges remaining in (Item carried by (Hero) of type Item)) Equal to 2

so in result you get

Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Dagger
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Casting unit) has an item of type Steel Sword) Equal to True
((Casting unit) has an item of type Emerald) Equal to True
(Charges remaining in (Item carried by (Hero) of type Item)) Equal to 2
Then - Actions
Hero - Create Poisoner's Dagger and give it to (Casting unit)
Item - Remove (Item carried by (Casting unit) of type Steel Sword)
Item - Remove (Item carried by (Casting unit) of type Emerald)
Item - Remove (Item carried by (Casting unit) of type Poisoner's Dagger)
Else - Actions
Game - Display to (Player group((Owner of (Casting unit)))) the text: You do not hav...[/b]

i think you are able to remodify these trigger to your map.
 
Status
Not open for further replies.
Top