Step 1, Come up with an idea... We'll say we want to make something that swaps your ammo with your enemy unless your ammo is higher.
Step 2, Ok so first, we need to identify, how we want the skill to level up? chance, amount of ammo syphon, or w/e.. We'll do Chance atm. i will redo the following guide for the amount of syphon which will be more advanced.
Step 3, Since we decided the chance we need to know how many levels.. Lets say 4 atm.
Step 4, We need to set the skill1_setting...
looks like this
Code
basically whats going on here is this.GeSHi (eventscripts):"skill1_setting" "es_xset wcs_chance 60|es_xset wcs_chance 40|es_xset wcs_chance 20|es_xset wcs_chance 10"
1) We say es_xset, this sets a variable for when the skill runs, its saved as server_var(wcs_chance)
2) wcs_chance is the variable that we have decided, and this is now saved as 20 or w/e the skill is
3) this basically is a fancy way of saying 30, 40 ,50 or what ever... but it makes it so you can modify each level.
**EDIT**
ok there seems to be some confusion about this. The reason its going down will make sence later, i will point it out in a later step
Step 5, Ok, Now to the fun part, the CMD... Should look like this
Code
Ok lets walk through this step by stepGeSHi (eventscripts):"skill1_cmd" "if (server_var(wcs_chance) <= server_var(dice)) then racealias_ammosteal"
if = If something, just a statment saying if something is true then do this.
server_var(wcs_chance) = The variable we set earlier.
server_var(dice) = this is a random variable that the server will do, its between 1 and 100.
<= = Less than or equal to, it simply means if your skill chance is less that what ever wcs_dice makes it will activate the then statement.
then = what tells it to activate what ever is after it, if the if statment is true.
racealias_ammosteal = the name of the Racealias were using i will explain in the next step.
**EDIT**
ok further up about that confusion, if you look here, i said <= which means if its less than or equal to, so if i set chance to 60, and dice comes up as 50, it wont activate, but if i set to 10 and it rolls a 50 it will, i am making the chance go down but it makes it happen more often, i am sorry this has confused some of you. if you have any more questions send me a PM
Step 6, The racealias, is something that you use to prevent haveing to repeat if (server_var(wcs_chance) <= server_var(dice)) then racealias_ammosteal.. its basically just a way to orignize skills... Ok so now this is the heart of the coding the part that makes it do what were doing. Now since this is an attacker skill... We are event_var(attacker) and the victim is event_var(userid) just not to get confused we are attacker they are userid
Now to the alias:
Ok so what we want to do is swap our ammo amounts right, How ever only if the person's ammo is higher than ours. And only when we attack them.
So first things fist.. We need to get the victim's ammo. We do this like this...
Code
This basically tells it to retrive how much ammo someone has in their clipGeSHi (eventscripts):es est_getammo wcs_tmp event_var(userid) 1
Next we need to see how much ammo we have Same thing but just for us
Code
Note how wcs_tmp and wcs_tmp2 are different, cause we need two variables so we can compare themGeSHi (eventscripts):es est_getammo wcs_tmp2 event_var(attacker) 1
Now we need to compare them to make sure our ammo isnt higher than theirs.
Code
Note here instead of repeating the If statement we can just make a new alias and it will do the same thing for us just without us repeating.. How ever we need to make it do something if we have more ammo than they doGeSHi (eventscripts):if (server_var(wcs_tmp) >= server_var(wcs_tmp2)) then racealias_ammosteal2
Code
This is basically saying if their ammo is less than ours then do a different race alias.GeSHi (eventscripts):if (server_var(wcs_tmp) < server_var(wcs_tmp2)) then racealias_fail1
heres it all together
Code
Note that for each section you need a ;GeSHi (eventscripts):"racealias_ammosteal" "es est_getammo wcs_tmp event_var(userid) 1;es est_getammo wcs_tmp2 event_var(attacker) 1;if (server_var(wcs_tmp) >= server_var(wcs_tmp2)) then racealias_ammosteal2;if (server_var(wcs_tmp) < server_var(wcs_tmp2)) then racealias_fail1"
**EDIT**
again clearing up some confusion, wcs_tmp, is a temporary variable that you can use to set certain things to in the middle of a skill, all its doing is saving a number. Not inportant, but remember it as a way to store a variable!!
Step 7, And so now we must finish up by making the two racealiases, this will make the one that will activate if we do swap ammo's
Code
Now since we have already gotten the ammo of each play and stored as wcs_tmp = victim and wcs_tmp2 = attacker (us) then we simply need to set the ammo to the opposite person to swap them. Just for neatness i included the tell command (not needed)GeSHi (eventscripts):"racealias_ammosteal2" "es est_setammo event_var(userid) 1 server_var(wcs_tmp2);es est_setammo event_var(attacker) 1 server_var(wcs_tmp);es_xtell server_var(wcs_userid) #Lightgreen Swaped Ammo."
Step 8, This is the code for when it fails =(
"racealias_fail1" "es_xtell server_var(wcs_userid) #Lightgreen You have more ammo then your target!"
Step 9, Paste it all together
player_attacker
4levels
Code
For the SFX see the Comming soon HOW to make and SFXGeSHi (eventscripts):"skill1_setting" "es_xset wcs_chance 60|es_xset wcs_chance 40|es_xset wcs_chance 20|es_xset wcs_chance 10"
"skill1_cmd" "if (server_var(wcs_chance) <= server_var(dice)) then racealias_ammosteal"
"racealias_ammosteal" "es est_getammo wcs_tmp event_var(userid) 1;es est_getammo wcs_tmp2 event_var(attacker) 1;if (server_var(wcs_tmp) >= server_var(wcs_tmp2)) then racealias_ammosteal2;if (server_var(wcs_tmp) < server_var(wcs_tmp2)) then racealias_fail1"
"racealias_ammosteal2" "es est_setammo event_var(userid) 1 server_var(wcs_tmp2);es est_setammo event_var(attacker) 1 server_var(wcs_tmp);es_xtell server_var(wcs_userid) #Lightgreen Swaped Ammo."
"racealias_fail1" "es_xtell server_var(wcs_userid) #Lightgreen You have more ammo then your target!"
"skill1_sfx" "0"
And the How to put together skills into a race post!!
Step 10, Make a few more skills, paste together and make a race WOOT!! Note i said make the skills , not take the skills XD
When your done Run your skill/race through here
RACE CHECKER
ENJOY
-zero




Poll




United States
Logged
Denmark


New Zealand
Germany

