Archived copy of warcraft-source.com, the Warcraft: Source (WCS) forum (2007–2011), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2009-11-04 (original capture). Home · Forum · All archived topics · Downloads
Warcraft-Source.com - WCS mod for CSS
November 04, 2009, 01:54:34 PM *
Welcome, Guest. Please login or register.
Login with username, password and session length
News: Please obey the rules, to achieve a pleasent order in our community.
Google  
  Home   Forum   Help Search Login Register   *
Pages: 1 [2]   Go Down
  Print  
This topic has not yet been rated! You have not rated this topic. Select a rating:
Author Topic: [Tutorial] Skill to Block  (Read 548 times)
Maxxi
Level 7 Expert
*****
Offline Offline

Netherlands Netherlands

Posts: 1458



WWW
16maxpayne16

myServer 84.243.214.217:27015
(Warning: click connects through Steam)
« on: June 11, 2009, 09:04:11 AM »

A skill to a block!

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"


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" ""

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"

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
}
}

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)

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).

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 Wink
« Last Edit: June 17, 2009, 04:00:54 PM by WCA | Maxxi [NL] » Logged

 
DisturbeD
Level 4 Intermediate
****
Offline Offline

Germany Germany

Posts: 93



« Reply #16 on: October 12, 2009, 11:59:49 PM »

huh I got like 300 races in my list.. thats gonna be damn much work -_-
Logged
CA AvasT
Level 7 Expert
*****
Offline Offline

Brazil Brazil

Posts: 452




doug_tiozao
« Reply #17 on: October 13, 2009, 03:00:09 AM »

Nobody said that you'll need to convert then all, keep then the way they are
and your server should be very good to support more than 300 races and dont lag >X
Logged

Pages: 1 [2]   Go Up
  Print  
 
Jump to:  

Last 7 Shouts:
Today at 12:38:46 AM
check out my topic i need some help plz http://warcraft-source.com/board/index.php/topic,8754.0.html
November 03, 2009, 10:22:51 PM
hmm, maby ?
November 03, 2009, 10:12:01 PM
will some one help me with maknig a race free
November 03, 2009, 08:26:58 PM
i thought you were a little propminine
November 03, 2009, 08:07:02 PM
^^
November 03, 2009, 05:05:34 PM
=P
November 03, 2009, 03:21:54 PM
=D
Recent
[Today at 01:41:29 PM]

[Today at 01:39:17 PM]

[Today at 01:16:16 PM]

[Today at 01:10:02 PM]

[Today at 11:52:07 AM]

[Today at 10:36:09 AM]

[Today at 09:25:55 AM]

[Today at 12:37:57 AM]

[Today at 12:17:30 AM]

[November 03, 2009, 01:59:29 PM]
Theme switch

Powered by MySQL Powered by PHP Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC
TinyPortal v0.9.8 © Bloc
Valid XHTML 1.0! Valid CSS!
Page created in 0.094 seconds with 25 queries.