| 05-27-2006, 12:22 PM | #1 |
Hello everyone Im having some problems with moving of rects. I have a rect that i want to move around, but because it says you can only move variable rects ive made something like this: Trigger: ![]() Set AR = ARect
![]() Set HR = HRectAnd when i want to move it, i save the (Position of (Triggering Unit)) in a Point variable. Then i use Rect - Center AR on (X of (Var1)), (Y of (Var2)). But this is where it gets funky. Cant i use a Rect i created in the "editor itself". |
| 05-27-2006, 12:27 PM | #2 |
It should work, however, all events refering to the rect will not move with the rect. You should create a new event/trigger each time you move the rect. |
| 05-27-2006, 12:46 PM | #3 |
Oh! That explains a bit :) Im going to try it now, thanks! But i need an event when a unit enters the rect, but i cant select the variable as rect in the event. How do i change this in JASS? JASS:call TriggerRegisterEnterRectSimple( gg_trg_Alliance_Pickup_Flag, udg_HR ) |
| 05-27-2006, 01:51 PM | #4 |
Btw, the moving of the rect works fine, im testing with a special effect in the center of it and it looks ok. But the event to enter the moving region doesnt work. |
| 05-27-2006, 03:35 PM | #5 | |
Quote:
As he already said. If you don't know how to dynamically create triggers and events, then you'll have to learn if you want to do that (requires JASS). Or, you could get someone else to do it, if you tell them exactly what you need. |
| 05-27-2006, 05:05 PM | #6 |
All i need is the code to make the event work which detects when a unit enters the rect stored in variable HR. |
| 05-27-2006, 05:15 PM | #7 |
You can't. When the event is created, it bases the data off of the region, but it is then no longer linked to the region. |
| 06-02-2006, 01:44 PM | #8 |
So i need to recreate the event every time i move the rect? |
| 06-02-2006, 01:55 PM | #9 |
Yes. |
| 06-02-2006, 02:31 PM | #10 |
Enter/Leave events are not referenced to rects, in fact they are referenced to regions: JASS://=========================================================================== function TriggerRegisterEnterRectSimple takes trigger trig, rect r returns event local region rectRegion = CreateRegion() call RegionAddRect(rectRegion, r) return TriggerRegisterEnterRegion(trig, rectRegion, null) endfunction If you move the rect or anything like that , it won't affect the region that is created when adding the event to the trigger. So you better create a region event instead of a rect event and move the region registered to the event. |
