Tutorial How to make a random ability

R

Ricky

Guest
Hi~Ricky
This is my first tut so any comments are welcome and feedback would be great.:)
In this tut im going to say how to make an ability were if you use it a random thing will happen out of as many things as you like.:rolleyes:
we are going to do it using triggers.But first we need the ability so open up map editor an create a new map. First make a new unit to use the ability (optional) Then we make a new ability. make its base the naga summoner ability i think it was called summoning ritual and its description was summons energies from the twisted nether or something. anyways change the name and description to your liking.But dont change anything else. Now open the trigger editor and make a new trigger (i called mine first preperation) put the events as a unit startes casting an ability and put conditions as ability being cast equal to <your ability>

Code:
[COLOR="Blue"][U]Trigger 001[/U]
          Events 
              A unit starts casting an ability
         Conditions
             Ability being cast equal to <ur ability[/COLOR]>
Then open the variable editor and creat a new integer (i named mine ability one)it doesnt need to be an array. Put starting value as 0 (it should start like that) Now go back to the trigger editor and to your made trigger. now change the actions. Make a set variable trigger and make the trigger look like the following:

Code:
[COLOR="Blue"]Tri[U]gger 001[/U]
          Events 
              A unit starts casting an ability
         Conditions
             Ability being cast equal to <your ability>
         Actions
            set variable <your variable name>=random number between <how many randomised things that can happen you want> (example: random number between 1 and 5)[/COLOR]
Now we need The thing that makes it all work:More triggers (Note:This is just how i do it i expect there are many more ways)Say you wanted only to things for it to possably be then you make two triggers and put them initialy off then leave them and go back to your first trigger.
Now we make more actions. add the action if/then/else under general and make the conditions (or the if) if integer value is 1. Then under the <Then>
Turn on trigger <one of your possable ability triggers mines called ability outcome one> Then under <else> make another if/then/else action but this tiem make the if conditions as if the value of <your variable> is 2 .And the then actions as turn on trigger <the name of ur other ability outcome mines called ability outcome 2> and repeat the porcess untill you turn on the amount of triggers u want to be the amount of outcomes. Ex: Iwant three outcomes on mine.

Code:
[COLOR="Blue"][U]Trigger 001[/U]
                events
                      a unit begins casting an ability
                 conditions
                      ability being cast equal to Random outcome ability
                  actions
                  Set value of variable 001=random number between 1 and 3
                    If/then/else
                      if
                        Value of variable 001 equal to 1
                      then
                        Turn on trigger outcome possability 1
                      else
  if/then/else
     if
       value of trigger 001 equal to 2
     Then
       Turn on trigger outcome possability 2
     else
  if/then/else 
     if
        value of trigger 001 equal to 3
    Then 
       turn on trigger outcome possability 3
     else
       do nothing[/COLOR]
Now all we have to do is finish the triggers that let the outcomes happen But first we need to do one last thing place in the unit that uses the ability a lot of problems come from that for instance only that specific unit can use the ability but thats how i make maps and remember this is only one way of doing it. now to finishe the triggers we have go to put in the events i put in time elapsed 0.01 seconds
then you put in the actions what you want to happen if this outcome happens .
for example

Code:
[COLOR="Blue"]trigger outcome possability 1
          events
             elapsed time 0.01
          conditions

          actions
            set (unit_ability unit001) life percent to 100%.[/COLOR]
Another thing you could do as actions is give the triggering unit an ability wait for _____seconds then take the ability off it again.

If all is done well this is what shoul happen in-game

A player clicks the ability the integer randomises itself then the trigger finds which number the integer has landed on then it carries out what happens.

Well i think i have covers the way i make random abilities. I hope that you found this tut usefull and that you will reply to this tut and give me feedback.:) ~Ricky A.K.A Tichondrias NOTE: This tut(tutorial) uses only one way of doing this there are i expect a lot more ways. The way i have stated in this tut is just the easyest for me and i though that it would make more sense to some poeple then other ways would.
 
Reaction score
332
1. There is no need to run additional triggers, the actions can be executed under the if/then/else statement.

2. You should use run trigger instead of turn on trigger if you wish to run a trigger.

3. (Triggering Unit) will be null in the trigger "outcome possability 1".

4. You should use "starts the effect of an ability" as opposed to "begins casting an ability".

5. Your if statements should probably be nested (assuming they aren't already).

6. When you are making a tutorial or formal article, it is important to put effort into your spelling, layout, grammar, punctuation and capitalization. No one demands perfect English, but it is much easier to read and understand.
 
R

Ricky

Guest
Seven points

1. There is no need to run additional triggers, the actions can be executed under the if/then/else statement.

2. You should use run trigger instead of turn on trigger if you wish to run a trigger.

3. (Triggering Unit) will be null in the trigger "outcome possability 1".

4. You should use "starts the effect of an ability" as opposed to "begins casting an ability".

5. Your if statements should probably be nested (assuming they aren't already).

6. When you are making a tutorial or formal article, it is important to put effort into your spelling, layout, grammar, punctuation and capitalization. No one demands perfect English, but it is much easier to read and understand.

1. There may be no need for some things but if u want to give a unit an ability then have additional actions to take it away its harder for me to do it that way.

2.I was thinking that when i was typing it in but i decided to keep it the same couse thats how i do it on my maps and it workd fine.

3.Again it works fine for me the way i did it.

4.Once again it works for me the way i did it

5.Fair enough i should maybe have used better english but i have several points to make here.: 1. I am actually doing four things here. one writing this tut. Two sorting out a website for me friend. Three trying to play medieval 2 total war. and four trying to give a guy advice over Xfire. Why do it all at the same time? You may ask well the answer is i cant do it at any other time Soon

6. I will change it to satisfy the things u have stated up to a degree were i can. If i dont change it will be beacuse im too busy. or i think i dont need to and it is fine as it is.

7. im sorry if you think that i havnt changed what i should
 

ianu74

New Member
Reaction score
8
1. Try to use The CODE tags for your trigger codes... i can't read properly.
2. I don't understand why you need
trigger outcome possability 1
events
elapsed time 0.01
conditions

actions
set (trigerring units) life percent to 100%.
 
R

Ricky

Guest
because

ok i got it because it is an example of one of the outcomes you could do.
Iv put the code tage around it soz bout that.
 
Reaction score
148
The last trigger is very odd.

What does it do?

After one second the game has started, it sets the life of non-existant unit (Because there is no triggering unit in that trigger) life to 100%?
 
R

Ricky

Guest
Oops

Oh yeah soz a bout that i forgot u have to place the unit and select the unit.
I know that means the ability only works for a ready made unit. but its just the way i make maps really soz:banghead:
 
Reaction score
65
Wasn't very useful. The triggers are, as said above, quite basic and they could had been done alot better.
 
R

Ricky

Guest
Wasn't very useful. The triggers are, as said above, quite basic and they could had been done alot better.

Fair enough. Yes the triggers could have been done better i know couse i can do it but now i shall state why i did it like that:

1.Some people find this way easier to understand and when they get the hang of my way they are more likely to understand other ways.:) 2.I just make maps that way.I find it quicker and easier than the other ways and for me it works better too and that made me think that it must be easier for at least a few more people than myself.:rolleyes: 3.I also couldnt find one tutorial were it tells you how to make random abilities so i thought that i should make a baisic one:D
4.I think that it was usefull for some people. As most people who look for tutorials dont know how to make any kind of map at all so if i had used more advanced triggers they might not have understood.:confused:
 
Reaction score
332
1. There may be no need for some things but if u want to give a unit an ability then have additional actions to take it away its harder for me to do it that way.

2.I was thinking that when i was typing it in but i decided to keep it the same couse thats how i do it on my maps and it workd fine.

3.Again it works fine for me the way i did it.

4.Once again it works for me the way i did it

5.Fair enough i should maybe have used better english but i have several points to make here.: 1. I am actually doing four things here. one writing this tut. Two sorting out a website for me friend. Three trying to play medieval 2 total war. and four trying to give a guy advice over Xfire. Why do it all at the same time? You may ask well the answer is i cant do it at any other time Soon

6. I will change it to satisfy the things u have stated up to a degree were i can. If i dont change it will be beacuse im too busy. or i think i dont need to and it is fine as it is.

7. im sorry if you think that i havnt changed what i should

All points taken, but just because something "works" doesn't mean it works well. If every single map maker went through their maps using inefficient code, the lag would be intolerable. If every one went for that same bare minimum, society would quickly break down.

The fact that something works should not be the soul justification for using it. It needs to also work well.
 
R

Ricky

Guest
Good point but......

The fact that something works should not be the soul justification for using it. It needs to also work well.

That is a very good point but as i have said before this is only baisic and i mainly did it so others would get the hang of making one that as you said doesnt work well. So they can grasp how to make a more advanced one.:)

Note: A quick note if you are going to leave a comment: Please if it is crititism which i really dont mind make it constructive like this persons comment:)
 
R

Ricky

Guest
I have something to say

I just want to state that i am in the progress of making more tuts and i have already finished one: 2 in 1 Doodad Tutorial:)
 
R

Ricky

Guest
Hi

Hi~Ricky

Hi evryone im just going to say that in members projects area my new map "The Battle of Hastings" is there please go and have a look (it comes with download)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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