• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Couple of Problems I Need Some Help With.

Status
Not open for further replies.
Level 6
Joined
Dec 9, 2014
Messages
176
After I had got a decent amount of work done on my map I decided to test out what I had and found a few problems that I'm not sure how to fix. The first problem I found was in my respawning thing I have for units owned by either Player 9 (Wildlife) or Player 12 (Undead Army). The trigger works great as long as nothing else dies before it's time to respawn the last unit that died. It won't make a new unit if another unit has died before the wait is done. If anyone can help me out there I would be very grateful. I'll post the trigger:

  • Respawn
    • Events
      • Unit - A unit owned by Player 9 (Gray) Dies
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
    • Actions
      • Wait 180.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 9 (Gray)
        • Then - Actions
          • Unit - Create 1 (Unit-type of (Triggering unit)) for Player 9 (Gray) at (Random point in (Region centered at (Position of (Triggering unit)) with size (800.00, 800.00))) facing (Position of (Triggering unit))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 12 (Brown)
        • Then - Actions
          • Unit - Create 1 (Unit-type of (Triggering unit)) for Player 12 (Brown) at (Random point in (Region centered at (Position of (Triggering unit)) with size (800.00, 800.00))) facing (Position of (Triggering unit))
        • Else - Actions

The 2nd problem is very weird. I'm using a stacking system along with an equipment system: http://www.thehelper.net/threads/item-stacking.48928/ and http://www.hiveworkshop.com/forums/spells-569/equipment-system-version-2-2a-123336/?prev=of%3Ddownloads%26o%3DDESC%26u%3DFlood%26d%3Dlist%26r%3D20

Anything that is in the bottom left slot of the inventory gets duplicated and placed on the ground if the inventory is full when exiting the equipment menu. If anyone could help me out here I would be very appreciative and +Rep happy lol!
 
Level 14
Joined
Oct 18, 2013
Messages
702
Hmm, well to begin with you will want to fix your location leak, the
  • (Random point in (Region centered at (Position of (Triggering unit))
because you definitely don't want a leak everytime a unit is respawned. If you need help on doing that I could show you, not too hard. Sometimes you can do things like this with waits, but i guess not with this one. If I am correct, it is because you evaluate triggering Unit after 3 minutes, so any other unit event would override triggering unit. I would so your trigger like this:

  • Unit - A unit Dies
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Player number of (Triggering player)) Equal to 9
          • (Player number of (Triggering player)) Equal to 12
    • Then - Actions
      • Set TempLoc[ReviveInt] = (Position of (Triggering unit))
      • Set UnitType[ReviveInt] = *Type of triggering unit* Something like that.
      • Set ReviveInt = (ReviveInt +1)
    • Else - Actions
  • Wait 180.00 seconds
  • Create 1 (UnitType[ReviveInt]) for *owner* at (TempLoc[udg_ReviveInt])
  • Custom script: RemoveLocation (udg_TempLoc[udg_ReviveInt])
  • Set ReviveInt = (ReviveInt -1)
Wrote most of this freehand, but can you see what I mean? Alternatively you could do something with timers to the same effect.
 
Level 12
Joined
Oct 16, 2010
Messages
680
kakerate that example u gave won't work since it will respawn the last unit type always...

e.g. footman dies unittype gets saved
within time rifleman dies and gets saved
after 180 sec instead of footman a rifleman will gets revived

U need a FIFO, not a LIFO stack

working version of yours(and without wait, its bad, don't use waits as they leak timer handle)
  • Events
    • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Player number of (Triggering player)) Equal to 9
          • (Player number of (Triggering player)) Equal to 12
    • Actions
      • Set TempLoc[EndInt] = (Position of (Triggering unit))
      • Set UnitType[EndInt] = (type of (triggering unit)) Something like that.
      • Set Owner[EndInt] = (triggering player)
      • Set ReviveInt = (EndInt +1)
      • Timer - Start a one-shot timer that expires in 180 sec
  • Events
    • Game - a timer is expired
  • Conditions
  • Actions
    • Create 1 (UnitType[StartInt]) for Owner[StartInt] at (TempLoc[StartInt])
    • Custom script: RemoveLocation (TempLoc[StartInt])
    • Set StartInt = (StartInt +1)
    • If all conditions met, do actions
      • Conditions
        • StartInt == EndInt
      • Then
        • Set StartInt = 0
        • Set EndInt = 0
 
Last edited:
The wait function does not leak anything. The PolledWait does not recycle the handleId of the used timer.

If you want to re-create a unit somewhere close to DyingUnit, but not necessarily at same location, you can randomize an angle from 0-360, and a distance from 0-800 to get your respawn location with polar offset. No need to create a rectangle for it. :)
 
Level 6
Joined
Dec 9, 2014
Messages
176
So I got a good working revive system in place now and I have an update on the 2nd problem. Apparently if I have any item in my inventory with more than 1 original charge when exiting the equipment menu, 1 charge is deducted from that item and a duplicate item with charges equal to the original amount is placed on the ground. For example, I picked up an item that has 5 charges on it, if my inventory is full when I exit the equipment menu it will deduct 1 charge from it and place the same item on the ground but with 5 charges, if the same is done with an item that was originally 1 charge then it doesn't happen. For now I can fix this by simply having all items start with only 1 charge but I was hoping to be able to use items with multiple charges sometimes like in the case of getting a few charges of food from a quest reward.
 
Status
Not open for further replies.
Top