JASS - Creating a Passive Ability in Jass

Viikuna

No Marlo no game.
Reaction score
265
Sry, I wasnt actually complaining. I just tought there might have been something I dont know, like some reason not to use that BJ.

Thx for fast answer.
 

Romek

Super Moderator
Reaction score
963
Sry, I wasnt actually complaining. I just tought there might have been something I dont know, like some reason not to use that BJ.

Thx for fast answer.
Oh. Sorry for accusing you then :p

I'm subscribed to this thread (Instant Email notification). So I can pretty much reply instantly :D
 

Romek

Super Moderator
Reaction score
963
I think there is a way to check if the damage was done by a spell.
...By Using orb effects or other massive systems which require you to change nearly everything in your map.
 

Viikuna

No Marlo no game.
Reaction score
265
Ye, that is the reason why it is tricky to make some damage/attack detection system, which would work in all maps.

For your own map, it is easy to just do all spell damage trought some dummy units, so only damage your unit deals, is hes / shes normal attack.

EDIT. ofc that means you need to trigger all damage sources. Abilities like cleave would ruin it, I guess.
 

Romek

Super Moderator
Reaction score
963
Ye, that is the reason why it is tricky to make some damage/attack detection system, which would work in all maps.

For your own map, it is easy to just do all spell damage trought some dummy units, so only damage your unit deals, is hes / shes normal attack.

EDIT. ofc that means you need to trigger all damage sources. Abilities like cleave would ruin it, I guess.
Exactly.

It is possible. Making all ability damage triggered is an easy option. But not for a tutorial. I'm not exactly going to write
"For this spell to work, you need to get rid of all your non-triggered spells and trigger them. And also use a 10,000 line system."
 

emootootoo

Top Banana
Reaction score
51
Exactly.

It is possible. Making all ability damage triggered is an easy option. But not for a tutorial. I'm not exactly going to write
"For this spell to work, you need to get rid of all your non-triggered spells and trigger them. And also use a 10,000 line system."

A basic damage detection system is about 20 lines all up, and only requires you to code orb effects, which is the point of a damage detection system anyway, to code passive attacks.

I see where you are coming from though, it could make the tutorial a lot more confusing for someone.
 

Romek

Super Moderator
Reaction score
963
A basic damage detection system is about 20 lines all up, and only requires you to code orb effects, which is the point of a damage detection system anyway, to code passive attacks.

I see where you are coming from though, it could make the tutorial a lot more confusing for someone.
Wow.. Someone understands me :p

But yeah. I just want this to be about the system. It's just making a basic spell and making it follow the JESP standard. Not some insane damage detection and crap just to stop it possessing when the missile is fired.
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
I mostly though since this is a "Creating a Passive Ability in Jass"-thread it should involve something else than a "Unit is Attacked" event feature (which frankly isn't used a lot anyway). The tutorial itself is well explained and should teach one or another something about coding in JASS.
 

Romek

Super Moderator
Reaction score
963
I mostly though since this is a "Creating a Passive Ability in Jass"-thread it should involve something else than a "Unit is Attacked" event feature (which frankly isn't used a lot anyway). The tutorial itself is well explained and should teach one or another something about coding in JASS.
Well.. Maybe.

This is what most passive abilities are anyway.

I might make an Auras tutorial too though.
...And maybe a 'normal spells' one.

Then I'd have a collection of "How to make a Spell" tutorials :D
 
T

Trikk

Guest
I'm reading this tutorial and it's really great, I like how you don't just paste all the code at once but instead leave it up to the reader to figure out what should be done before you show how you did it.

One question: if IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) returns true then the unit is a hero, so wouldn't the trigger only work against heroes instead of never against heroes?

Also, if it procs on 2 or lower on a 0-100 roll, that's 2.97% chance and not 2%.

Just my thoughts so far, I'll go back to reading it now.
 

Flare

Stops copies me!
Reaction score
662
One question: if IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) returns true then the unit is a hero, so wouldn't the trigger only work against heroes instead of never against heroes?
Ye, from the looks of it, it'd only work vs. heroes (and, AFAIK, IsUnitType must be compared against true/false, and not left on it's own, to prevent bugs)

Also, if it procs on 2 or lower on a 0-100 roll, that's 2.97% chance and not 2%.
:p .97% probably won't make much of a difference anyway =D
 
T

Trikk

Guest
How do you know when it is the attacker that is the triggering unit and when it's the attacked?
 

saw792

Is known to say things. That is all.
Reaction score
280
The triggering unit is defined as the unit being attacked. GetAttacker() returns the attacking unit.
 
T

Trikk

Guest
Alright I think I understand now. Just need to change the conditions a bit.

Will this work if I put the ability on neutral hostiles as well or do I have to make a seperate trigger/ability for them? Seems the unit has to belong to a player for it to register the event.
 

Romek

Super Moderator
Reaction score
963
I'm reading this tutorial and it's really great, I like how you don't just paste all the code at once but instead leave it up to the reader to figure out what should be done before you show how you did it.

One question: if IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) returns true then the unit is a hero, so wouldn't the trigger only work against heroes instead of never against heroes?

Also, if it procs on 2 or lower on a 0-100 roll, that's 2.97% chance and not 2%.

Just my thoughts so far, I'll go back to reading it now.

Thanks for the feedback.
Fixed the errors.

Ye, from the looks of it, it'd only work vs. heroes (and, AFAIK, IsUnitType must be compared against true/false, and not left on it's own, to prevent bugs)


:p .97% probably won't make much of a difference anyway =D

Thanks as well.
Fixed :p

That uses the attacker (and it's got a syntax error too, since there's no () after GetTriggerUnit :p)

Fixed the syntax, and the error.

Alright I think I understand now. Just need to change the conditions a bit.

Will this work if I put the ability on neutral hostiles as well or do I have to make a seperate trigger/ability for them? Seems the unit has to belong to a player for it to register the event.

Change the exitwhen in the Init function.
At the moment, it exits when i is >11. This means it will work from players 1-12.

Make it exitwhen i > 15 so that it works on all players.

Thanks for the feedback everyone.
 

Flare

Stops copies me!
Reaction score
662
Hmmm... the useful-ness of this tutorial kinda eludes me, mainly due to it's specific nature. Pretty much anyone would have a basic understanding of how to trigger an On Attack passive (i.e. the event primarily, which is the main thing), and if someone wanted to make something like additional damage based on an attribute (or something, who knows), this tutorial is of little use, other than
As well as this, you'll learn how to make spells easily configurable, use scopes, and other Jass skills.
but looking at other spells (well, that's how I did it, not sure about everyone else) caters for configuration, and (m)any (v)JASS tutorial would cover the rest

People probably have/will find this useful, but I can't see how alot of this would either go without saying, or has already been covered by others, on numerous occasions
 

Romek

Super Moderator
Reaction score
963
Hmmm... the useful-ness of this tutorial kinda eludes me, mainly due to it's specific nature. Pretty much anyone would have a basic understanding of how to trigger an On Attack passive (i.e. the event primarily, which is the main thing), and if someone wanted to make something like additional damage based on an attribute (or something, who knows), this tutorial is of little use, other than

It gives the reader a general idea about spells and passive abilities.
This just sets the basics. Things like adding damage based on attribute are easy enough, and the reader could find out how to do it themselves (or post in the WEHZ)

People probably have/will find this useful, but I can't see how alot of this would either go without saying, or has already been covered by others, on numerous occasions

Maybe so. But then again, look at how many Jass tutorials have been made. All explaining the same thing, in a different way. Everything that is exclusive to this tutorial teaches people new things. And everything that has been mentioned before could explain things in different ways. :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top