| 08-14-2008, 03:01 AM | #1 |
This is a spell i made for my map. Problem: It work for most of the time but, sometimes the swaying and enable user control don't work, so when it is cast on the targeted person, it will forever be shaking his screen and its control disabled. I cant seem to find the problem myself, anyone can help me with this? Heres a Replay i saved frm today while testing my map with online players. You might need the Map to view it. If you do check the replay, keep an eye on teal, he was the 2nd victim, yellow was 1st but it went fine. (Early game) Trigger: Trigger: Diszzy Start
![]() Actions
![]() ![]() Set Dizzy_Victim = (Target unit of ability being cast)
![]() ![]() Camera - Shake the camera for (Owner of Dizzy_Victim) with magnitude 300.00
![]() ![]() Cinematic - Disable user control for (Player group((Owner of Dizzy_Victim)))
![]() ![]() Trigger - Turn on Dizzy Effect <gen>Trigger: Trigger: Dizzy Dies
Trigger: Dizzy End
|
| 08-14-2008, 11:35 AM | #2 |
The reason it won't work is because there is only 1 Dizzy_Victim unit, so if it is cast again on another unit before the timer expires, the previous unit will be dizzy forever. There's a jass way to solve this which I don't know, and then there's a (slightly less efficient) GUI way to solve it: -Make a dummy unit with locust and no model, shadow and collision. -Make a new targeted spell with a casting time of 1 for level 1, 2 for level 2, etc. No mana cost, allies targetable, no damage, .01 duration, etc. Add this spell to the dummy unit you created. -Delete / disable all your old triggers for this spell. -Make a new trigger: Event - ability is cast, condition - spell is dizziness, actions: make (dummy unit) at position of targeted unit set level of (dummy spell) for (dummy unit) to level of ability being cast order last created unit to cast (dummy spell) on (target of ability being cast) camera - sway camera for owner of target of ability disable user control, etc add a 1 + (level of ability being cast) expiration timer to last created unit New trigger: event - spell is cast condition - spell is equal to (dummy spell) remove (triggering unit) enable control, stop swaying for owner of target of ability being cast. EDIT: for the running around randomly, add targeted units to a unit group called DizzyUnits and remove them when the dummy unit dies. then for the dizziness, just make a trigger that picks every unit in DizzyUnits and orders them to run around randomly. You might also want to remove those memory leaks. Like this: set TempPoint = position of unit set TempPoint = TempPoint offset by 50 towards random angle order unit to move to TempPoint custom script: call RemoveLocation(udg_TempPoint) |
| 08-14-2008, 02:36 PM | #3 |
Wow great help! Really solved my problem! and now it runs smooth! A few questions, 1. Do i always have to remove variable points? What does the leak do? 2. Which is better for custom spells using at event? (A unit starts an effect of an ability OR A unit begins casting an ability) Thanks again! added rep to u ![]() |
| 08-14-2008, 07:02 PM | #4 | ||
Quote:
You don't have to, but you should. When you leak, you're basically adding data to memory, and then forgetting to remove it. The GUI does this all the time. Eventually, you'll run out of memory. Quote:
They are both useful. "Starts the effect of an ability" is used when you want something to take effect at the moment a spell is cast. "Starts casting an ability" is used when you want something to take effect the moment the casting animation starts (or would start, if there's no animation). All units have a Cast Point and Cast Backswing: Unit ordered to cast spell ---- Event: Unit given an order Unit Starts casting spell ---- Event: Starts casting an ability Unit reaches its Cast Point ---- Event: Starts the effect of an ability Unit finishes its Cast Backswing --- Event: Unit finishes casting an ability |
| 08-15-2008, 12:06 AM | #5 |
Players with amazing micro would be able to trigger off the spell without manacost and cooldown, so rather use Starts Effect of Ability. For the sake of world peace, remove all memory leaks. Most common memory leaks are: locations (points) - call RemoveLocation(udg_loc) groups (unit grounds) - call DestroyGroup(udg_group) forces (player groups) - call DestroyForce(udg_force) udg = user defined global, basically all variables in GUI. If you have further questions about leaks and advanced code, consult the Tutorials section. A wealth of knowledge, there is. Thanks for rep :) |
| 08-15-2008, 05:55 AM | #6 |
Ah.. so i get the problem now! Gonna fix all the leaks with points. Thanks for the help guys! All those were very very helpful! |
