help with a triggered spell

F

Flakes

Guest
Last Wish
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Last Wish
Actions
Unit - Set life of (Triggering unit) to 80.00%


well thats a good starting (i think) but i want to make that in level 2 he gains 90% and in level 3 100% , how???
 
E

Eilhal

Guest
If level of ability being cast is eual to one then BLAH Else If level of ability being cast is equal to two then BLAH Else If level of ability being cast equal to three then BLAH Else nothing
 
E

Eilhal

Guest
I'm not entirely sure... I thought it was because I had seen someone say it elsewhere... but if not I can open up my editor and look for a REAL answer for you :p Sorry if that one is bogus
 
U

unstable

Guest
by casting that ability, the caster is actually losing health lol
 

Duwenbasden

Ver 6 CREATE energy AS SELECT * FROM u.energy
Reaction score
165
Do NOT, ever, use Triggering unit unless there is no other choice. Using Triggering Unit is like naming your variable "a".
 
U

Unregistered

Guest
thanks ^^ , iam in another computer so Iam unregistered xD
 
F

Flakes

Guest
another question... how can i make that the spell only can be used if the casters life is 20% or less? i don't know conditons that use percentages , help plz










PD: whats that of rep? because in all contest the winner gets rep , whats that!
 

SFilip

Gone but not forgotten
Reaction score
633
rep=reputation. its some sort of user rating - other people rate you either positive (if you help them) or negative (if you flame, disrespect the rules etc).
to give someone reputation click on
reputation.gif
on the top of his post.

now back to the topic...
try to avoid checking the level if you don't have to (and you don't in 99% cases). instead...
Unit - Set life of (Triggering unit) to (((Real(Level of (Ability Being Cast) for (Triggering Unit)) * 10) + 70)%
to make it work only if you have 20% simply add a condition (real comparison) percentage life of triggering unit less than or equals to 20.
 

C-Death

I love you
Reaction score
45
As MoonRazer said, it looks like an integer would solve your problem.
 
F

Flakes

Guest
thanks , i didn't know that Real could have percentages , thanks!
 

Sim

Forum Administrator
Staff member
Reaction score
534
Duwenbasden said:
Do NOT, ever, use Triggering unit unless there is no other choice. Using Triggering Unit is like naming your variable "a".

Are you sure about this ? It really depends...

Code:
function GetAttackedUnitBJ takes nothing returns unit
    return GetTriggerUnit()
endfunction

So now we can conclude that (Attacked unit) is exactly the same as (Triggering unit).

Thanks SFilip for clearing this thing out previously ;)

Some functions cannot be replaced with (Triggering unit) though. (Attacking unit) isn't (Triggering unit) when using "Unit - A unit is attacked" event. To use (Triggering unit) just look if the unit you are referring to is the one used in the event. Period.
 
M

Masterfrog

Guest
Soz for off-topic, but isn't actually triggering unit faster (well, very slightly ofcourse, but still) than anything else that could replace it in any given situation? I think I've heard someone claim it.
 
F

Flakes

Guest
well i did the condition of less than 20 percent life but if you cast the spell with like 50% life , the spells casts but don't work , so i want that when you cast the spell with more than 20% life , a message apperas that you cannot cast it and the spell doesn't cast



srry if iam makin so questions but iam a noob in mapmaking
 

SFilip

Gone but not forgotten
Reaction score
633
Masterfrog said:
Soz for off-topic, but isn't actually triggering unit faster (well, very slightly ofcourse, but still) than anything else that could replace it in any given situation? I think I've heard someone claim it.
probably me...explained above by dax.
attacked and dying unit would for example be the slower way to get triggering unit. however the difference is really minor.
also for some event responces like casting unit its completely the same since it seems they work directly.

anyway back to topic. to make a message you need to get a fake message function, most likely found on wc3jass.com.
now to trigger it...you need to check the unit's hp with that condition, but inside an if..then. if it is then do the actions that sets life. if it isn't then return the mana and show the message.
edit: here is the fake message function - http://wc3jass.com/viewtopic.php?t=239
now here's how to implement it:
-add the script to your map's custom script section (the map name on the left in the trigger editor).
-create a variable of type sound and name it SimError
-call the function using Custom Script: call SimError(GetOwningPlayer(GetTriggerUnit()), "your message") inside your trigger
 
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