• 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.

Why does this crash?

Status
Not open for further replies.
Level 31
Joined
Apr 17, 2009
Messages
3,572
Hey, I want to forbid a unit to drop his items.
I though about this easy trigger:

  • Deactivate Inventory
    • Ereignisse
      • Einheit - A unit Verliert einen Gegenstand
    • Bedingungen
      • (Unit-type of (Triggering unit)) Gleich Crafting Menu
    • Aktionen
      • Held - Give (Item being manipulated) to (Triggering unit)
But it crashes the game.
If I use wait 0.01 seconds before giving the item it does work, but I don't want to see the item dropped.

Best would be if already the order would be canceled, but I didn't get it working because order(dropitem) is bugged somehow and doesn't reply to the standard events.

Can anyone help me please?
 
Level 6
Joined
Jul 29, 2011
Messages
90
Is "Crafting Menu" a hero unit? "Give (Item being manipulated) to (Crafting Menu)" appears to be a Hero command. If "Crafting Menu" is not a hero, I could see this causing problems, but I may be mistaken. I can't seem to find any non-hero version of this command under the "Units" commands either. I'll keep looking, and if I find something, I'll get back to you. I would imagine that if "Crafting Menu" is not supposed to be a Hero, then you'd probably rather not make it one if you don't have to, for obvious reasons.

EDIT: Perhaps you could try putting your wait command back in (which you said made it work before, so I guess it's not the Hero classification thing), but also add a "Hide (Last dropped item)" command before the timer? Then it would still be there for the 0.01 second timer, but just hidden, so you can't actually see it. And there's no need to unhide it after the pick-up, since it'll be picked up, and therefore no longer there.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
The event fires before the order is finished. Since the event response undoes the order it runs the order again (not sure why). The result is an infinite loop of this...
Event Unit A drops Item B
Action Item B given to Unit A
Event Unit A drops Item B
Action Item B given to Unit A
Event Unit A drops Item B
Action Item B given to Unit A

Either the game will freeze (100% single thread load, infinite loop) or crash with some error due to a limitation with the game programming or some freeze prevention system.

The solution I know of is to use 0 delay timer (waits are too slow) which gives the item back. 0 delay is sub-frame yet still long enough that the order can finish successfully.

Use this as first action
Custom script: call TriggerSyncReady()
What does this do? This is the first time I heard of that solution.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
I was almost sure it was causing a sleep lesser than wait action(still, it causes a lesser sleep but very minor difference), seems my memory betrayed me.

I know this drop event + give item thing crashes but I don't understand it lol.

I will show you 2 different solutions.First one is different, second solution is another version of what you currently doing(a small wait)

You can do something like this, first solution:

  • Deactivate Inventory
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Gleich Crafting Menu
    • Actions
      • Item - Make (Item being manipulated) Undroppable

If your crafting menu have that items before game start, do this.

  • Deactivate Inventory at Start
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Item - Make (Item carried by CRAFTINGMENU in slot (Integer A)) Undroppable

////////////////////////////////////////////////// second solution


  • Deactivate Inv
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Mountain King
    • Actions
      • Set INVENTORYCRASHITEM = (Item being manipulated)
      • Set INVENTORYCRASHHERO = (Triggering unit)
      • Countdown Timer - Start INVENTORYCRASHTIMER as a One-shot timer that will expire in 0.00 seconds
  • Deactive Inv Part 2
    • Events
      • Time - INVENTORYCRASHTIMER expires
    • Conditions
    • Actions
      • Hero - Give INVENTORYCRASHITEM to INVENTORYCRASHHERO
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
The easiest solution would be, when a unit begins casting an ability, if (Unit-type of (Triggering unit)) Equal to Gleich Crafting Menu, stop triggering unit.

Or if you don't need mana on crafting menu and your item abilities requires mana, you can set its mana to 0.
 
Status
Not open for further replies.
Top