HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

"Chance to do..." Spells? - Other stuff

02-20-2008, 10:32 AM#1
ThonGod
How would i make an ability with a chance to do something?

Like a 20% chance to do a shockwave or something on hit and/or on attack?


-----------------

How would i make spell damage have a base damage and bonus damage based on a particular stat?

Such as a shockwave with a base damage of 200 with a bonus damage of one-tenth the hero's strength stat ?

-----------------

And i have no idea of how to use JASS at all ive only started converting GUI to JASS and it looks pretty crazy and long so if you give me JASS things i wont know how to edit it etc



Total Newbness ftl

- ThonGod -
02-21-2008, 02:10 PM#2
Vexorian
1. orb of lightning.
2. Make the spell yourself.
3. Learn it.
02-21-2008, 03:17 PM#3
Rising_Dusk
Refer here for jass tutorials. Just stop being overwhelmed and sit down and work through it, it's really not that tough, just takes patience and effort.

To achieve stat-based effects, you need to trigger the entire spell.
02-22-2008, 06:20 AM#4
Gorman
Assuming u know how to trigger then it should be pretty easy, if you dont go look it up (start with GUI is suggested)
02-23-2008, 12:06 AM#5
Malf
Try to spend some time to practice JASS, like I did way back when I refused to learn it. I just stopped working on my map and forced myself to code some ridiculous things that I wanted to have. Took me a couple of days or so, then read some tutorials.

Adapting yourself to the JASS environment before reading tutorials is good, atleast you won't get overwhelmed and discouraged when you read the tuts and say "Wtf is a syntax?"
02-23-2008, 05:09 AM#6
darkwulfv
1. For the first spell, Orb of lightning is a good option if you aren't using orbs for other things. A method that's just as effective but very debatable (and easy to break, if you're smart and fast) is to trigger it. When a unit attacks, check that the unit is the kind you want and/or has the ability you want. Get a random integer from 1-100, and if it's less than or equal to 20, make a dummy cast chain lightning.

As I said, Orb of Lightning will cover this just fine if you aren't already using orbs.

2. It has to be triggered, sorry. It may be hard for a shockwave spell, since (unless I'm wrong) it doesn't leave a buff. However, for something like a Warstomp spell or something, all you would do is grab the hero's strength, divide it by 10, and then inflict that as damage.

3. We have a lot of tutorials here. I hate to advertise, but the ones by me, Wyrmlord, and Moyack are really good for beginners and cover a lot of ground. I suggest you check them out. I believe the thread's name is "Collected JASS Lessons", or something to that affect.

Here's a few tips that helped me learn JASS.
  • I got JASScraft. From there, I would convert GUI to JASS, bring it over to JASScraft, and clean it up. JASScraft's function/Blizzard global/etc. list is unmatched, and it's still the only thing with an instant syntax checker (JassShopPro has one, but they're by the same person anyways). The problem with JASScraft is if there's functions or globals from another trigger, it doesn't recognize them (using the syntax checker.) unless you put it in there as well. It also is not updated to the vJASS stuff, but I doubt you'll have to worry about that since you're just learning JASS.
  • I asked questions. If a piece of code is really stumping you, post it here. I'm sure someone would be more than happy to help.
  • I tinkered around with it myself. And I started easy. Don't try to do huge complex systems and spells. Go slow. Start off coding simple spells, such as dummy-cast spells. (Unit casts a spell and the trigger casts the effects). As you learn the syntax and smaller things, move up a little. Don't feel rushed and stressed, and if things don't work don't get pissed. Just try again, and don't be afraid to ask questions.

Good luck learning JASS, it's definitely worth it.
02-24-2008, 09:34 PM#7
Hydrolisk
I have three solutions that I can think of.

Orb of Lightning/Slow: Easy and straightforward, but requires the unit to actually be ordered to attack (or so I've heard).

Trigger it with "On Attack:" I normally use it, although it is considered slow (as in, if someone timed every attack properly, they'd be able to multiply their chances to ridiculous amounts). This is easy to do, and most people won't probably won't try to take advantage of it unless they're just screwing around with no purpose.

Trigger it with Damage detection: Simply hard to utilize if you're a beginner, and is slightly tedious to work with. I personally call this failsafe, although I've never actually read about any problems with this. Just hard and tedious.

As for learning JASS: Just try to do it and persist. I know people say this a lot, but the first hurdle is the river in Egypt called "Denial." You have to bring yourself up to doing it and steel your will. (This goes for just about every programming language.)
03-01-2008, 09:25 AM#8
ThonGod
Lol thanks you guys ;D

I got the chance on attack with some random triggers that i sonehow found out but i dont think its the best solution for it.

Trigger:
Shocking Claw
Collapse Events
Unit - A unit Is attacked
Collapse Conditions
((Attacking unit) has an item of type Shocking Claw) Equal to True
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Random integer number between 1 and 4) Less than or equal to 1
Collapse Then - Actions
Unit - Create 1 Chain Dummy for (Owner of (Attacking unit)) at (Position of (Attacking unit)) facing (Position of (Triggering unit))
Unit - Add Chain Lightning to (Last created unit)
Unit - Hide (Last created unit)
Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning (Attacked unit)
Unit Group - Add (Last created unit) to REMOVEDUMMY
Collapse Else - Actions
Do nothing

And a trigger to remove dummy units

Trigger:
Remove Dummies
Collapse Events
Time - Every 30.00 seconds of game time
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in REMOVEDUMMY and do (Actions)
Collapse Loop - Actions
Unit - Unhide (Picked unit)
Unit - Remove (Picked unit) from the game

----------

And i still dont really understand how to do the base damage + extra damage based on a stat.

Can anyone give a sample trigger please?

thanks

- ThonGod
03-02-2008, 09:37 PM#9
A Dreamer
well i have some small corrections to your code that might save you some space and time.. Instead of hiding the dummy units just give them the locust ability from the object editor. That will save you from an extra action. Also in the object editor when you make the dummy unit in the model feild just write none.mdl that way the unit won't have any model so technically it is ivisible. Note: if you try to place a dummy unit on the map from the editor then you will see a box with black adn green squares but during the game you won't be able to see anything.. And final instead of packing all the dummy units in a group and then destroy all of them just give them 1 sec expiration time (or less just be sure you give enough time to the dummy to cast the spell) and it will be destroyed allone without using an extra trigger for this + it saves you from having 1 extra unit group wich holds some memory.


Now as for the dmg part i can't figure out myself a way to make the spell do the right amount. I can only think of a dummy hiting the targets with the amount you want.
03-03-2008, 04:45 AM#10
ThonGod
Thanks Dreamer =]

So then this should be about right ?

Trigger:
Shocking Claw
Collapse Events
Unit - A unit Is attacked
Collapse Conditions
((Attacking unit) has an item of type Shocking Claw) Equal to True
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Random integer number between 1 and 4) Less than or equal to 1
Collapse Then - Actions
Unit - Create 1 Chain Dummy for (Owner of (Attacking unit)) at (Position of (Attacking unit)) facing (Position of (Triggering unit))
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
Unit - Add Chain Lightning to (Last created unit)
Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning (Attacked unit)
Collapse Else - Actions
Do nothing

And the dummy's model file is none.mdl

Is the locust ability necessary if it has no model file ?

--------------

And what would this trigger do ?

Trigger:
Untitled Trigger 002
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
Collapse And - All (Conditions) are true
Collapse Conditions
(Ability being cast) Equal to Shockwave
(Unit-type of (Casting unit)) Equal to Tauren Chieftain
Collapse Actions
Set SPELLDMG = (200.00 + ((Real((Strength of (Casting unit) (Include bonuses)))) / 10.00))
Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing SPELLDMG damage of attack type Spells and damage type Normal

Would it be anything close to dealing base damage bonus according to a stat?

Thanks

- ThonGod
03-03-2008, 10:49 AM#11
slapshot136
a few things..
1. "unit is attacked" is before the projectile is actually launched, so you can spam stop/right click/stop/right click and make the trigger fire like that, use "unit takes damage" instead to avoid this
2. locust makes it unelectable and invulnerable, so yes it's still kinda needed unless you make it invulnerable some other way
3. add an expiration timer to your dummy so that it goes away after like 1 second or so.. and dont bother adding it to a unit group and then clearing it periodically
4. the second trigger uses the wrong event again, so the same problem exists, use "starts the effect of" instead
5. the bonus damage is applied only to the target if there is one, meaning only the unit you click on, id recommend making a dummy with the same ability and like 100 levels of it, each level dealing say 10 damage and then set the level of it + order the dummy to cast it in the same spot, an alternative would be to pick every unit within range of the shockwave every second and then damage them and add them to a group, and then clear the group once the shockwave is done in order to prevent a unit from being damaged more then once by this
6. this dosent matter, but fyi it automatically does "and all conditions are true" if you put more then 1 condition under conditions
7. your trigger has a point leak where you create your dummy, im sure theres a tutorial about leaks somewhere here, but basically you need to set it the location in a variable, use it, and then remove the location with a line of jass
03-03-2008, 05:02 PM#12
A Dreamer
Quote:
Originally Posted by ThonGod
Thanks Dreamer =]

So then this should be about right ?

Trigger:
Shocking Claw
Collapse Events
Unit - A unit Is attacked
Collapse Conditions
((Attacking unit) has an item of type Shocking Claw) Equal to True
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Random integer number between 1 and 4) Less than or equal to 1
Collapse Then - Actions
Unit - Create 1 Chain Dummy for (Owner of (Attacking unit)) at (Position of (Attacking unit)) facing (Position of (Triggering unit))
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
Unit - Add Chain Lightning to (Last created unit)
Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning (Attacked unit)
Collapse Else - Actions
Do nothing

And the dummy's model file is none.mdl

Is the locust ability necessary if it has no model file ?

--------------

And what would this trigger do ?

Trigger:
Untitled Trigger 002
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
Collapse And - All (Conditions) are true
Collapse Conditions
(Ability being cast) Equal to Shockwave
(Unit-type of (Casting unit)) Equal to Tauren Chieftain
Collapse Actions
Set SPELLDMG = (200.00 + ((Real((Strength of (Casting unit) (Include bonuses)))) / 10.00))
Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing SPELLDMG damage of attack type Spells and damage type Normal

Would it be anything close to dealing base damage bonus according to a stat?

Thanks

- ThonGod


Well yeah you've done the dummy part right. Now because the spell your dummy casts is a bit differente cause it has multiple targets i don't know if with the cause unit to damge target action works for all the targets of the chain lightning (if it does you have also to order the dummy to dmg the targets cause the castin unit which is the hero will only have the first target). And also you have to modify chain lighting too or make another dummy ability that only has the effect and does not dmg. Otherwise the spell will do the dmg you want + the amount of dmg that chain lightning does. But try it. If it doesn't work then you'll probably have to work with a group unit for the targets of the ability.

Now for the locust ability thing i think it is important cause you don't want this unti to be visible both in the map and in the minimap and also even if the unit has no model (and technicaly is invisible) it still can be selected by a player. If the player decides to drag a box on the area where the dummy is it will appear on his selection box.. Still it won't have a model but it will be a green circle and the user will have full control of it.. So locust is important.

Last i noticed in the code that you create a unit called "chain dummy". I might be wrong but i that gives me the impression that you use different kind of dummies for each ability. You don't have to do that. Just create from the object editor 1 kind of dummy unit call it simple dummy or anything you want. Don't give it any ability except the locust. When a unit casts a triggered spell that requires dummies create this dummy unit and give it the ability you want to order it to cast with the trigger. That saves you from a lot of time in the editor (since you don't have to create a new kind of dummy ability for each custom triggered spell you make).

Hope this helps you a bit. For the last part i'm not sure if i was clear but my english are not good so i tried my best. If you still have questions... ask!!!! :D
03-06-2008, 04:37 AM#13
ThonGod
Quote:
a few things..
1. "unit is attacked" is before the projectile is actually launched, so you can spam stop/right click/stop/right click and make the trigger fire like that, use "unit takes damage" instead to avoid this
2. locust makes it unelectable and invulnerable, so yes it's still kinda needed unless you make it invulnerable some other way
3. add an expiration timer to your dummy so that it goes away after like 1 second or so.. and dont bother adding it to a unit group and then clearing it periodically
4. the second trigger uses the wrong event again, so the same problem exists, use "starts the effect of" instead
5. the bonus damage is applied only to the target if there is one, meaning only the unit you click on, id recommend making a dummy with the same ability and like 100 levels of it, each level dealing say 10 damage and then set the level of it + order the dummy to cast it in the same spot, an alternative would be to pick every unit within range of the shockwave every second and then damage them and add them to a group, and then clear the group once the shockwave is done in order to prevent a unit from being damaged more then once by this
6. this dosent matter, but fyi it automatically does "and all conditions are true" if you put more then 1 condition under conditions
7. your trigger has a point leak where you create your dummy, im sure theres a tutorial about leaks somewhere here, but basically you need to set it the location in a variable, use it, and then remove the location with a line of jass

1. I can only find that is Unit - Specific Unit Event. But i only need it for enemies. ( but i dont really know how to do that so its all )

2. Thanks =] It's been added and i will test it soon.

3. I think ive already added the expiration timer:
Trigger:
Then - Actions
Unit - Create 1 Chain Dummy for (Owner of (Attacking unit)) at (Position of (Attacking unit)) facing (Position of (Triggering unit))
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)

4. Thanks again :) its been changed now

5. What if i wanted it to do pretty much exact damage before reductions ? Im not really good at it lol ><

6. It is now removed lol

7. Ill check the leak soon and i have no idea of JASS so i cant really do it.

-------------------------------

Quote:
Well yeah you've done the dummy part right. Now because the spell your dummy casts is a bit differente cause it has multiple targets i don't know if with the cause unit to damge target action works for all the targets of the chain lightning (if it does you have also to order the dummy to dmg the targets cause the castin unit which is the hero will only have the first target). And also you have to modify chain lighting too or make another dummy ability that only has the effect and does not dmg. Otherwise the spell will do the dmg you want + the amount of dmg that chain lightning does. But try it. If it doesn't work then you'll probably have to work with a group unit for the targets of the ability.

From my testing it seems to work fine except that the dummies tend to be made next to the hero.

Quote:
Now for the locust ability thing i think it is important cause you don't want this unti to be visible both in the map and in the minimap and also even if the unit has no model (and technicaly is invisible) it still can be selected by a player. If the player decides to drag a box on the area where the dummy is it will appear on his selection box.. Still it won't have a model but it will be a green circle and the user will have full control of it.. So locust is important.

Thanks aswell it has been added and will be tested =]

Quote:
Last i noticed in the code that you create a unit called "chain dummy". I might be wrong but i that gives me the impression that you use different kind of dummies for each ability. You don't have to do that. Just create from the object editor 1 kind of dummy unit call it simple dummy or anything you want. Don't give it any ability except the locust. When a unit casts a triggered spell that requires dummies create this dummy unit and give it the ability you want to order it to cast with the trigger. That saves you from a lot of time in the editor (since you don't have to create a new kind of dummy ability for each custom triggered spell you make).

Thanks and yes i do have one dummy for each spell. I have removed them now i use one. =] ( i kinda forgot about it )

-------------------------------

So then:
Trigger:
Actions
Set SPELLDMG = (200.00 + ((Real((Strength of (Casting unit) (Include bonuses)))) / 10.00))
Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing SPELLDMG damage of attack type Spells and damage type Normal
Will only deal the correct damage if its a single target spell ?

-------------------------------

And wat is with the damage types? i dont really understand it

(like what's enhanced, disease, sonic etc etc types?)

-------------------------------

Thanks

-= ThonGod =-