wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Code Resources > Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 05-08-2009, 01:40 PM   #16
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,186

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Updated. The script now doesn't create a location on widget targetting spell casts.

I haven't quite decided on the user syntax yet, the current script includes two versions, GetAbilityId() and GetSpell.AbilityId(), another possibility would be SpellEvent.AbilityId. I'd like to decide on one of them and delete the rest before this gets approved. Opinions?
__________________
Anitarf is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 05-08-2009, 01:58 PM   #17
grim001
requires vJass
 
grim001's Avatar


Code Moderator
 
Join Date: Nov 2006
Posts: 1,540

Submissions (10)

grim001 is just really nice (277)grim001 is just really nice (277)

Send a message via AIM to grim001
Default

Last one.
grim001 is offline   Reply With Quote
Old 05-08-2009, 02:15 PM   #18
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Yeah, scrap the public prefixes. I'd never use this just because of that.
__________________
Rising_Dusk is offline   Reply With Quote
Old 05-11-2009, 10:58 AM   #19
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,186

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
Originally Posted by Litany
GetAbilityId, GetAbilityTargetUnit, IsAbilityFinished, etc. Blizzard is inconsistent with Spell and SpellAbility, but that doesn't mean you have to be.
Inconsistent? It seems to me that "Ability" is used when dealing with any ability, including passives, while "Spell" is used when dealing with spell events. Hence UnitAddAbility (can add any ability, not just spells), GetSpellTargetUnit (only works on spell cast) and GetSpellAbilityId (gets a generic ability id on a spell event). That seems perfectly consistent to me.

Quote:
Consistent use of Ability in the function names also removes the need for the public prefixes, which are incredibly ugly.
Quote:
Originally Posted by Rising_Dusk
Yeah, scrap the public prefixes. I'd never use this just because of that.
Okay.

So, I've decided to make the UI work either like this: local unit c = SpellEvent.CastingUnit or like this: public function interface Response takes integer abilityId, unit castingUnit, unit targetUnit, destructable targetDest, item targetItem, real targetX, real targetY returns nothing I don't think anyone will like the latter, so I'll just write the former.
__________________
Anitarf is offline   Reply With Quote
Old 05-11-2009, 11:07 AM   #20
wraithseeker
User
 
Join Date: Feb 2009
Posts: 406

wraithseeker is on a distinguished road (17)

Default

Doesn't this do the job although you guys banned that user.
wraithseeker is offline   Reply With Quote
Old 05-11-2009, 12:56 PM   #21
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,186

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
Originally Posted by wraithseeker
Doesn't this do the job
No.

Well, based on my testing there is no way for a unit to start casting a new spell without first stopping the casting of the previous spell, so the safety check in the EndCast function is not needed and will be removed in the next version.

Edit:
Quote:
Originally Posted by Litany
I find combining spell and ability in general to be inconsistent. They're treated as virtual synonyms in WC3, so the distinction here makes no sense. And of course, they actually aren't synonyms, which makes it even worse. Ensnare is not a spell, so why should the word "spell" figure in the event responses?
It may not be consistent with our understanding of the word (which would mean specifically magical abilities) but the word's use within WC3 natives is internally consistant as it is used to refer to activated abilities, as such it is also not synonymous to the word "Ability" which can refer to any ability, not just an activated one.

Edit 2: Well, I just realised I can't make static method operators so I guess I'll need to come up with a different UI.
__________________

Last edited by Anitarf : 05-11-2009 at 01:44 PM.
Anitarf is offline   Reply With Quote
Old 05-14-2009, 02:30 PM   #22
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,186

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Updated, I managed to get the syntax I wanted although it required some tweaking to maintain proper encapsulation. The user could in theory still call .destroy on the struct since I can't make that method private but the system can survive that, the user would eventually get an error message about trying to destroy a null struct.

I realize now I forgot to add the method operator for TargetLoc, gotta run now so I'll fix that later.
__________________
Anitarf is offline   Reply With Quote
Old 05-16-2009, 12:06 AM   #23
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,186

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
Originally Posted by Anitarf
I realize now I forgot to add the method operator for TargetLoc, gotta run now so I'll fix that later.
Okay, I fixed this now, also the usage example was still using the old syntax in one place, fixed that too. This should be it, I think.
__________________
Anitarf is offline   Reply With Quote
Old 05-16-2009, 05:38 AM   #24
Tyrande_ma3x
User
 
Tyrande_ma3x's Avatar
 
Join Date: Feb 2009
Posts: 185

Submissions (1)

Tyrande_ma3x is on a distinguished road (12)

Default

> SpellEvent.CastingUnit
Is there any way this could become TriggerUnit? I think most people don't usually use GetCastingUnit() and it's going to be a bit hard with all those switches between names.
Tyrande_ma3x is offline   Reply With Quote
Old 05-18-2009, 12:16 PM   #25
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,186

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Casting unit is more descriptive, though. And what switches between names, all event responses are copies of natives with "GetSpell" replaced with "SpellEvent." (minus those responses that are new), so there's only one switch.
__________________
Anitarf is offline   Reply With Quote
Old 05-18-2009, 03:35 PM   #26
rain9441
User
 
Join Date: Jan 2007
Posts: 195

rain9441 will become famous soon enough (61)rain9441 will become famous soon enough (61)rain9441 will become famous soon enough (61)

Default

I use pretty much the same concept for registering for events for abilities. Just want to quickly add that you also have access to the OrderID of the casting unit at some stages (not all) which is very handy in some circumstances.

I dunno, it allows me to say when a unit casts a spell and some conditions exist, create a dummy unit, add the ability to the dummy unit, set the level of the ability to that of the casting unit, and order the dummy unit to (orderid) the target again, or the x/y coords again, or the item again, or "immediately", or at a random unit within 300 of target, etc, etc, etc.

Ability Level may also be useful, as the level when casted may not be the level 1 second later.

Also, any reason the EVENT_PLAYER_UNIT_SPELL_CHANNEL event is unsupported?

Thirdly, why set a global variable to the current spell event when you can pass the spell event to the Response function?
__________________
My latest project -- Still in development: Experience TD
rain9441 is offline   Reply With Quote
Old 05-18-2009, 03:59 PM   #27
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,186

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Spell level and orderid are useful information, I'll look into including them in the event responses. The level itself might not be as useful since if it's a channeling spell (which is the only case I can think of where you could increase the level before the spell finishes) you will likely create a struct when the channeling starts anyway and you can store the level there, but since it's the kind of event response function that will likely get called anyway there's no loss of performance if it's included.

In my experience, EVENT_PLAYER_UNIT_SPELL_CHANNEL doesn't do anything special, it just seems to run after the cast event for all spells. If there is some significant difference, I might include it.

I use a global variable instead of passing it as a parameter because it simplifies the function interface somewhat ("takes nothing returns nothing" is easier to remember) and you don't have to pass the struct to any functions you call.
__________________
Anitarf is offline   Reply With Quote
Old 05-21-2009, 11:51 PM   #28
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

channel IS useless. Effect is better there.

Quote:
I use a global variable instead of passing it as a parameter because it simplifies the function interface somewhat ("takes nothing returns nothing" is easier to remember) and you don't have to pass the struct to any functions you call.
ah the sound of losing abstraction over worthless code length saving.

but well, it has been in the submit forum for enough time approved...
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 05-24-2009, 07:35 PM   #29
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,186

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Alright, I fixed a minor bug that could cause a unit-target spell to keep the TargetDestructable value from a previously cast destructable-target spell.

Also, I did a small tweak to facilitate spell transmutation, check out the second usage example for more information.
__________________
Anitarf is offline   Reply With Quote
Old 05-24-2009, 09:05 PM   #30
Viikuna-
User
 
Viikuna-'s Avatar
 
Join Date: Feb 2009
Posts: 203

Viikuna- will become famous soon enough (44)Viikuna- will become famous soon enough (44)

Default

Doesnt _CHANNEL trigger before casting time? I have used it to change units casting animation in some cases.

( Dont know if _CAST does the same thing, but I was under impression that _CHANNEL triggers before _CAST )
__________________
No Marlo, no game.
Viikuna- is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 12:43 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2018, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services