• 🏆 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] Can not move rectangles (locations)

Status
Not open for further replies.
Level 37
Joined
Mar 6, 2006
Messages
9,240
I'm trying to move a rectangle every time I click an item, so that the rectangle relocates to the position of the last item clicked.

Here's my current trigger:

  • Relocate Rectangle
    • Events
      • Unit - A unit owned by Player 1 (Red) Is issued an order targeting an object
    • Conditions
    • Actions
      • Set ItemLocation = ItemPickUp <gen>
      • Set ItemPoint = (Position of (Target item of issued order))
      • Rect - Center ItemLocation on ItemPoint
It doesn't work. The rectangle won't relocate. It stays in it's original position. I've been out of modding for almost three years, but I remember moving rectangles around all the time. I can't figure out why it's not working now.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
You mean ...targeting an item

There's no such thing in the editor.

This makes creatures to move to the location:

Unit - Order (Triggering unit) to Move To (Position of ItemTargeted)

so I think the event is correct.

I'm using WE Unlimited, if it makes any difference.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Erm, as far as I see, it should work perfectly.
You didn't fix the leak in that trigger, but maybe it's for later use... as far as I'm concerned, it's good :p

I have tested it exactly as you did (but I've added a special effect to see where the rect was) and it moved.
I wouldn't advise using WEU, though... it might ruin your map and, if you use advanced funcrions, it will cause lag.

The event is correct, an object is anything you can target inside the object editor.
The actions are correct as well: first it sets the rect to a variable, then it sets a point to a variable and it moves the variable-rect to that point.

Well, it would be a really stupid problem if you weren't red when testing :p

Conclusion:
I can't help you, since this trigger should work perfectly fine.
 
Level 8
Joined
Aug 4, 2006
Messages
357
I do not have WEU, but your trigger looks fine (except that the region action should be "Region-" instead of "Rect-"). How do you know that the region is not being moved? The only problem I can forsee is that you may be incorrectly detecting the position of the region. Please post the other trigger you use to detect where the region is.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
The rectangle does move.

If you are using triggers such as "A unit enters region", then note that rectangles are not the same as regions. When you're moving the rectangle, the region which is used in "A unit enters region" does not move with you.

Also display a text message to see if your trigger actually runs. If that doesn't happen, your event causes a problem. Maybe ping minimap at the point as well.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
I'm a freaking idiot. The rectangle does indeed move. I can spawn footsoldiers around for testing purposes, and they appear in different locations just as they should.

I'm using other trigger that detects units entering a region, and that region doesn't move around. I'm trying to make it so that when an object is clicked and the Hero gets close to it, something happens. I'll have to think of something.

Thanks for all the help.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
I got things to work with a dummy unit of some sort....basically what I was trying to do was an item stacking system of my own.

It now stacks items correctly. Stacks dropped to ground and picked up work. If inventory is full, it still picks up and stacks items. Normally the hero wouldn't move to the item if inventory is full, now he does and picks the item up (if it's stackable).

But you get that "Inventory is full" sound, which I'm now trying to get rid of next.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Why don't you make an additional dummy item that is automatically consumed (such as tome of strength) when picked up? That way you can easily detect if an item is being picked up, and don't get any warning messages. That's how most stacking systems work and it seems like a much safer way to do this...
 
Status
Not open for further replies.
Top