| 12-27-2003, 08:45 PM | #1 |
Maybe my subject wasnt so good but I have a problem I dont really need fixed right now but it is good to know for other too... This is just an example, I dont even use this trigger... Look at this trigger: Code:
[color=red]A unit is attacked[/color] [color=limegreen]Unit-type of attacking unit equal to Freeze Tower[/color] [COLOR=sky blue]Pause attacked unit Create a special effect located in Spells\Undead\FreezingBreath\FreezingBreathArt.mdx at origin of attacked unit Wait 10 game-time seconds Unpause attacked unit Remove last created special effect [/color] The last one doesnt work if a new special effect comes between...and if I make it to a variable then the old variable will be replaced. This could work 2 ways: 1. If you have some kind of local variable (think it is possible with JASS). 2. If you make the variable to an array that increases every time the trigger run and then check what the variable was 10 seconds ago NOTE: I know this way works now with 1.13 in an easy way: Give the tower bash and change the buff...but I wanna do it this way, the last thing maybe not work in other cases. |
| 12-27-2003, 09:33 PM | #2 |
You already answered the question yourself. A local variable is the way to go. This can even be done without converting the entire trigger to JASS using the custom script action. There are several threads about this so just search for them. |
| 12-27-2003, 10:58 PM | #3 |
No I didnt answer the question! I asked if it was possible with JASS and then HOW to do it... |
| 12-27-2003, 11:35 PM | #4 |
local effect your_var_name ... set your_var_name = GetLastCreatedEffectBJ() ... call DestroyEffect(your_var_name) That are the lines to insert in your trigger. You can use the custom script action for that. |
| 12-28-2003, 01:08 AM | #5 |
local effect your_var_name= GetLastCreatedEffectBJ() Andy correct me if I'm wrong but wouldn't this be most optimal? |
| 12-28-2003, 12:42 PM | #6 |
In his case that is not possible as the special effect is only created within the trigger/function and local variables have to be at the beginning of the function. |
| 12-28-2003, 12:51 PM | #7 |
u need two variables: AttackedUnit/Unit SFX/Special Effect E: A Unit is Attacked C: Unit-type of attacking unit equal to Freeze Tower A: Set AttackedUnit = Attacked Unit Pause AttackedUnit Create a special effect located in Spells\Undead\FreezingBreath\FreezingBreathArt.mdx at origin of attacked unit Set SFX = Last Created Special Effect Wait 10 game-time seconds Unpause AttackedUnit Remove SFX thats should do it :D its because of the waiting "action" then it wont store attacked unit, and last created special effect... |
| 12-28-2003, 01:27 PM | #8 |
That will not solve the problem when there are several of these triggers running at the same time. But that reminds me that I forgot the local variable to store the attacked unit: local unit attacked_unit = GetTriggerUnit() ... call PauseUnit(attacked_unit, false) // That unpauses the attacked unit |
| 12-28-2003, 01:53 PM | #9 |
i know it works.... ive used such trigger in one of my maps... and if u are afraid of there will be more units u can just make it an array... |
| 12-28-2003, 02:32 PM | #10 |
For a freeze tower there will always be more than one and the array solution is not as simple as it may sound, especially preventing it from becoming inefficient or having an ever increasing array size. Local variables is by far the easiest and most efficient solution. |
