| 03-10-2005, 05:30 PM | #1 |
Pairing two questions into one: First off, I've been getting a little discouraged trying to add two conditions to a loop I've made. Here's the loop, with just one condition: Code:
loop
exitwhen ( RectContainsUnit(RectFromCenterSizeBJ(pntTarget, 75.00, 75.00), uBoulder) == true )
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.30))
endloopSo every .3 seconds, it checks to see if a unit is in a given area. If it is there, it exits the loops. Unfortunately, when I try to do this: Code:
loop
exitwhen ( GetBooleanOr(RectContainsUnit(RectFromCenterSizeBJ(pntTarget, 75.00, 75.00), uBoulder) == true, iCounter > 30) )
set iCounter = iCounter + 1
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.30))
endloopMy entire warcraft crashes. What I'm trying to do is set up a scenario where it waits for the first condition, but if that condition doesn't happen after a certain number of loop iterations, then it exits the loop. I imagine I just have some small syntax problem. Anyone see anything wrong? My second question is a theory question. I have a completely triggered channeling spell that I want to be multi-unit and multi-instanceable. The channeling spell works by using loops to create dummy units that cast spells, and when the unit stops channeling the dummy units aren't created anymore. The problem is, I don't really know a good way to detect when the unit stops channeling. The way I have it set up now is I have a separate trigger that detects when the unit stops channeling that sets a Global boolean to true when he stops casting. The loop looks like this: Code:
set udg_bUnitDoneCasting = false
loop
exitwhen udg_bUnitDoneCasting = true
// Create dummy units to deal damage with spells...
Call PolledWait(.75)
endloopIt works, but it's bad because I'm using a global variable. If two units cast this spell at the same time, whoever stops channeling first will end it for the other unit. I could of course make udg_DoneCasting into an array using Player Number as the index, but then every player could only have one caster. Thanks for any help on either problem. |
| 03-11-2005, 06:16 PM | #2 |
for the conditions you separate them with or not a comma (it could be Or or || tho, so convert a gui trigger to jass to check) for casters, you could make a unitgroup with all of them. instead of loops you should use events. there is a unit enters region event. your current loop leaks a region every time (cause the function RectFromCenterSizeBJ makes one that you don't destroy) there are events for unit starts and stops channeling spells, so use those not loop. when it starts that spell put it in the unitgroup. when it stops take it out. then separate trigger pick every unit in the currently-casting unit group and for each one do the spell effects. |
| 03-11-2005, 07:43 PM | #3 |
Hmm thanks for the help. I did convert a GUI function to JASS, and I get the "GetBooleanOr" function as a result. That's why I used a comma, I was separating arguments for the function. But if JASS supports a standard or (be ir OR or ||) then that makes things that much easier for me. I know it's leaking right now, I'll clean that up. I don't really have the option of a using separate trigger with a Unit Enters Region in this case (it's a sort of modified blink - I hide the caster and spawn a unit and order it to move to a location. When it arrives at the location, I kill the spawned unit and unhide the caster) as it would just be too much of a headache. For the conceptual question you hit the nail on the head. That would work perfectly, and although I'd have to set a limit on how many casters could cast (limited by the Array size) it would pretty much allow as much multi-instancing as I want. Thanks! |
| 03-12-2005, 07:14 AM | #4 |
oh oops didn't even see getbooleanor function. i don't know exactly how that works. but jass does have 'or' and 'and' so use those :) there is documentation on them here: http://jass.sourceforge.net/doc/expressions.shtml |
