I decided to make a little guide to convert a skill into a block since alot of people don't know how to do this, and it is more of a requirement to do this in the new up coming wcs version. If you notice any bugs or have suggestions please tell me so i can improve this guide and help people the best i can.
Important!! Read the comments in the code for alot more info and instructions.
Experience needed:
Basic es coding and skill coding,
Skill code:
The skill you are going to convert to a block is a reflect skill with a 33% chance.
Code:
"skill1_setting" "es_xset wcs_reflect 5|es_xset wcs_reflect 9|es_xset wcs_reflect 13|es_xset wcs_reflect 17"
"racealias_reflect" "es_set wcs_dmg event_var(dmg_health);es_copy wcs_tmp wcs_dmg;es_math wcs_tmp float;es_math wcs_tmp / 100;es_math wcs_tmp * server_var(wcs_reflect);es est_rounddecimal wcs_dmg server_var(wcs_tmp);es wcs_dealdamage event_var(userid) event_var(attacker) server_var(wcs_dmg);es_tell event_var(userid) #multi #lightgreenReflect did#green server_var(wcs_dmg) damage #lightgreento event_var(es_attackername).;es_tell event_var(attacker) #multi #lightgreenReflect did#green server_var(wcs_dmg) damage #lightgreenfrom event_var(es_username)."
"skill1_cmd" "if (server_var(wcs_dice) <= 33) then racealias_reflect"
"skill1_sfx" "es_getplayerlocation wcs_x1 wcs_y1 wcs_z1 event_var(userid);es_math wcs_y1 + 36;es est_effect 10 #a 0 effects/hydraspinalcord.vmt server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) 0 240 4 8 10 5 244 207 2 210 3"
"racealias_reflect" "es_set wcs_dmg event_var(dmg_health);es_copy wcs_tmp wcs_dmg;es_math wcs_tmp float;es_math wcs_tmp / 100;es_math wcs_tmp * server_var(wcs_reflect);es est_rounddecimal wcs_dmg server_var(wcs_tmp);es wcs_dealdamage event_var(userid) event_var(attacker) server_var(wcs_dmg);es_tell event_var(userid) #multi #lightgreenReflect did#green server_var(wcs_dmg) damage #lightgreento event_var(es_attackername).;es_tell event_var(attacker) #multi #lightgreenReflect did#green server_var(wcs_dmg) damage #lightgreenfrom event_var(es_username)."
"skill1_cmd" "if (server_var(wcs_dice) <= 33) then racealias_reflect"
"skill1_sfx" "es_getplayerlocation wcs_x1 wcs_y1 wcs_z1 event_var(userid);es_math wcs_y1 + 36;es est_effect 10 #a 0 effects/hydraspinalcord.vmt server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) 0 240 4 8 10 5 244 207 2 210 3"
The fist thing you have to do is make the skill part that you are going to place in the race. For this just begin with a fresh skill (for the people who don't know what i mean ill show it):
Code:
"skillX_setting" ""
"skillX_cmd" ""
"skillX_sfx" ""
"skillX_cmd" ""
"skillX_sfx" ""
After you have done this you are going to fill in the settings and link to the block were you complete the rest of the code.
Code:
// First you start with the settings. The only setting you are going to use is wcs_reflect and this means the x damage the reflect skill does(is a calculation i will explain later).
"skillX_setting" "es_xset wcs_reflect 5|es_xset wcs_reflect 9|es_xset wcs_reflect 13|es_xset wcs_reflect 17"
// After you have set the settings continue to the cmd part of your skill and link to the block you are about to create.
"skillX_cmd" "es_xdoblock wcs/WCSultimates/block_name"
// I leave the sfx empty because i don't make these for instruction.
"skillX_sfx" "0"
"skillX_setting" "es_xset wcs_reflect 5|es_xset wcs_reflect 9|es_xset wcs_reflect 13|es_xset wcs_reflect 17"
// After you have set the settings continue to the cmd part of your skill and link to the block you are about to create.
"skillX_cmd" "es_xdoblock wcs/WCSultimates/block_name"
// I leave the sfx empty because i don't make these for instruction.
"skillX_sfx" "0"
Block code:
The syntax for an empty block looks like this and make sure you never forget the { } because if you forget one the whole thing will not work.
Code:
block block_name
{
}
{
}
Fill the block:
You are now going to fill the block with code and because this skill has a chance that is were you start first. In the race you use if(server_var(wcs_dice) <= 33) then racealias_reflect and in blocks you mostly do not use this but you use a diffirent syntax.
Now when you have added your chance it should look like this:
Code:
block block_name
{
// The first if you create and with this if you want it that if the variable wcs_dice is below or equal to the 33 the code will execute.
if (server_var(wcs_dice) <= 33) do
{
// Your codes come here
}
}
{
// The first if you create and with this if you want it that if the variable wcs_dice is below or equal to the 33 the code will execute.
if (server_var(wcs_dice) <= 33) do
{
// Your codes come here
}
}
Lets do some math to decide what the amount of damage is that you are going to reflect.
Code:
// First off set a variable to the amount of damage done by 1 attack. You do that by setting a variable with event_var(dmg_health)
es_set wcs_dmg event_var(dmg_health)
// Now to make the math easier you copy it to another variable so you can use wcs_dmg later for doing the real damage.
es_copy wcs_tmp wcs_dmg
// This is needed to divide, so don'd leave it always use it when dividing numbers and variables.
es_math wcs_tmp float
// Now the variable is ready to be divided and then multiplied by percentage of the reflection damage.
es_math wcs_tmp / 100
es_math wcs_tmp * server_var(wcs_reflect)
// To clean up the variable to a integer withough any decimals use est_rounddecimal and also the var wcs_dmg is set again, but now with the good value.
es est_rounddecimal wcs_dmg server_var(wcs_tmp)
es_set wcs_dmg event_var(dmg_health)
// Now to make the math easier you copy it to another variable so you can use wcs_dmg later for doing the real damage.
es_copy wcs_tmp wcs_dmg
// This is needed to divide, so don'd leave it always use it when dividing numbers and variables.
es_math wcs_tmp float
// Now the variable is ready to be divided and then multiplied by percentage of the reflection damage.
es_math wcs_tmp / 100
es_math wcs_tmp * server_var(wcs_reflect)
// To clean up the variable to a integer withough any decimals use est_rounddecimal and also the var wcs_dmg is set again, but now with the good value.
es est_rounddecimal wcs_dmg server_var(wcs_tmp)
The damage and messages to the players involved.
Code:
// Now you have the variable with the right amount of reflection damamge lets do the actual damage by useing wcs_dealdamage.
es wcs_dealdamage event_var(userid) event_var(attacker) server_var(wcs_dmg)
// Make some tells to let the players know what happend and how much damage was done by the reflection.
es_tell event_var(userid) #multi #lightgreenReflect did#green server_var(wcs_dmg) damage #lightgreento event_var(es_attackername).
es_tell event_var(attacker) #multi #lightgreenReflect did#green server_var(wcs_dmg) damage #lightgreenfrom event_var(es_username).
es wcs_dealdamage event_var(userid) event_var(attacker) server_var(wcs_dmg)
// Make some tells to let the players know what happend and how much damage was done by the reflection.
es_tell event_var(userid) #multi #lightgreenReflect did#green server_var(wcs_dmg) damage #lightgreento event_var(es_attackername).
es_tell event_var(attacker) #multi #lightgreenReflect did#green server_var(wcs_dmg) damage #lightgreenfrom event_var(es_username).
Note by TC:
Start every block with
Code:
if (server_var(wcs_debug) = 1) then echo BLOCK_NAME start
and end it with
Code:
if (server_var(wcs_debug) = 1) then echo BLOCK_NAME end
Now the completed block and skill:
For the people who didn't know this skill is a player_victim skill. I hope this was usefull and instructive and if you have questions always ask them







Netherlands

Logged
Germany
Brazil