| 05-05-2007, 01:23 PM | #1 |
I have a spell that i'm working on that consists of 2 units that are linked to eachother via triggers entirely. The trigger detects when any ground units come within range of either one.. and when a unit does come within range they will be instantly moved/ported to it's twin and vice versa. it is pretty much just like the way waygates work but is fully triggered using none of the native waygate abilities. when a unit steps within range and it ports the unit to it's sister gate.. i have it move the unit to the position of the other gatelike unit. but ... the problem is this.. When it does, the other gate also detects the same thing and then instantly ports it back.. and after it ports it back the first gate detects again and ports again.. and so on and so on. repeating endlessly, making the unit forever stuck in limbo of bouncing back and forth between gates. i'm trying to figure out a way to lock it out.. to block it somehow from noticing the difference between a unit that was just ported verses a unit that really walked there. My only ideas are to change the units' classification to something that the trigger wont allow.. like removing the "ground" unit classification.. or adding the "flying unit" classification and telling the trigger to never transport flying units. thing i'm worried about with it though is that this is a multi-instance trigger that could have swarms of units walking into a gate at any giving moment and i'm affraid that some might end up with permanately messed up classifications that weren't fixed properlly upon transport. any ideas? this trigger has absotely no wait-states or timers involved... there is no delays so i need things to be instant. Edit>so in order for the unit to use the gate again they will have to step outside of the range and then back in to retrigger the "unit within range" |
| 05-05-2007, 01:58 PM | #2 |
I assume u use two triggers(one trigger for each unit) but if u don't then make two triggers. When one trigger is ran, before teleporting unit to another, turn off corresponding trigger and after doing it turn it on again. This should do the job. |
| 05-05-2007, 02:27 PM | #3 |
no, it's using 1 trigger that has 2 events then conditions inside if/then/elses to find which one is being triggered i have the trigger turn itself off.. then does all the other functions.. then turns itself back on... wouldn't that be just as good? trigger turn off this trigger (bunch of other functions) move units turn on this trigger this was one of the ideas i had about trying to protect against endless looping.. but no luck. since the move is between the two.. i would think that it wouldn't trigger but it does. it's weird. i do this technique a lot with various other types of triggers with good results but for some reason this unit comes within range type of trigger seems to set off no matter. |
| 05-05-2007, 02:40 PM | #4 |
I don't think Unit Comes Within Range is instant, hence the problem with it. |
| 05-05-2007, 02:44 PM | #5 |
When you move a unit from one waygate to the other, don't move the unit INSIDE range of the other waygate. Move him a little bit out of it. This will fix what I think is your problem. (I didn't actually read the post *Cough*) |
| 05-05-2007, 02:59 PM | #6 | ||
Quote:
ya i know what you mean. i actually have the trigger temporarily set up like that but i really want it centered on top of where the warping point is btw, y eah i did type quite a bit. couldn't think how to explain it. Quote:
would a 0 second timer solve this? have that be the trigger to turn the previous one back on or used to change classification back? |
| 05-05-2007, 03:06 PM | #7 |
No, a 0 second timer wouldn't, I think, as it has to be more than 0 seconds for this one I believe (unlike most non-instant ones, where any wait at all will do). 0.1 may work. |
| 05-05-2007, 03:10 PM | #8 |
Here's a method. Make regions on top of the waygates and then try this. Trigger: |
| 05-05-2007, 03:34 PM | #9 |
um. i guess i failed to mention that these waygate units are never in the same location so a region may not be good. they are placable. |
| 05-05-2007, 03:58 PM | #10 |
You can always move regions with triggers. Otherwise I still say the move offset is the best way to do it. Something like this isn't worth spending a lot of time battling. |
| 05-05-2007, 04:02 PM | #11 | |
Quote:
JASS:function TriggerRegisterEnterRectSimple takes trigger trig,rect r returns event local region rectRegion = CreateRegion() call RegionAddRect(rectRegion, r) return TriggerRegisterEnterRegion(trig, rectRegion, null) endfunction Wrong. move the rect all you want, the region stays in the same place. |
| 05-05-2007, 04:04 PM | #12 |
Wrong? I didn't say anything about the events still working. But try to tell me I'm wrong that you can't change a region's limits. (Rect in jass) Sheesh. |
| 05-05-2007, 04:11 PM | #13 | |
Quote:
|
| 05-05-2007, 04:19 PM | #14 |
There is a command in GUI for moving a "region." The thing is that a region in GUI is a rect in jass, so you can move the rect and then use these calls to update the region. JASS:call RegionAddRect(MyRegion, MyRect) call RegionClearRect(MyRegion, MyRect) Griffy's idea may work, though it may also be sloppy. You'd need a timer to keep that accurate enough, then you'd still have a minimal window for error. Like if two units entered the range at the same time, etc. But really Brash, I recommend sticking with the unit teleporting a little bit off center. It saves so much unnecessary work for a really inconsequent issue. |
| 05-05-2007, 04:44 PM | #15 |
well, the reason i'm interested in the units moving to the exact location is that when i use an offset sometimes the gate is near unpathable terrain and the unit happens to be moved there then is moved back into hole. also, sometimes at certain cliffs when the unit is moved to that spot it will actually land a great range away. for instance: when i put the gate near this one certain cliff at the right angle.. then move it with an offset and it lands on that cliff's corner it jumps my unit to this one spot that is about 600 range away! so i've figured that if i could just place the unit directly on the gate unit.. then surely for the gate unit to be where it is it must be pathable for the other units and would be guaranteed to not do those weird jumps. |
