| 12-14-2003, 10:22 PM | #1 |
This ones suppose to give the buildings unit that it sold and put it in its inventory. Can building have items? Events A unit sells an item CONDITIONS none ACTIONS Remove sold item Hero-Create item-type of item being sold and give it to selling unit This ones suppose to turn the targeted unit into a different unit with all the items that the unit that used the spell on it. But it doesn't even change the unit into what it's suppose to be. EVENT A unit is issued an order to target an object CONDITIONS Unit type of targeted unit equal to male citizen Ability being cast equal to target unit ACTIONs Units-Replace Targeted unit with a warrior soldier using The old unit's relative life and mana Hero- Create (Item-type of(Item Carried by(ordered unit) in slot (integer A))) and give it to (Targeted Unit) |
| 12-14-2003, 10:33 PM | #2 |
I dont quite understand what you mean for that first instance, but for the second trigger i can help. It can't be done the way you have it there because your event (unit issued order targeting a unit) does not work with your condition (ability being cast = x). It has to be done this way instead, with two triggers The first trigger stores the target of the spell to a variable EVENT A unit is issued an order to target an object Action Set Playertarget[Player number of owner of ordered unit]=target unit of issued order I used an array here, though you don't have to. The second trigger carries out the actual action Event Unit finishes casting an ability Cond Ability being cast = TransformX Playertarget[Player number of owner of casting unit]=malecitizen Action Replace Playertarget[Player number of owner of casting unit] with footman using relative life and mana Create item blah blah Hope this helps. |
| 12-15-2003, 01:02 AM | #3 |
Yes, buildings can have items. In my TD buildings have items. Does your building have an Inventory ability? And if you want it to be able to use the items it has to be a Hero inventory. |
| 12-15-2003, 01:23 AM | #4 | |
Quote:
I want when an item is purchased it goes into the buildings inventory (the building where purchased). Could you tell me the variable more detailed? Because when I try player variable it won't let me set the value. |
| 12-15-2003, 09:52 AM | #5 |
The trigger you are looking for is this Code:
[b]Events[/b] Unit - A unit sells an item [b]Conditions[/b] [b]Actions[/b] Hero - Create (item-type of (sold item)) for (buying unit) Your orignal trigger would give the unit that just sold the item the same item again allowing them to sell it over and over. A minor suggestion is that you add in a condition statment to check if the building invontory is full or not. As if it is the item will drop to the ground and the player will be able to sell it over and over again. Hope that helps Neo_Genesis |
| 12-15-2003, 11:20 AM | #6 | |
Quote:
Your incorrect. His original trigger IS right. Because it says "Hero - Create (item-type of (sold item)) for (selling unit)" it would give it to the selling unit (as it put in in the units inventory), NOT add it to the list availiable things to sell. Units that sell items DO NOT sell items from inventories, and his trigger would put the item in the unit's Inventory. The reason his first trigger doesn't work is prolly because the building doesn't have the "Inventory" ability. And if your read his post, he wants the unit thats selling the item to get the item, NOT the unit buying the item. Or at least thats the way I read it. |
| 12-20-2003, 12:09 AM | #7 |
Either one didn't work emote_confused |
| 12-20-2003, 04:32 AM | #8 |
Well, the triggers right. So the problem must be with the unit. Does it have the ability "Inventory - Hero" in the object editor? |
| 12-20-2003, 04:16 PM | #9 | |
Quote:
Yes the building has hero inventory. But when I buy items it just drops it on the floor....... And the other trigger th15 gave me didn't work either.......... I think it's because I can't set the initial value for the variable..... |
| 12-20-2003, 06:24 PM | #10 |
Okay just spent three hours, wasted my time. Buildings can't get items through triggers. And I'm not sure units with hero inventory can either. |
| 12-20-2003, 08:57 PM | #11 |
the reason that items are dropping when units try to buy them is becuase the building is missing the ability "select unit" otherwise the building doesnt know what unit to give the item to. |
| 12-20-2003, 09:57 PM | #12 |
Buildings CAN get items via triggers, and the DON'T need the select unit ability. I KNOW this because my map has a spell that a unit can cast on a building to give it an item (which of course is a trigger based spell). And it works FLAWLESSLY. EDIT: I am currently opening my map to look at the triggers to see what might be the problem/difference between yours and mine. EDIT2: Here is my trigger that WORKS: Code:
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to ****
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item carried by (get last target unit of (Casting unit)) in slot 1) Equal to No item
Then - Actions
Hero - Create *** and give it to (Get last order target unit of (Casting unit))
Game - Display to (Owner of (Casting unit)), at offset (0.00, 0.00) the text: The building has the item now.
Else - Actions
Game - Display to (Owner of (Casting unit)), at offset (0.00, 0.00) the text: That building already has that.
Unit - Set mana of (Casting unit) to ((Mana of (Casting unit)) + 150.00)
Unit - Reset ability cooldowns for (Casting unit)Note: You will not find "get the last target unit of (Casting unit)" in the normal WE. But you don't need it. But this trigger works fine. And the target is ALWAYS a building. Maybe its a 1.13 bug? I hope not.... EDIT3: CRAP! I just realized something that could be different between our maps.... My buildings DON'T have "Inventory (hero)" the have a CUSTOM spell BASED off "Inventory (hero)", I made the custom ability because I only wanted the building to have 1 inventory slot. Maybe you should make a new custom ability based off of the "Inventory (hero)" and give that to your buildings? |
