• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Replace Item (Unit Group) with Time Event

Status
Not open for further replies.
Level 5
Joined
Mar 24, 2020
Messages
80
Hi!

I have an item in my game that has set effects depending on whether it is day or night.

Below is a trigger I am having issues with.

When the event occurs where it hits 6PM/6AM - this trigger is supposed to replace the item with the night/day variant.

Below is the trigger. Let me know if there is something obvious i'm doing wrong or if you may see why there can be a crashing issue.

  • Day Time
    • Events
      • Game - The in-game time of day becomes Equal to 6.00
    • Conditions
    • Actions
      • Set VariableSet DayTime = True
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has an item of type Night Time Item) Equal to True)) and do (Actions)
        • Loop - Actions
          • Hero - Drop (Item carried by (Picked unit) of type Night Time Item) from (Picked unit).
          • Item - Remove (Last dropped item)
          • Hero - Create Day Time Item and give it to (Picked unit)
 
Last edited:

Uncle

Warcraft Moderator
Level 74
Joined
Aug 10, 2018
Messages
7,961
If there's a crash it's most likely because of another trigger, I suspect one that involves "A unit loses/acquires" an item.

That aside, if you have multiples of these items then you probably want to replace all of them if a unit is carrying more than 1.

  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
    • Loop - Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Picked unit) in slot (Integer A))) Equal to Night Item
            • Then - Actions
              • Item - Remove (Item carried by (Picked unit) in slot (Integer A))
              • Hero - Create Day Item and give it to (Picked unit)
            • Else - Actions
 
Level 5
Joined
Mar 24, 2020
Messages
80
If there's a crash it's most likely because of another trigger, I suspect one that involves "A unit loses/acquires" an item.

That aside, if you have multiples of these items then you probably want to replace all of them if a unit is carrying more than 1.

  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
    • Loop - Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Picked unit) in slot (Integer A))) Equal to Night Item
            • Then - Actions
              • Item - Remove (Item carried by (Picked unit) in slot (Integer A))
              • Hero - Create Day Item and give it to (Picked unit)
            • Else - Actions

Hi Uncle,

Thanks for the trigger. it should work, unfortunately when it hits the time Warcraft crashes. I will disable a few other Item based triggers and see if it works.
 
Status
Not open for further replies.
Top