WarCraft: Source

 

EventScripts Classic Example Race

Page history last edited by freddukes@... 10 mos ago

EventScripts Classic Example Race

 

// Example Race By Steven Hartin (freddukes)

 

block load

{

// Called whenever our race is loaded

// We'll first define all our race attributes here

 

/////////////////////////

// RACE INFORMATION!!!!

// Register it so the player can only have knife glock and usp

wcs Race "first race" registerWeaponRestriction "allow only" "knife,glock,usp"

/////////////////////////

 

/////////////////////////

// SKILL INFORMATION!!!

// Register 2 skills

wcs Race "first race" registerSkill "My first skill" 1 1 "A test to see if my skill works"

wcs Race "first race" registerSkill "I am god" 4 3 "Random chance to put you in god mode"

/////////////////////////

 

/////////////////////////

// ULTIMATE INFORMATION!!!

// Register an ultimate

wcs Race "first race" registerUltimate "I am ledgend" 8 4 2 "Makes you turn red and everyones screen in a distance goes blury"

/////////////////////////

 

/////////////////////////

// VARIABLE SETTING!

// Here we set all variables

es_xset first_race_level 0

es_xset wcs_rand 0

es_xset first_race_temp 0

}

 

event player_spawn

{

wcs GetLevel first_race_level event_var(userid) "first race" "My first skill"

// Retrieve the level of the "My first skill" level

 

ifx true(first_race_level) do

{

// If the level is at least level 1, then do this

 

es_tell event_var(userid) #greenLook your first skill worked!

// Send a message telling the user his skill worked

}

 

wcs GetLevel first_race_level  event_var(userid) "first race" "I am god"

// Retrieve the level of the "I am god" level

 

ifx true(first_race_level) do

{

// If the level is at least level 1, then do this

 

es_xrand wcs_rand 1 5

// Get a random number between 1 and 5...

ifx parse("wcs_rand <= first_race_level") do

{

// If the random number is smaller than or equal to

// the race level, then turn the user into god

 

wcs God event_var(userid) 30

// Turn the player into God for 30 seconds

}

}

}

 

 

event player_ultimate_on

{

// This runs whenever the player uses his ultiamte key

 

wcs GetLevel first_race_level event_var(userid) "first race" "I am ledgend"

// Retrieves the level of the ultimate

ifx true(first_race_level) do
{
// If the level is at least level 1, then do...

es_xmathparse first_race_level "first_race_level * 50"
// Multiplies first_race_level by 50...
// This is a lot faster than es_xmath!!!!

wcs color event_var(userid) "red"
// Turn the color Red

es_delayed 5 wcs color event_var(userid) 255 255 255
// Reset the players color after 5 seconds

es est_near first_race_temp #all server_var(first_race_level) event_var(userid) "es est_shake server_var(first_race_temp) 5 10 10"

          // Run a near command... Everyone inside the distance from the user, will be shaken    

}

 

Comments (0)

You don't have permission to comment on this page.