• 🏆 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] Need 2 Triggers (PLEASE)

Status
Not open for further replies.
Level 3
Joined
Nov 23, 2008
Messages
30
Hello Hivers,
I'm making a map and I need two triggers.I'm not very good at speaking english but I'll try to explain what I want.:gg:


TRIGGER 1
So the first trigger I want is simple,I need something that does this:

HERO picks (Axe,level 2 attachment item) ---> Hero Picks (Sword,level 2 attachment item) ---> HERO drops Axe and Sword replaces it.

I just don't want my hero to have 2 items with same level.If he picks a 2 lvl item while he is already carrying one,then the old one gets replaced by the picked one.Hope you get what I mean :grin:
--------------------------------------------------------------------
TRIGGER 2
This is a little more difficult.Do you guys know the Goblin Racial from WoW Cataclysm?
Here it is:Goblins will have a personal servant called a “Pack Hobgoblin” which can be summoned every 30 minutes, and will offer bank access from anywhere in the world.

So what I want is something similar to this.Not exactly 30 mins cooldown.I have the models I need,but as my character (The main character of the map i'm making [RPG]) can only carry one type of item at time,I need an extra inventory to keep old items.So I want it like,an ability that when you click it,it spawns a Creature with an inventory.

Please,give this a try.Thank you very much in advance.Have a good day! :wink:
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
  • Untitled Trigger 001
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • Set Level = (Item level of (Item being manipulated))
      • For each (Integer A) from 1 to (Size of inventory for (Hero manipulating item)), do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item being manipulated) Not equal to (Item carried by (Hero manipulating item) in slot (Integer A))
              • Level Equal to (Item level of (Item carried by (Hero manipulating item) in slot (Integer A)))
            • Then - Actions
              • Item - Move (Item carried by (Hero manipulating item) in slot (Integer A)) to (Position of (Hero manipulating item))
            • Else - Actions
This would probably do it, mind you it leaks a location handle (Position of (Hero manipulating item)), so you'll want to clean that up.
 
Level 3
Joined
Nov 23, 2008
Messages
30
Thank you,but doesn't this just replace the item carryed by the hero with the new picked one?I mean,i want the old one to be dropped and the new picked item to go where the dropped one was.Just asking couse I don't see any drop item trigger there.
Still thanks,and I'm waiting your reply.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
When you move the item it forces the carrier to drop it. It's better this way since you don't have your hero being ordered to drop an item when it picks the other up, instead it is automatically removed from its inventory.
 
For the second trigger, it's not difficult; just use an ability based on Feral Spirit and use this trigger:
  • Trigger1
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Set Races[1] = Human
    • Set Races[2] = Undead
    • Set Races[3] = Orc
    • Set Races[4] = Night Elf
    • Set Abilities[1] = Unit inventory (Human)
    • Set Abilities[2] = Unit inventory (Undead)
    • Set Abilities[3] = Unit inventory (Orc)
    • Set Abilities[4] = Unit inventory (Night Elf)
  • TriggerSpawn
  • Events
    • Unit - A unit spawns a summoned unit
  • Conditions
    • (Unit-type of (Summoning unit)) Equal to X
    • (Unit-type of (Summoned unit)) Equal to Y
  • Actions
    • For each (Integer A) from 1 to 4, do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Actions) else do (Actions)
          • If - Conditions
            • (Race of (Summoned unit)) Equal to Races[(IntegerA)]
          • Then - Actions
            • Unit - Add Abilities[(IntegerA)] to (Summoned unit)
          • Else - Actions
Races[] is a race variable, while Abilities[] is an ability variable.
 
Level 3
Joined
Nov 23, 2008
Messages
30
Thank you very much guys!
I wish I could give you +rep but it won't let me do it.Gonna test both triggers thanks again!

Also Berb Could you please tell me the variables like Pharaoh_ did?
Thanks in advance.

*I'm total noob at triggering*
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Pharaoh_ only sets up those variables so he can use them later. Notice how there are no "X" and "Y" values defined in his TriggerSpawn conditions?

In the trigger I posted there are no variables that need to be declared, other than the one used at the very top (which is an integer) named Level. If you're going to try and be leak-less then you'll also need a Point variable to store the value returned by (Position of (Hero manipulating item)).
 
Level 3
Joined
Nov 23, 2008
Messages
30
Pharaoh_
Can I ask you something?
I'll make an example so it's easyer to understand.

*THE MAP IS AN RPG WITH ONLY ONE MAIN HERO*
HERO spawns (UNIT with hero inventory ability)--->(Spawned UNIT picks 2 different items)--->Spawned Unit disappears (Becouse it is timed)--->HERO spawns UNIT again---> the 2 items carried by the unit disappeared.

Is there a way I can make those items not disappear?
Or give me some ideas please?
Thanks,and sorry for annoyng you.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
If you're only concerned about a single hero, then you can record the item-types of the two items that the summoned unit has. Or, to make things dynamic, record all of the items that the unit has.

  • Actions
    • For each (Integer A) from 1 to (Size of inventory for (Triggering unit)), do (Actions)
      • Loop - Actions
        • Set InventoryItemType[(Integer A)] = (Item-type of (Item carried by (Triggering unit) in slot (Integer A)))
    • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
    • For each (Integer A) from 1 to (Size of inventory for (Triggering unit)), do (Actions)
      • Loop - Actions
        • Hero - Create InventoryItemType[(Integer A)] and give it to (Last created unit)
I omitted any events/conditions, and simply used (Triggering unit) but that value can be changed to match the unit that was spawned. The Footman that is created also does not have an inventory, but it is simply so you can see how it would be done. I hope this helps.
 
Level 3
Joined
Nov 23, 2008
Messages
30
Only 3 questions Berb: "simply used (Triggering unit) but that value can be changed to match the unit that was spawned" ----> How? (remember I'm a total noob at triggering)

"Set InventoryItemType" ---->What kind of variable is that?

And the las one,could I use as event the map initialization?

Thanks in advance,i'm really happy you're helping me with this.I'll give you credits for sure.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Biljoke said:
Only 3 questions Berb: "simply used (Triggering unit) but that value can be changed to match the unit that was spawned" ----> How? (remember I'm a total noob at triggering)

Dude GUI doesn't require you to have any knowledge in anything. Just try to make the trigger and you'll see that (Triggering unit) is a value that can be changed (and is highlighted in green in the menu). Just because you're bad at GUI doesn't mean you can't sift through options.

Biljoke said:
"Set InventoryItemType" ---->What kind of variable is that?

It's an item-type variable. Warcraft III uses integers for all of their types, but in GUI you can only reference items by item-type if they are saved as item-type variables. Also note that the variable is an array, and I use the for-loop indexes to reference the specific element that I want.

Biljoke said:
And the las one,could I use as event the map initialization?

Well you would want to do this when your hero spawns the unit with the inventory (or when the spawned unit is dying or something) so that you can save the item-types of each item that the unit contained in its inventory.

  • Untitled Trigger 001
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Paladin
    • Actions
      • For each (Integer A) from 1 to (Size of inventory for (Triggering unit)), do (Actions)
        • Loop - Actions
          • Set Inventory[(Integer A)] = (Item-type of (Item carried by (Triggering unit) in slot (Integer A)))
      • Unit - Create 1 Mountain King for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing (Facing of (Triggering unit)) degrees
      • For each (Integer A) from 1 to (Size of inventory for (Triggering unit)), do (Actions)
        • Loop - Actions
          • Hero - Create Inventory[(Integer A)] and give it to (Last created unit)
This trigger would fire when any Paladin dies, and replace the dying Paladin (Triggering unit) with a Mountain King that has the exact same items in its inventory as the Paladin did. Use this logic to create what you need, for whatever units you need. Also, please actually try creating these triggers as you'll see what fields can be edited.
 
Level 3
Joined
Nov 23, 2008
Messages
30
Dude GUI doesn't require you to have any knowledge in anything. Just try to make the trigger and you'll see that (Triggering unit) is a value that can be changed (and is highlighted in green in the menu). Just because you're bad at GUI doesn't mean you can't sift through options.

Yea I know,but when I said "how" i meant what unit should I put there.I mean,the summoned unit or....?

Also thanks for the other informations,I'll try it out right now.

Also I DO create them (the triggers) just while reading them here.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Biljoke said:
Yea I know,but when I said "how" i meant what unit should I put there.I mean,the summoned unit or....?

Okay, well you should have been a little more specific but the main reason for my reaction is because I help people quite a bit, and often people won't be able to do a damn thing by themselves and constantly ask questions that could be answered by simply trying it out first.

I have to cover my bases.

By the way, nothing says thank you more than a cookie. You don't need to post on my profile thanking me, it's implied.
 
Status
Not open for further replies.
Top