• 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] item replacement

Status
Not open for further replies.
Level 1
Joined
Sep 1, 2008
Messages
5
Hello. I was wandering if there is someone here who can help me out a bit with a map i have on the productiion table.

My problem is quite simple, or at least i think so. In my map, you are supposed to be able to use say a shotgun, for this you need to combine a "shotgun ammo" and an "empty shotgun". when you du this, you get a "shotgun" with 8 charges, its a simple item with an abillity.

now, when the item reaches 0 charges, i'd like to make a trigger that replaces it with "empty shotgun" again. Does anyone know how to do this, how to define the moment and item when it reaches 0 charges?

I whould be very grateful for any help.

Regards
Spearhawkx
 
Level 1
Joined
Sep 1, 2008
Messages
5
what i have done so far, is that if you have one "ammo" and one "empty shotgun", those 2 combines into a "loaded shotgun", when you have used your 8 loaded shells, i'd like it to turn into a "empty shotgun again, to make sure that you can reload it. i see a idea with it staying in the same slot, my idea was that by a trigger remove the "no-charges-shotgun" and then give the hero a "empty shotgun".

see any way of doing it?
 
Level 1
Joined
Sep 1, 2008
Messages
5
Have the actual casted ability do nothing.

When it's casted, scan the inventory for a shotgun shells item (loop through each slot and check the item type). If found, decrease its charges by 1 and do your triggered effect.

I am not qat my own computer, so theres no rush, but i'll need some help with doing this. i've tried to read and try all the tutorials i can find on triggers, but i'm still not that used to it.


I have a similar question, and that is if it's possible to have a item called "gas" that you need to drive cars, and that it is used up per distance you drive?
 
Level 1
Joined
Sep 1, 2008
Messages
5
mana was my original idea, so that should be fine, but if anyone could give me a closer explanation of how to make purplepoot's idea work, i'd be very grategul.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
I'm assuming that the unit has the shotgun (After all, this assumes that the Fire ability is on it). Uses item variable TempItem for simplicity.

  • Shotgun Fired
    • Events
      • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability Being Cast) Equal to Fire Shotgun
    • Actions
      • For Each Integer A from 1 to 6, do Actions
        • Loop - Actions
          • Set TempItem = (Item carried by (Triggering Unit) in slot (Integer A))
          • If (All Conditions are True) Then do (Then actions) Else do (Else actions)
            • If - Conditions
              • (Item-type of TempItem Equal to Shotgun Shells) Equal to True
            • Then - Actions
              • Item - Set charges of TempItem to ((Charges of TempItem - 1))
              • -------- Do shotgun effects --------
              • Skip remaining actions
            • Else - Actions
      • -------- Optional --------
      • Custom script: call DisplayTextToPlayer(GetOwningPlayer(GetTriggerUnit()),0,0,"You need a shotgun shells item to fire a shotgun!")
      • -------- Note that changing the text between "" will change the message. Don't change anything else --------
 
Status
Not open for further replies.
Top