can anyone show some example of trigger?
Ezekiel12 has explained it nicely for you.
Ezekiel12 said:
DotA currently has quite every item at least fourfold. The ones you see in the shops are units, the ones added to a unit when an item is bought or picked up are tomes so they can be picked up even when the inventory is full. Triggers react to the pick up of those tomes and create the real items accordingly. Lastly there are the disabled versions of the items ofc.
What does this mean? You will need to have four different objects for each 'item'
1. A dummy unit at the shop which players purchase (mercenary camp style I believe?). The unit should have the portrait of the item it represents.
2. A dummy tome that is created when the dummy unit is trained. The tome is moved to the hero's inventory immediately upon creation. A trigger then detects which tome was consumed/used and then creates the real item in the hero's inventory.
3. Finally, the real item. This is added after consuming a corresponding tome.
4. In the case that the hero's inventory is full, the item created would just spawn at the feet of the hero. However, if you have a backpack system, you could detect this and just put the item there. Likewise if you are using item pages (put the item at an open slot in a non-filled page).
So besides 3x objects for each item (dummy unit, dummy tome, real item), you'll need several triggers. Detect when a dummy unit is trained, detect when a dummy tome is consumed, and detect when inventory is already full to put the extra item somewhere.