Here take for example the code from my santa race simplified to be like yours:
Code:
"name" "Santa"
"author" "ZERO"
"required_level" "320"
"maximum_level" "0"
"allow_only" "0"
"teamlimit" "0"
"preloadcmd" "0"
"player_spawn_cmd" "es_doblock zero_race/Santa/Santa_Spawn"
"round_start_cmd" "0"
"round_end_cmd" "0"
"numberofskills" "4"
"numberoflevels" "4"
"skillnames" "Sleigh"
"skilldescr" "Fly around at increasing speed."
"skillcfg" "player_ultimate"
"skill1_setting" "es_set Santa_Speed 1.5|es_set Santa_Speed 2|es_set Santa_Speed 2.5|es_set Santa_Speed 3"
"skill1_cmd" "es_doblock zero_race/Santa/Fly"
"skill1_sfx" "0"
"ultimate_cooldown" "1"
From zero_race/es_Santa.txt (code for this effect was ripped off the dragon fly)
Code:
block Fly
{
es es_xgetplayerlocation wcs_x2 wcs_y2 wcs_z2 server_var(wcs_userid)
es_math wcs_z2 + 20
es est_effect 10 #a 0 vgui/gfx/vgui/cs_logo.vmt server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2) 80 90 1.6 10 10 0 255 0 0 255 1
es est_effect 10 #a 0.2 vgui/gfx/vgui/cs_logo.vmt server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2) 80 90 1.6 5 10 0 255 255 255 255 1
es_math wcs_z2 + 20
es est_effect 10 #a 0.4 vgui/gfx/vgui/cs_logo.vmt server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2) 80 90 1.6 10 10 0 255 0 0 255 1
es est_effect 10 #a 0.6 vgui/gfx/vgui/cs_logo.vmt server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2) 80 90 1.6 5 10 0 255 255 255 255 1
es_math wcs_z2 + 20
es est_effect 10 #a 0.8 vgui/gfx/vgui/cs_logo.vmt server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2) 80 90 1.6 10 10 0 255 0 0 255 1
es est_effect 10 #a 1 vgui/gfx/vgui/cs_logo.vmt server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2) 80 90 1.6 5 10 0 255 255 255 255 1
es es_xkeygetvalue Dragon_Flyer WCSuserdata server_var(wcs_userid) Dragon_Flyer
if (server_var(Dragon_Flyer) = 0) do
{
es est_playplayer server_var(wcs_userid) wcs/zero/santa/jingle_bells.wav
es es_xkeysetvalue WCSuserdata server_var(wcs_userid) Dragon_Flyer 1
es est_jetpack server_var(wcs_userid) 1
es est_speed server_var(wcs_userid) server_var(Santa_Speed)
es est_setplayercolor server_var(wcs_userid) 115 15 15 175 1
es_set entityCount 0
es_set dfly ""
es_formatv dfly "smoke_%1" entityCount
es_give server_var(wcs_userid) env_Smokestack
es est_SetEntName server_var(eventscripts_lastgive) server_var(dfly)
es_fire server_var(wcs_userid) server_var(dfly) addoutput "basespread 15"
es_fire server_var(wcs_userid) server_var(dfly) addoutput "spreadspeed 100"
es_fire server_var(wcs_userid) server_var(dfly) addoutput "speed 50"
es_fire server_var(wcs_userid) server_var(dfly) addoutput "startsize 15"
es_fire server_var(wcs_userid) server_var(dfly) addoutput "endsize 25"
es_fire server_var(wcs_userid) server_var(dfly) addoutput "rate 200"
es_fire server_var(wcs_userid) server_var(dfly) addoutput "jetlength 100"
es_fire server_var(wcs_userid) server_var(dfly) addoutput "twist 5"
es_fire server_var(wcs_userid) server_var(dfly) addoutput "SmokeMaterial particle\fire.vmt"
es_fire server_var(wcs_userid) server_var(dfly) addoutput "angles 90 90 90"
es_fire server_var(wcs_userid) server_var(dfly) addoutput "rendermode 18"
es_fire server_var(wcs_userid) server_var(dfly) addoutput "renderamt 100"
es_fire server_var(wcs_userid) server_var(dfly) addoutput "rendercolor 255 255 255"
es_fire server_var(wcs_userid) server_var(dfly) setparent !activator
es_fire server_var(wcs_userid) server_var(dfly) turnon
es_math entityCount + 1
}
if (server_var(Dragon_Flyer) = 1) do
{
es es_xkeysetvalue WCSuserdata server_var(wcs_userid) Dragon_Flyer 0
es est_jetpack server_var(wcs_userid) 0
es est_speed server_var(wcs_userid) 1
es est_setplayercolor server_var(wcs_userid) 255 225 225 255 1
es_fire server_var(wcs_userid) server_var(dfly) kill
}
}
In this code you see an example of how the logic that you copy and pasted can be simplified even without making a method:
Code:
"skill2_setting" "es_set wcs_multiplier 1.2;es_set wcs_speed 1.1|es_set wcs_multiplier 1.3;es_set wcs_speed 1.2|es_set wcs_multiplier 1.4;es_set wcs_speed 1.2|es_set wcs_multiplier 1.5;es_set wcs_speed 1.2|es_set wcs_multiplier 1.6;es_set wcs_speed 1.2|es_set wcs_multiplier 1.8;es_set wcs_speed 1.3|es_set wcs_multiplier 2.4;es_set wcs_speed 1.3|es_set wcs_multiplier 2.6;es_set wcs_speed 1.4"
"skill2_cmd" "es es_keysetvalue WCSuserdata event_var(userid) longjump server_var(wcs_multiplier);es est_speed event_var(userid) server_var(wcs_speed);wcs_getlanguage wcs_lng wcs_lng_r_longjump;es es_tell event_var(userid) #multi server_var(wcs_lng)"
"skill2_sfx" "es es_getplayerlocation wcs_x1 wcs_y1 wcs_z1 event_var(userid);es est_effect 10 #a 0 dev/ocean.vmt server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) 60 70 3 30 100 0 255 100 100 255 10"
Note how there are few if statements or calls only data being set. The least amount of code possible always needs to be used. In fact I should probably go in the next few weeks and try to clean up and overhaul a lot of this bad code so that the lag is reduced.