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

[Trigger] Infinite Loop

Status
Not open for further replies.
Level 4
Joined
Oct 11, 2008
Messages
90
I have a hero named worker and an item nearby named building hammer. When the hero picks the item, he turns into a hero named builder and when he drops the item he turns into worker again. For this i have 2 triggers:

  • Pick Hammer
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-Type of (Item being manipulated)) Equal to Building Hammer
      • (Unit-Type of (Hero manipulating item)) Equal to Worker
    • Actions
      • Unit - Replace (Hero manipulating item) with a Builder using The old unit's relative life and mana
  • Drop Hammer
    • Events
      • Unit - A unit Looses an item
    • Conditions
      • (Item-Type of (Item being manipulated)) Equal to Building Hammer
      • (Unit-Type of (Hero manipulating item)) Equal to Builder
    • Actions
      • Unit - Replace (Hero manipulating item) with a Worker using The old unit's relative life and mana
When the unit picks the hammer, the trigger works and he turns into a builder, but when he drops the hammer, the game freezes for a second, then wc3 crashes; my guess in that it entered an infinite loop.
How to make this work?
 
Level 12
Joined
Nov 20, 2007
Messages
660
base.gif
Drop Hammer
joinminus.gif
events.gif
Events
line.gif
joinbottom.gif
unit.gif
Unit - A unit Looses an item

joinminus.gif
cond.gif
Conditions
line.gif
join.gif
if.gif
(Item-Type of (Item being manipulated)) Equal to Building Hammer
line.gif
joinbottom.gif
if.gif
(Unit-Type of (Hero manipulating item)) Equal to Builder

joinbottomminus.gif
actions.gif
Actions
empty.gif
joinbottom.gif
unit.gif
Unit - Replace (Hero manipulating item) with a Worker using The old unit's relative life and mana

try to replace it with

  • Actions
    • Unit - Remove (Hero manipulating item) from the game
    • Set Temp_Point = (Position of (Hero manipulating item))
    • Unit - Create 1 Worker for (Owner of (Hero manipulating item)) at Temp_Point facing Default building facing degrees
 
Level 4
Joined
Oct 11, 2008
Messages
90
That would work, but the hero items, his exp, his level and all will be gone.
 
Level 4
Joined
Oct 11, 2008
Messages
90
@Maker
I did, but surprisingly, it still looped.

@Mooglefrooglian
I can't use chaos, because there will appear some complications later in my game.

Never mind, i found a way to evade this situation. Thx for the posts anyway.
 
Status
Not open for further replies.
Top