• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] can somebody help to create one spell?

Status
Not open for further replies.
Level 3
Joined
Jan 13, 2008
Messages
28
okay i have to try to create trigger spell like "when uses skill then (-casting unit-) gets random skill like slow poison or storm bolt or etc."

oh noes what a mistake i dont remember to change to "unsolved" -,.-
 
Last edited:
Level 3
Joined
Jan 13, 2008
Messages
28
im not good to create variables yet so can u pls make it here at here
i will give credits if u want at my map and etc. (-if you want-)
 
Level 11
Joined
Dec 31, 2007
Messages
780
here goes a little explanation


  • Adding ability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to "your ability"
    • Actions
      • Set Variable_Integer = (Random integer number between 1 and 10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Variable_Integer Equal to 1
        • Then - Actions
          • Unit - Add "skill you want to add" to (Triggering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Variable_Integer Equal to 2
        • Then - Actions
          • Unit - Add "another skill you want to add" to (Triggering unit)
        • Else - Actions

Now... if you want that the ability already given to the hero becomes unavailable you should make it another way... try to be more especific about your needs and i shall make the trigger for you ^^
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Such if statement systems are highly unefficent especially in GUI and not recomended.

The easiest way I can see this done is simple. You make a global integer array and you store all abilities you want to be cast that target a unit in it with no gap in the subscript numbers used. You then randomly generate a local integer variable between 0 and the final subscript number used. You then add the ability of ID (your ability integer array with subscript of random integer local) to a dummy caster unit and then order it to cast the ability at the target. Casting the spell is the harder part as you may then need a separate integer / string array to store the order IDs so you can get the unit to cast the spell you added.

This should be a lot more efficent than the if tree system used above as it avoids the need for any logic opperations to get a random ability. Also you can still add weight to certain abilities (increase their chance of being cast) by simply adding the ability ID to the ability ID array more than once.
 
Level 11
Joined
Dec 31, 2007
Messages
780
Dr super good... that was a nice solution, but the hardest part of your idea is not needed... as far as i understood he wanted a hero to have the ability for some time not to be casted... am i correct?

Bone demon ... if you want an example of what doctor super good said ... tell me and ill see if can make it :) (if he doesnt before :p)
 
Level 8
Joined
Mar 23, 2007
Messages
302
All information given by Bone Demon leads to one thing he wants.

Whenever a Unit uses a (Skill) then
this unit gets another (Random Skill) for (a Time).

this is what u asked for.
But mb u would need more somthing like this:

Whenever a Unit uses a (Skill) then
it looses the (Skill) and
it gets another (Random Skill) for (a Time).
After (a Time) it gets (Skill) back and looses the (Random Skill).

This would let some space for other skills, and preventing mass Skilladding
by fast spamming (u can ofc prevent with proper cd). However, i did it like
the following example shows.

and Here is the Code:
JASS:
function Trig_Random_S_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A000'
endfunction

function Trig_Random_S_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local integer SpellID = 'A000'
local integer level = GetUnitAbilityLevel(c,SpellID)
local integer r = GetRandomInt(0,((3*level)-1))   //*
local integer d = 3   // tooltip says 12
local integer cd = 1  // tooltip says 4
local integer array ID
local integer s

set ID[0] = 'ANhs'  //healing spray
set ID[1] = 'ANlm'  //lava monster
set ID[2] = 'ANwk'  //windwalk
set ID[3] = 'ANch'  //charm
set ID[4] = 'ACca'  //Swarm
set ID[5] = 'ACsl'  //Sleep
set ID[6] = 'ACuf'  //Frenzy
set ID[7] = 'Aenw'  //Roots
set ID[8] = 'ACad'  //Summon Dead        //U can add as much Spells'n'Skills as u like
                                         // but Always remember to increase then the Max
call UnitAddAbility(c,ID[r])             // random r, that i marked with a *
call UnitRemoveAbility(c,SpellID)
call PolledWait(d)
call UnitRemoveAbility(c,ID[r])
call UnitAddAbility(c,'A001')
call PolledWait(cd)
call UnitRemoveAbility(c,'A001')
call UnitAddAbility(c,SpellID)
call SetUnitAbilityLevel(c,SpellID,level)

endfunction

and the Map is also attached.

Additional informations:
-lvl to increase the lvl of the ability.

change the ID's to others, to replace the Spells.
I changed the normal CD i gave (normaly: 12 sec spell lasts + 4 second dissable) to Test mode( Test: 3 sec spell lasts + 1 seconds disable)
The specific spell CD is deleted everytime u remove and add the skill, to keep
the specific CDs u would need a more advanced System.

HF
greets Equal
 
Level 3
Joined
Jan 13, 2008
Messages
28
i just get what i want and there is cooldown for spell so i dont need to "remove" the spell when its casted...i dont know anything from JASS triggers its like different languance what is not released ^^. but anyway i get what i want
 
Level 11
Joined
Dec 31, 2007
Messages
780
i encourage you to use doctor super good's sistem coz it is a lot better than what i said... and i really encourage you to use equal's sistem (but i dont get a thing of jass either so i cant help you there... even though that script is not hard to understand... you could get problems trying to find each ability code to add to the script the rest is easy)


but if you achieved what you were looking for doing my stuff... ill tell you to use the other one that doctors said... im gonna post the propper trigger for that one later (coz im working right now xD)
 
Status
Not open for further replies.
Top