Heal spell based on main attribute

Anderzzon

Active Member
Reaction score
4
I wanna create a spell that heals the target based on the casters main atribute.

It should heal MAx4, so if the caster has 25 intel (and is an intel hero (I feel a need to be overly clear...)) then the target should be healed for 100.

Is it possible to do this with a rather simple trigger? No JASS since I haven't even used started using JASS yet so...

/Anderzzon
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
make a custom spell which does completely nothing (best to use channel) and create a trigger similar to the following one:
Trigger:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Heal (custom ability)
    • Actions
      • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + (0.25 x (Real((Intelligence of (Triggering unit) (Include bonuses))))))

you can add special effects or a text tags or whatever you like, this is just the basic.
 

Anderzzon

Active Member
Reaction score
4
That doesn't look too hard. Thanks mate.

Now... if I want to create a simular spell that damages instead. Is it the same though the other way around?

/Anderzzon
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
i would suggest to use the action "unit - damage target" instead.
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
You cant detect the main attribute with triggers alone
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
but he can detect the hero casting the spell and the main attribute of a specific hero is always the same.
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
Wow. Lots of heroes = lots of if/then/else
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
you only have to take the number of heroes which can actually cast this spell.
and besides, do you know a better way?
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
Well this is if there is alot of heroes. You need 3 passives that do nothing and name then str, agi, int, then you need 3 spell books that has visible set to false and Name them also str, agi, int. Then put the passive str in spell book str and do the same with agi and int. Then give the str spell book to all strenth heroes do the same with agi and int. Then just detect if he has str then he is a strenth hero or if he has agi then his agility.
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
actually this is a nice idea but i would suggest using invisible passive abilitys instead of having those 3 extra spellbooks consuming space.
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
Didnt know passive could be invisible. Use attribute bonus but no bonus then check the field hide icon
 

Anderzzon

Active Member
Reaction score
4
Like item armor bonus with no bonus? It doesn't show. It's what I use for attachments so...
 

ChaosWarlock

New Member
Reaction score
7
I just put my heroes into one of there groups when they are picked, str/agi/int. Then when the unit casts a spell I check what group it is in and do the damage according to that attribute.
 

Anderzzon

Active Member
Reaction score
4
I was thinking the same, just place them in unit groups. I thought of that yessterday. After the post I did with the armor thingie. :p

/Anderzzon
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
How do you add non existant units to unit groups and if the enter the map you will need a lot of if then else and it leaks 3 unit groups
 

ChaosWarlock

New Member
Reaction score
7
Non existent units cant cast spells.

Yes you need 3 if/then/else.

Event: Unit enters map
Condition: Unit is a hero
Action: If multiple
Unit = Paladin
Unit = Tauren Chieften
Then add to Heroes_Str
Else

(Repeat the red for intel and agi heroes.)

The three unit groups do not leak. Only leaks if you do "pick every unit in..." and you don't use a variable.
 

roXplosive

New Member
Reaction score
15
I was thinking of using an array of structure (1 position for every hero unit available) that has constant values . This works well if you have a selection area for heroes .

JASS:

structure mainstat
   private integer UnitCode
   private integer AttributeCode

   method SetValue takes unit u , integer a returns nothing
          set u=GetUnitTypeId(u)
          set AttributeCode=a
   endmethod

   method StatType takes unit u returns integer
         if UnitCode==GetUnitTypeId(u) then
           return AttributeCode
         else
           return -1
         endif
  endmethod

endstructure


Then for the heroes actually created make a pair of (unit,abilitycode) for faster access in the spell . But chaos Warlock's method is better . Only don't let some heroes out when creating the map
 

Dirac

22710180
Reaction score
147
Donst even need to know which one is the main attribute, it uses to be the one with the highest value as for

IF
And
If Intelligence greater than Strenght
If Intelligence greater than Agility
THEN
Stuff with intelligence
ELSE

IF
And
If Agility greater than Strenght
If Agility greater than Intelligence
THEN
Stuff with Agility
ELSE
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top