HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger Help

05-04-2006, 09:43 AM#1
Karawasa
Is this trigger MUI and also flawless?

Trigger:
Ensnare
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Net
Collapse Actions
Set Ensnare_Unit[(Player number of (Owner of (Triggering unit)))] = (Target unit of ability being cast)
Unit - Add Ensnare Prevention to Ensnare_Unit[(Player number of (Owner of (Triggering unit)))]
Wait 5.00 game-time seconds
Unit - Remove Ensnare Prevention from Ensnare_Unit[(Player number of (Owner of (Triggering unit)))]
05-04-2006, 10:02 AM#2
PipeDream
If this is for Tropical tag, where you can have only one ensnarable unit per hero (?), then yes, it should work fine.
Why not use the GUI local variable hack instead of an array?

I am a little afraid of all the spell events other than starts the effect of an ability, but if it works it works.
05-04-2006, 10:24 AM#3
Blade.dk
A unit begins casting can be abused, as it makes the trigger fire before cooldown starts and mana is taken, so fast players can cheat. Use the "A unit starts the effect of an ability" event.
05-04-2006, 11:03 AM#4
Karawasa
My concern with this spell comes from another trigger I had awhile back.

I had a trigger similar to this one that would add a sight range decreasing ability and remove it 5 second later. Problem was, it failed to remove it sometimes.

So, I need to make sure that won't happen with this one. The difference is that I am using player number owner of triggering unit rather then player number owner of target of ability being cast.

And yes, each Naga can only net once every 60 second so I think that won't be a problem..
05-04-2006, 07:26 PM#5
emjlr3
not MUI, and in the light of using JASS, not flawless, however will it get teh job done, prolly
05-05-2006, 02:38 AM#6
Karawasa
Why do I get the feeling the array size should be 4 instead of 1?
05-05-2006, 02:55 AM#7
Vuen
Quote:
Originally Posted by Karawasa
Why do I get the feeling the array size should be 4 instead of 1?

Array size does not matter at all. All arrays are 8192 in size.

All array size does is, say you have a timer array, setting the size to 4 will automatically create 4 timers for you. That's it.


To MUI it, do what Pipedream says for localizing the variable (and also use "starts the effect"). Delete your Ensnare_Unit variable, and instead make a unit variable called TEMP_Unit. Then do this:

Trigger:
Ensnare
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Net
Collapse Actions
Custom Script: local unit udg_TEMP_Unit
Set TEMP_Unit = (Target unit of ability being cast)
Unit - Add Ensnare Prevention to TEMP_Unit
Wait 5.00 game-time seconds
Unit - Remove Ensnare Prevention from TEMP_Unit
Set TEMP_Unit = No unit
05-05-2006, 03:00 AM#8
Immoralis
try that
cept instead of A000 u do ur ensare prevention thingy
Trigger:
Ensnare
Collapse Events
Unit - A unit starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Net
Collapse Actions
Custom Script: local unit u
Custom Script: UnitAddAbility(u,'A000')
Wait 5.00 game-time seconds
Custrom Script: UnitRemoveAbility(u,'A000')
05-05-2006, 03:01 AM#9
Vuen
You can't do that, Immoralis, because 'u' doesn't show up in the variables list. You're also leaking the reference.
05-05-2006, 03:03 AM#10
Immoralis
I figured that out and edited it right as you were replying, anyway how does it leak
05-05-2006, 03:05 AM#11
Vuen
You need to set all handle derived types to null before returning. That means set u = null.

There isn't much point in turning everything to custom script; you may as well just JASS it.
05-05-2006, 03:30 AM#12
PipeDream
It is only necessary to change the value of handle derived types if you intend to deallocate the object at some point. Since this is a permanent hero, it's not strictly necessary, but it would certainly be good style.
05-05-2006, 03:32 AM#13
Vuen
Quote:
Originally Posted by PipeDream
It is only necessary to change the value of handle derived types if you intend to deallocate the object at some point. Since this is a permanent hero, it's not strictly necessary, but it would certainly be good style.

Well, it's actually cast on a unit, so if that unit were to die sometime after being webbed, and then decay several minutes later, THEN it would leak. Heh.

[edit] Oh, right, it's for a tag map. Nevermind then.