• 🏆 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!

[Solved] Spawn Hero => Giving Item

Status
Not open for further replies.
Level 3
Joined
Jul 30, 2011
Messages
50
When I spawn Hero (when i enter with wisp on region), That hero "having(giving)" one Item... How can i do that?

Ex: Like x Hero Siege => When I spawn hero, Hero having: Item: Heal , Mana and Ankh

- How can I do that ?

- Sorry for my bad english... xD
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Depends on the event, may be something like:

  • Your Trigger
    • Events
      • A Unit Enters (Playable map area)
    • Conditions
      • (Triggering Unit) is A Hero Equal to True
      • Actions
        • Hero - Create item ***** and give it to (Triggering Unit).
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
DDLove, whenever you do something that "doesn't work", post the trigger that isn't working, otherwise it's impossible for us to know exactly what's the problem and how to fix it.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Offtopic:
DDLoveCheck the Reply Box, where you write the answers. It has a "Go Advanced" Below. on Advanced Reply you can find the "Manage Attachments", where you can post your map without using external sources.
 
  • Hero Copy
    • Events
      • Unit - A unit enters Region 001 <gen>
    • Conditions
      • (Unit-type of (Entering unit)) Equal to Wisp
    • Actions
      • Unit - Create 1 Blood Mage for (Owner of (Entering unit)) at (Center of Region 004 <gen>) facing Default building facing degrees
      • Hero - Give Ankh of Reincarnation 0170 <gen> to (Triggering unit)
      • Unit - Kill (Entering unit)
Entering unit = Unit that enter into that rect above
Triggering Unit = Unit that trigger this trigger (same as Entering unit in this case)

  • Hero - Give Ankh of Reincarnation 0170 <gen> to (Triggering unit)
Will create item and give it to Triggering unit or should I say Entering unit.
But your target unit is new hero now.
so you need to give unit to Last Created Unit like Maker suggested above.

Fixed trigger
  • Hero Copy
    • Events
      • Unit - A unit enters Region 001 <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Wisp
    • Actions
      • Set p = (Center of Region 004 <gen>)
      • Unit - Create 1 Blood Mage for (Owner of (Triggering unit)) at p facing 0.00 degrees
      • Custom script: call RemoveLocation(udg_p)
      • Unit - Kill (Triggering unit)
      • Hero - Give Ankh of Reincarnation 0170 <gen> to (Last created unit)
 
Level 3
Joined
Jul 30, 2011
Messages
50
Hey Kobas, The " call RemoveLocation(udg_p) " Have Error. ( To Complie )

Offtopic:
DDLoveCheck the Reply Box, where you write the answers. It has a "Go Advanced" Below. on Advanced Reply you can find the "Manage Attachments", where you can post your map without using external sources.
Check now.
 
Level 3
Joined
Jul 30, 2011
Messages
50
Sorry for (+2 Post)
But, there is an problem!

I put to all (last created unit) , and it work with (SinglePlayer)
But when i play MP, my Items disabled and giving to 6nd (to last player) and all not have Items... only Last Player...


If you want Map to see here is:
 

Attachments

  • Hero_Battle.w3x
    648.2 KB · Views: 40
Triggers are really bad, you can merge them into 4 or 5 triggers.
Memory leaks, a lot of them.
Unneeded conditions.
Unneeded actions.

And about problematic trigger.
You should check my solution above.

But problem is next:
  • Hero - Give Ankh of Reincarnation 0170 <gen> to (Last created unit)
Ankh of Reincarnation 0170 <gen> is ITEM GENERATED WITHIN WE.
You don't create new items and give them to heroes, you just move this one from hero to hero.

Use this code instead:
  • Hero - Create Ankh of Reincarnation and give it to (Last created unit)
 
Status
Not open for further replies.
Top