| 11-12-2003, 08:40 PM | #1 |
When I have a wait function, it cancels out the event response (casting unit). Since multiple units might be casting this spell during the 20 second duration, it is a problem to use variables. How can I get the value of casting unit after waiting for 20 seconds. |
| 11-12-2003, 08:46 PM | #2 |
Can multiple units owned by the same player cast it at the same time? If not you could use an array and use the player numbers as the index. But if multiple units owned by the same player can cast the spell at the same time it won't work... |
| 11-12-2003, 08:51 PM | #3 |
There's a way it can work. I know there's a way. I just need to find it. EDIT: Aha! I figured out how to do it! Wards! Brilliant! |
| 11-12-2003, 08:57 PM | #4 |
Hmmm... Well the only time I've ever has a wait cancel out the "Event Responce (casting Unit)" is if the wait was over 30 seconds, so are you sure thats the problem? (does the trigger fire fine without the wait?) Another Idea would be to do arrays, and have the index do a +1 each time, but that might start to cause lag later after a whole lot of units cast the spell... I know there is a way to "Clean Up" arrays as your using them, but that would require JASS, and I don't know JASS.. EDIT: Wards? Sounds like you got it figured out, glad to hear it. |
| 11-12-2003, 09:26 PM | #5 |
Lil help? I figured it out, but it's not working.... well it is. Partially. Code:
EVENTS - Time - Every 0.50 seconds of game time
ACTIONS - Unit Group - Pick every unit in (Units of type Sentry Ward) and do (Actions)
Loop - Actions
Unit Group - Pick every unit in (Units in (Entire map) matching (((Matching unit) is in (Units within 200.00 of (Position of (Picked unit)))) Equal to True)) and do (Actions)
Loop - Actions
Unit - Add Spell Immunity to (Picked unit)
Unit Group - Pick every unit in (Units in (Entire map) matching (((Matching unit) is in (Units within 200.00 of (Position of (Picked unit)))) Equal to False)) and do (Actions)
Loop - Actions
Unit - Remove Spell Immunity from (Picked unit)
For each (Integer A) from 1 to 30, do (Actions)
Loop - Actions
Special Effect - Create a special effect at ((Position of (Picked unit)) offset by 200.00 towards ((Real((Integer A))) x 12.00) degrees) using Abilities\Spells\Undead\ReplenishMana\SpiritTouchTarget.mdlFor some reason it only works for the ward most recently casted. Why? |
| 11-12-2003, 09:40 PM | #6 |
Well... I don't know if a "Pick Unit" loop will work inside another "Pick unit" loop, because it seems that the first "pick Unit" loop is picking the last ward cast, then stops running so it can run the 2 inside it.... Heres what I mean: Code:
EVENTS - Time - Every 0.50 seconds of game time
ACTIONS - Unit Group - Pick every unit in (Units of type Sentry Ward) and do (Actions)[color=red]This loop runs 1 time, picking only 1 of the wards. and doesn't run again after the other 2 pick unit loops run.[/color]
Loop - Actions
Unit Group - Pick every unit in (Units in (Entire map) matching (((Matching unit) is in (Units within 200.00 of (Position of (Picked unit)))) Equal to True)) and do (Actions)
Loop - Actions
Unit - Add Spell Immunity to (Picked unit)
Unit Group - Pick every unit in (Units in (Entire map) matching (((Matching unit) is in (Units within 200.00 of (Position of (Picked unit)))) Equal to False)) and do (Actions)
Loop - Actions
Unit - Remove Spell Immunity from (Picked unit)
For each (Integer A) from 1 to 30, do (Actions)
Loop - Actions
Special Effect - Create a special effect at ((Position of (Picked unit)) offset by 200.00 towards ((Real((Integer A))) x 12.00) degrees) using ---Heres an Idea: 2 New variables: Wards = Unit array Wardcount = Integer Code:
Activating wards
EVENTS - Time - Every 0.50 seconds of game time
ACTIONS - Do loop for integer B from 1 to Wardcount
If then else multiple fuctions
If
Wards[integer b] = alive
then
Unit Group - Pick every unit in (Units in (Entire map) matching (((Matching unit) is in (Units within 200.00 of (Position of (Picked unit)))) Equal to True)) and do (Actions)
Loop - Actions
Unit - Add Spell Immunity to (Picked unit)
Unit Group - Pick every unit in (Units in (Entire map) matching (((Matching unit) is in (Units within 200.00 of (Position of (Picked unit)))) Equal to False)) and do (Actions)
Loop - Actions
Unit - Remove Spell Immunity from (Picked unit)
For each (Integer A) from 1 to 30, do (Actions)
Loop - Actions
Special Effect - Create a special effect at ((Position of (Picked unit)) offset by 200.00 towards ((Real((Integer A))) x 12.00) degrees) using ---
else
Set variable Wards[integer b] = Wards[Wardcount]
Set variable Wardcount = Wardcount -1
Unit Group - Pick every unit in (Units in (Entire map) matching (((Matching unit) is in (Units within 200.00 of (Position of (Picked unit)))) Equal to True)) and do (Actions)
Loop - Actions
Unit - Add Spell Immunity to (Picked unit)
Unit Group - Pick every unit in (Units in (Entire map) matching (((Matching unit) is in (Units within 200.00 of (Position of (Picked unit)))) Equal to False)) and do (Actions)
Loop - Actions
Unit - Remove Spell Immunity from (Picked unit)
For each (Integer A) from 1 to 30, do (Actions)
Loop - Actions
Special Effect - Create a special effect at ((Position of (Picked unit)) offset by 200.00 towards ((Real((Integer A))) x 12.00) degrees) using ---
Tracking Wards
Event - Unit enters playable map area
Condition - Entering unit is of type Ward
Actions
Set variable Wardcount = Wardcount +1
Set variable Wards[wardcount] = entering unit |
| 11-12-2003, 09:47 PM | #7 |
So how I can do it properly? It looks so good! Come on, please somoene get it to work. |
| 11-12-2003, 09:54 PM | #8 |
Appearently I was editing, while you were replying... I believe my trigger above is exactly what you need. :D |
| 11-12-2003, 09:56 PM | #9 |
I seeee. Thank you very much :D HERRMMMM. This doesn't seem to be working. Give me a minute to assimilate this trigger. |
| 11-12-2003, 10:06 PM | #10 |
Actually it won't work, for the same reason your first trigger isn't working... Only the LAST ward selected actually takes effect, because after you apply the effect to the units, your taking them off because they aren't near the next one... hold on, I know how to fix that... Use the Ward and ward count variables. And the ward count setup trigger (the second one above) and do the following. Code:
Events - Every .5 seconds (or whatever)
Actions
Pick all units in playable map area matching conditions (matching unit NOT equal to Ward)
Actions:
remove "Spell immunity" from picked unit
Do loop for integer B from 1 to WardCount
If wards[integer b] = alive
then
if
picked unit is within 600 of wards[integer b]
then
give picked unit "spell immunity"
else
do nothing
else
set variable wards[integer b] = wards[wardcount]
set variable wardcount = wardcount - 1
if picked unit is within 600 of wards[integer b] then give picked unit "spell immunity" else do nothing |
| 11-12-2003, 10:09 PM | #11 |
Actually with yours, it doesn't work at all, no special effects, nothing. |
| 11-12-2003, 10:17 PM | #12 |
Didn't work at all? Wonder where I messed it up... it should've worked... Well did you try my new one? (would you like me to stop trying and see if someone else could help you better? No hard feelings if you do.. I haven't been much help..) EDIT: I didn't put the special effects event in the newest trigger, but I think you know where to put it. |
| 11-12-2003, 10:18 PM | #13 |
Let me try your new one. Don't worry, you're doing fine. YEY! It works! Thanks! |
| 11-12-2003, 10:22 PM | #14 |
If it doesn't work it coud be because the "Unit enters region (playabel map area)" in the Ward tracking trigger doesn't work for summoned units (I have no idea if it does or not...) It could also be because the Ward Update trigger is running too often... maybe you should set it to like 1 second (if a unit leaves the ward the spell immunity should wear off, not just vanish anyway, this way if the unit leaves the ward they might still be immune for another second, and also when a unit enters the ward it won't Immediatly get the immunity..) EDIT: Glad it works, and glad to be of assistance :D |
