• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Trigger Help

Status
Not open for further replies.
Level 5
Joined
Dec 12, 2008
Messages
112
In my game, when a creep dies, it drops a book and when hero reads it, he learns the spell.

How do i make it so when the Hero reads another book, with different spell, that he learns that one and the other one before is removed?
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Well, you could drop custom tomes on the ground and then use the rawcodes of the tomes on the ground to check which book it is in order to level the appropriate ability for the hero.

Or you could simply use GUI and check wether the item that has been picked up by a hero is equal to the type of the custom tomes.

Either ways, it should be really simple. Do you want an example?
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
A simple version: http://www.hiveworkshop.com/forums/pastebin.php?id=yb45kn


  • Init Thingies
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Abilities[0] = Holy Light
      • Set Abilities[1] = Devotion Aura
      • Set Abilities[2] = Resurrection
      • Set Abilities[3] = Divine Shield
      • Set Items[0] = Tome of Holy Light
      • Set Items[1] = Tome of Devotion Aura
      • Set Items[2] = Tome of Ressurection
      • Set Items[3] = Tome of Divine Shield
      • Set Ability = (Ability being cast)
  • Devotion Aura
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • For each (Integer A) from 0 to 3, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item being manipulated)) Equal to Items[(Integer A)]
            • Then - Actions
              • Unit - Remove Ability from (Triggering unit)
              • Unit - Add Abilities[(Integer A)] to (Triggering unit)
              • Set Ability = Abilities[(Integer A)]
              • Item - Remove (Item being manipulated)
              • Game - Display to Player Group - Player 1 (Red) the text: true
              • Skip remaining actions
            • Else - Actions
              • Game - Display to Player Group - Player 1 (Red) the text: false


This will only ork for single unit, if to units are trying to use the system, then it will fail.

Use Bribe's unit indexer (search spell database) if you want it to work for multiple units, and make the ability variable an array.
Set ability[Custom value of triggering unit] = ...
Unit - Remove ability[Custom value of triggering unit] from unit
and it will work then.
 
Level 5
Joined
Dec 12, 2008
Messages
112
Ok now here is the thing, In my game, i have books and you have to use/read the book before learning the spell, like you pick up the book and you have to use it. then you learn one spell, and then the next book you read you learn another and remove the previously learnt one.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Ok now here is the thing, In my game, i have books and you have to use/read the book before learning the spell, like you pick up the book and you have to use it. then you learn one spell, and then the next book you read you learn another and remove the previously learnt one.

then just use replace Unit - A unit Acquires an item to Unit - A unit Uses an item, coz maker example seems ok
 
Status
Not open for further replies.
Top