Spell Fortitude

wraithseeker

Tired.
Reaction score
122
I have made a spell after some time and is happy to submit it to Thehelper.


Import Difficulty: Medium
GUI/JASS: VJASS
MUI/MPI: MUI
Leakless/Leak: Leakless
[
Ability Information

Gives a 5/10/15 percent chance to do 3/4/5 second stun when a unit attacks you and the enemy will fall down.



Verison 1.1 Update
-Removed PolledWait and replaced with TriggerSleepaction
-Depending on the level of your ability, the dummy ability will change in stun duration.
-Added.... some terrain


Verison 1.2 Update
-turned some BJS into natives
- Now there is tooltip for the spell
- Dummy no longer shows and you will never ever see it.


Verison 1.3 Update
-Changed some functions to make it more efficent
-Unit now spawns for neutral passive
- Ability is now added at Init

Verison 1.4 Update
-Some minor text changes and ability name changes
-screenshots are added




Code

JASS:
scope Fortitute initializer Init
// +------------------------------------------------------------------------+
// |     Fortitute - Created by wraithseeker.  Requires JassNewGen!     |   
// +------------------------------------------------------------------------+
// | Gives 5/10/15% chance to knock down a enemy unit that is attacking the
// | person who has the spell.
// |                                      
// +------------------------------------------------------------------------+
// | How to Import:                                                         |
// |  - Create a new trigger                                                |
// |  - Convert it to Custom text                                           |
// |  - Replace everything there with this code                             |
// |  - Change the constants to suit yourself                               |
// |  - Make a dummy unit and a dummy ability based off storm bolt          |
// |  - create a passive ability based off anything and set everything to 0%|
// |  - You don't have to give me credits but don't say this spell is yours.|                                                            |
// +------------------------------------------------------------------------+
//               | Credits to Viikuna for helping me with some bugs|
// |-------------|-------------------------------------------------|
// | Constants:  |
// |-------------|

globals
private constant string EFFECT =  "Abilities\\Spells\\Items\\TomeOfRetraining\\TomeOfRetrainingCaster.mdl"  // effect at the guy who attacked
private constant integer ID = 'A003' // ability ID of spell
private constant string POSITION = "origin" // the position where u want to attach for effect at the guy who attacked
private constant string DEATH = "death" // the animation you want to play for the unit which attacked the person who has the ability
private constant integer UNIT = 'h001' // ID of dummy unit
private constant integer SPELL = 'A002' // ID Of dummy ability which will be used to stun
private unit Dealer // dummy unit
endglobals
//|----------------|
//|End Of Constants|
//------------------
private function CHANCE takes integer level returns integer
return level * 5 // the amount of chance each level the person can get knocked down
endfunction
/// DO not touch below this line ///
private function True takes nothing returns boolean
return true
endfunction

private function Conditions takes nothing returns boolean
return IsUnitEnemy(GetTriggerUnit(), GetOwningPlayer(GetAttacker())) and GetRandomInt(0, 100) <= CHANCE(GetUnitAbilityLevel(GetTriggerUnit(), ID)) and GetUnitAbilityLevel(GetTriggerUnit(), ID) > 0
endfunction


private function Actions takes nothing returns nothing
local unit t = GetTriggerUnit() 
local unit u = GetAttacker()
call SetUnitX(Dealer,GetUnitX(u))
call SetUnitY(Dealer,GetUnitY(u))
call SetUnitAbilityLevel(Dealer, SPELL, GetUnitAbilityLevel(t, ID))
call IssueTargetOrder(Dealer,"thunderbolt",u)
call DestroyEffect(AddSpecialEffectTarget(EFFECT,u,POSITION))
call TriggerSleepAction(0.1)
call SetUnitAnimation(u,DEATH)
set t = null
set u = null
endfunction



//===========================================================================
private function Init takes nothing returns nothing
    local trigger t = CreateTrigger() 
    local integer i = 0
   loop
   exitwhen i > 15
   call TriggerRegisterPlayerUnitEvent(t,Player(i), EVENT_PLAYER_UNIT_ATTACKED, Filter(function True))   
   set i = i + 1
   endloop
    call TriggerAddCondition(t,Filter(function Conditions))
    call TriggerAddAction( t, function Actions )
    set Dealer = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),UNIT,0.0,0.0,0.0)
    call UnitAddAbility(Dealer,SPELL)
    
endfunction

endscope
Screenshots
screeny.jpg


L0lz.jpg
 

Attachments

  • Fortitute.w3x
    19 KB · Views: 359

wraithseeker

Tired.
Reaction score
122
Well, they "fall down" since the person who has the ability is "so strong" and I can't find a better animation that every unit have lol.
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Ah, true enough.
IMO, it would just look/be weird :p .
Just trying to help you improve your spell though;
I'm not flaming you or anything :) .
Just in case you thought I was or something.
 

WolfieeifloW

WEHZ Helper
Reaction score
372
I'll actually check it out now, and edit this post with feedback :) .

EDIT: Bahh...
It looks very weird with the death animation.
The unit falls, then is still standing there lol.

"Woosh" effect = :thup: ,
Death animation = :thdown: .
 

WolfieeifloW

WEHZ Helper
Reaction score
372
For me, the death animation plays, the unit falls, but then he stands there while he's stunned.
It makes it look like a mirror image of him laying on the ground :p .
 

w00t22

CSS L4D DoD? Steam ID = w00t22
Reaction score
43
I don't see the point of having this in vJass just looks like a normal trigger converted with fixing of leaks and MUI
 

wraithseeker

Tired.
Reaction score
122
sure, upload one, Isn't that vjass? I am using a scope and globals. But can anyone tell me where can I download a file that can read .TGA.
 

Viikuna

No Marlo no game.
Reaction score
265
Why it is vJass is really stupid question really...

Or am I the only one who thinks that GUIs variable editor sucks?

EDIT. I think you should set that stormbolt dummys ability level to match Heros ability level. Now it is using level 1 stun for all levels.

Also dont use PolledWait -function. It leaks one timer.
 

Flare

Stops copies me!
Reaction score
662
Fairly simple spell, can't see much wrong with it (other than PolledWait, but that's just mainly because I don't like waits at all)

Indenetation could really use some improvement, looks quite ugly when all your code is stuck to the left side :(

Ahm... why isn't ownership of the dummy changed? If the Stormbolt does any damage, you do have an issue with kill credit coming into play

Why are you removing the ability from said dummy? You could just add it at Map Init and leave it on that dummy all the time (which is not likely to cause problems)

You can make your CHANCE function constant (just add 'constant', without inverted commas' between private and function) - not really a big deal, just a little bit of extra efficiency if you want :p

Possession - Created by wraithseeker. Requires JassNewGen!
You might wanna change that ;)

I don't see the point of having this in vJass just looks like a normal trigger converted with fixing of leaks and MUI
I don't think you (or anyone else, for that matter) have any right to question the author's choice to make this in vJASS - whatever the reasoning for making it in vJASS is, it shouldn't really matter, since he's the one making the spell and, as such, it's entirely his decision as to how he goes about it.

Also, why not make it in vJASS?
It's already in vJASS, as wraithseeker said - scopes, free global declaration, private members are all part of vJASS

Why it is vJass is really stupid question really...

Or am I the only one who thinks that GUIs variable editor sucks?

EDIT. I think you should set that stormbolt dummys ability level to match Heros ability level. Now it is using level 1 stun for all levels.

Also dont use PolledWait -function. It leaks one timer.
You're not the only one who thinks it sucks :) Free globals > all

And PolledWait only leaks the local handle, not the timer itself :p
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
I don't see the point of having this in vJass just looks like a normal trigger converted with fixing of leaks and MUI

A few reasons to make things in vJASS:

  • MUI
  • Leakless
  • Optimized
  • Easy to edit options
  • Easy to import
  • No naming problems

vJASS is good. It was also probably good practice for him.
 

wraithseeker

Tired.
Reaction score
122
This is the first spell I have made in vjass after reading romek's tutorial and darth's and some other, so, I should use a timer for the polled wait?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top