一些脚本。。。
我来这给大家分享一些C-script脚本。。。1)
//太阳的LENS FLARE
var flare_dist = 0;
ACTION flare_ok
{
MY.FLARE = ON;
MY.BRIGHT = ON;
MY.ALPHA = 40;
WHILE (1)
{
flare_dist = vec_dist(PLAYER.X, MY.X) - 168;
IF (flare_dist > 325)
{
flare_dist = 325;
}
MY.SCALE_X = (flare_dist / 500 + 0.1);
MY.SCALE_Y = (flare_dist / 500 + 0.1);
IF (flare_dist < -40)
{
SET MY.INVISIBLE, ON;
}
ELSE
{
SET MY.INVISIBLE, OFF;
}
WAIT 1;
}
} 2)弓箭
function dark_particle()
{
MY_COLOR.RED = 128;
MY_COLOR.BLUE = 128;
MY.COLOR.GREEN = 32;
MY_ACTION hurt_me;
//particle_scatter();
}
ACTION hurt_me
{
if(EVENT_TYPE = EVENT_IMPACT) {your._HEALTH -= 10;}
}
//arrow action
function arrow()
{
WAIT(1);
MY._current_arrows -= 1;
WHILE (my._firing == ON)
{
MY.X += 1;
MY.LIGHTRED = 128;
MY.LIGHTGREEN = 32;
MY.LIGHTBLUE = 128;
EMIT(200,my.x,dark_particle();
WAITT(1);
if(EVENT_TYPE == EVENT_IMPACT && YOU != player)
{YOUR._HEALTH -= 5; MY._firing = OFF;REMOVE ME;
}
}
} 3)近距离攻击
/////////////////////////////////////////////////
define ud_wait,0;
define ud_attack,1;
define ud_approach,2;
define ud_die,4;
define body,skill29;
define undead,0;
define flesh,1;
define metal,2;
define _verts,skill36;
function body_hit_effect()
{
if(your.body == undead){ effect(particle_undead,1,target,nullvector);}
if(your.body == flesh){ effect(particle_blood,1,target,nullvector);}
if(your.body == metal){ effect(particle_metal,1,target,nullvector);}
}
function body_die_effect()
{
temp = random(my._verts);
ent_vertex(temp,temp);
if(my.body == undead){ effect(particle_undead,1,temp,nullvector);}
if(my.body == flesh){ effect(particle_blood,1,temp,nullvector);}
if(my.body == metal){ effect(particle_metal,1,temp,nullvector);}
}
bmap blood_map = <blood.tga>;
bmap undead_map = <undead.bmp>;
function vec_blood(&vec)
{
vec = random(2) -1;
vec = random(2) -1;
vec = random(2) -1;
}
function func_fadeout()
{
my.alpha -= my.skill_x * time;
my.size += my.skill_y * time;
if(my.alpha < 0) { my.lifespan = 0; }
}
function particle_blood
{
vec_blood(temp);
vec_set(my.vel_x,temp);
my.move = on;
my.flare = on;
my.size = 20;
my.alpha = 25;
my.bmap = blood_map;
my.lifespan = 100;
my.skill_x = 1;
my.gravity = 0;
my.function = fade_func;
}
function particle_undead
{
vec_blood(temp);
vec_set(my.vel_x,temp);
my.move = on;
my.flare = on;
my.size = 20;
my.alpha = 50;
my.bmap = undead_map;
my.lifespan = 100;
my.skill_x = 2;
my.gravity = 0;
my.function = fade_func;
}
function particle_metal()
{
vec_fountain(temp);
vec_set(my.vel_x,temp); //set the velocity
my.lifespan = 50;
my.flare = on; //flare transparency
my.bright = on; //glowing effect
my.move = on; //move according to vel_x, vel_y, and vel_z
my.streak = on; //new streak effect
my.bmap = orange_map;
my.gravity = 3;
my.alpha = 50;
my.size = 10;
my.function = particle_alpha_fade;
}
function undead_init()
{
my.enable_shoot = on;
my.enable_scan = on;
my.enable_detect = on;
my.body = undead;
}
function undead_event()
{
if(my._health <= 0) { undead_die(); }
}
function undead_die()
{
my._state = ud_wait;
my._animdist = 0;
my.event = null;
my.enable_shoot = off;
my.enable_scan = off;
my.transparent = on;
my.bright = on;
my.alpha = 100;
while(my._animdist <= 100) {
ent_frame("death",my._animdist);
my._animdist += 7 * time;
wait(1);}
my.passable = on;
wait(20);
while(my.alpha > 0)
{
body_die_effect();
my.alpha -= time * 5;
my.z -= time * 0.5;
wait(1);
}
ent_remove(my);
}
action skeleton
{
wait(1);
undead_init();
my.skill30 = 291; //vertex # at hilt
my.skill31 = 300; //vertex # at point of blade
my._verts = 324; //# of verts in the model
my._health = 10; //starting health
my.event = undead_event;
my._state = ud_wait;
undead_wait();
}
function undead_wait()
{
my._state = ud_wait;
my._animdist = 0;
while(my._state == ud_wait)
{
if(my._health <= 0) { undead_die(); return;}
ent_cycle("stand",my._animdist);
my._animdist += 5 * time;
if(my._animdist >= 100) { my._animdist -= 100; }
force = 0;
actor_move();
if(vec_dist(player.x,my.x) <= 1000) {
undead_approach();}
wait(1);
}
}
function undead_approach()
{
my._state = ud_approach;
my._animdist = 0;
while(my._state == ud_approach && vec_dist(player.x,my.x) > 45)
{
if(my._health <= 0) { undead_die(); return;}
ent_cycle("run",my._animdist);
my._animdist += 5 * time;
if(my._animdist >= 100) { my._animdist -= 100; }
temp.x = player.x - my.x;
temp.y = player.y - my.y;
temp.z = player.z - my.z;
vec_to_angle(my_angle,temp);
force = 3;
actor_turn();
force = 3;
actor_move();
wait(1);
}
undead_attack();
}
function undead_attack()
{
my._state = ud_attack;
my._animdist = 0;
while(my._state == ud_attack && vec_dist(player.x,my.x) < 50)
{
my._animdist = 0;
while(my._animdist <= 100) {
if(my._health <= 0) { undead_die(); return;}
ent_frame("attack",my._animdist);
my._animdist += 15 * time;
//
ent_vertex(p,my.skill30);
ent_vertex(p2,my.skill31);
trace_mode = IGNORE_ME + IGNORE_PASSABLE + ACTIVATE_SHOOT;
trace(p2,p);
if(YOU != NULL) {
your._health -= 1;
body_hit_effect();}
//
wait(1);}
/* ent_vertex(p,my.skill30);
ent_vertex(p2,my.skill31);
trace_mode = IGNORE_ME + IGNORE_PASSABLE + ACTIVATE_SHOOT;
trace(p2,p);
if(YOU != NULL) {
your._health -= 10;
body_hit_effect();}
wait(1);*/
my._animdist = 0;
while(my._animdist <= 100) {
if(my._health <= 0) { undead_die(); return;}
ent_frame("recoil",my._animdist);
my._animdist += 20 * time;
//
ent_vertex(p,my.skill30);
ent_vertex(p2,my.skill31);
trace_mode = IGNORE_ME + IGNORE_PASSABLE + ACTIVATE_SHOOT;
trace(p2,p);
if(YOU != NULL) {
your._health -= 1;
body_hit_effect();}
//
wait(1);}
wait(1);
}
undead_approach();
}
function add_health()
{
your._health += my.skill3;
if(your._health > 100){your._health = 100;}
effect(particle_health,10,my.x,nullvector);
ent_remove(my);
}
action health_vial
{
my.transparent = on;
my.bright = on;
my.alpha = 100;
my.enable_push = on;
my.event = add_health;
my.skill1 = random(360);
my.skill2 = my.z;
my.skill3 = 10;
my.push = -10;
while(1)
{
my.skill1 += time * 10;
my.z = my.skill2 + sin(my.skill1 * 2);
wait(1);
}
} 4)游泳
var current_breath_time = 10; //seconds
var max_breath_time = 10; //seconds (short for example)
var drowning_flag = OFF; // Not curretnly drowning
var underwater_check; // used to hold camera content var
SOUND ahh_wav = <ahh.wav>; // sound when damaged
// temporary action to assign to the swimming character
ACTION swimmer
{
//player = ME;
my._health = 100;
underwater_function(); //Check to see if player is underwater (always running)
player_walk();
}
// This shows the amount of seconds left the character
// can hold his or her breath
// It should be replaced with a real panel
panel breath_remaining_panel
{
pos_x = 10;
pos_y = 20;
LAYER = 2;
FLAGS = D3D,refresh,visible;
DIGITS 10,20,3,standard_font,1,current_breath_time;
DIGITS 50,20,3,standard_font,1,player._health;
}
// This function is called when the character has run out of air while underwater
FUNCTION drowning()
{
while (underwater_check == content_passable) // as long as the player is underwater
{
drowning_flag = ON; // is currently drowning
my._health -= 10; //subtract health (change this)
PLAY_SOUND ahh_wav, 25; // that doesn't feel good
waitt(32); //two seconds before reducing health again
if (my._health <= 0 ) // If health is gone
{
// code to kill the player here
// I'll just do a simple template tip and then exit
msg.string = ("You have drowned!");
show_message();
player_tip(); // kock the character over
waitt(64);
game_exit(); // kicks you out of the game
}
}
drowning_flag = OFF; // Not underwater anymore, so not drowning
current_breath_time = max_breath_time; // Not underwater, so can breath again
//PLAY_SOUND big_gasp_wav, 75; // add your own big gasp sound
}
// This function runs all the time and checks to see if the character is in a
// passable block, which means he or she is underwater
FUNCTION underwater_function()
{
while (player == null) { wait(1); } // wait until there is a player
while(1) // run forever -- endless loop
{
// set the contents of camera.x to a var
underwater_check = content(camera.x);
// While the character is underwater...
while (underwater_check == content_passable)
{
underwater_check = content(camera.x); // set it again
// while the player still has some air
while ( (current_breath_time >= 1) && (underwater_check == content_passable) )
{
underwater_check = content(camera.x); // set it again
current_breath_time -= 1; // the character starts holding his or her breath
waitt(16); //wait a second before decreasing breath time
}
// if the character is out of breath
// and hasn't started to drown yet
if ( (current_breath_time <=0) && (drowning_flag == OFF) )
{
drowning();
} // No more air; player starts to drown
// if the character surfaced
if (underwater_check != content_passable)
{
// came up for air, for play a gasp sound
//PLAY_SOUND small_gasp_wav, 50; }
current_breath_time = max_breath_time; // replenish air
}
wait(1);
}
wait(1);
}
} 5)草
var gresult=0;
var grassmode=0; // 0= no grass 1= grass
var scandist=10,10,10;//xyz coord higher means more grass
// depressed when walked on
var grdist=2; // should equal value of x in scandist
var anim=0;
var counter_x=0;
var counter_y=0;
var grass_vec=0,0,0;
var grass_ang=0,0,0;
var counter2=0;
function grass(){ // area in quants of the patch of grass
vec_set(grass_vec,my.x);
grass_vec.y=my.y;
while(counter_x< &&,grass_vec,grassact);
counter2+=1;
grass_vec.y+=my.skill4;
counter_y+=my.skill4;
//grass_ang.tilt= random (3);
//grass_ang.roll= random (3);
//grass_ang.pan= random (3);
//vec_set(you.roll,grass_ang);
//vec_set(you.tilt,grass_ang);
//vec_set(you.pan,grass_ang);
}
counter_y=0;
counter_x+=my.skill3/my.skill1;
grass_vec.y=my.y;
grass_vec.x+=my.skill3;
wait(1);
}
}
action grassemit
{
my.passable=on;
my.invisible=on;
grass();
}
var tracevec;
var result;
action grassact{
my.transparent=on;
my.passable=on;
tracevec.x=my.x;
tracevec.y=my.y;
tracevec.z=-50000;
trace_mode=ignore_me;
result=trace(my.z,tracevec);
while(my.z>result){
my.z-=1;
wait(1);
}
} 6)血
//需要一个血的图命名为blood.bmp
bmap blood_map = <blood.bmp>;
function fade_func()
{
my.alpha -= my.skill_x * time;
if(my.alpha < 0) { my.lifespan = 0; }
}
function vec_blood(&vec)
{
vec = random(20)-10;
vec = random(20)-10;
vec = random(20)+10;
}
function particle_blood
{
vec_blood(temp);
vec_set(my.vel_x,temp);
my.move = on;
my.streak = on;
my.flare = on;
my.size = 10;
my.alpha = 65;
my.bmap = blood_map;
my.lifespan = 35;
my.skill_x = 2;
my.gravity = 6;
my.function = fade_func;
}
function _body_gib_action()
{
// zähle die Teile um den actor_scale-Betrag herunter
if (gibnow >= gibmax) { ent_remove(my); end; }
gibnow += 1;
vec_scale(my.SCALE_x,actor_scale);
my.enable_block = on;
// Init gib bit
my._speed_x = 15 * (RANDOM(10) - 5); // -125 -> +125
my._speed_y = 15 * (RANDOM(10) - 5); // -125 -> +125
my._speed_z = RANDOM(35) + 15; // 15 -> 50
my._aspeed_pan = RANDOM(35) + 5; // 35 -> 70
my._aspeed_tilt = RANDOM(35) + 5; // 35 -> 70
my._aspeed_roll = RANDOM(35) + 5; // 35 -> 70
my._force = 0;
my.roll = RANDOM(180); // starte mit einer zufälligen Ausrichtung
my.pan = RANDOM(180);
my._force = -2;
my.push = -1; // ermögliche es dem Anwender/allowFeind, hindurchzugegen
abspeed = 5 * my._speed_x;
abspeed = 5 * my._speed_y;
abspeed = my._speed_z * time * 5;
move(me,nullskill,abspeed); //bewege sie vom Ausgangspunkt weg, damit
// wir keine treibennde Blutflecken bekommmen
// Animiere Einzelteile
my.skill9 = 50;
while(my.skill9 > -75)
{
abspeed = my._speed_x * time;
abspeed = my._speed_y * time;
abspeed = my._speed_z * time;
my.pan += my._aspeed_pan * time;
my.tilt += my._aspeed_tilt * time;
my.roll += my._aspeed_roll * time;
vec_scale(absdist,movement_scale); // skaliere den Absolutabstand durch
// movement_scale
move(me,nullskill,abspeed);
effect(particle_blood,bloodlevel * time,my.x,nullskill);
if(bounce.z)
{
create(<blooda.bmp>,my.x,blood_spat);
my._speed_z = -(my._speed_z/2);
if(my._speed_z < 0.25)
{
my._speed_x = 0;
my._speed_y = 0;
my._speed_z = 0;
my._aspeed_pan = 0;
my._aspeed_tilt = 0;
my._aspeed_roll = 0;
}
gibvar = bloodlevel * splatlevel;
effect(particle_blood,gibvar * time,my.x,nullskill);
// my.skill9 -= 100;
}
my._speed_z -= 2;
my.skill9 -= 1;
wait(1);
}
my.passable = on;
// ausblenden
my.transparent = on;
my.alpha = 100;
while(1)
{
my.alpha -= 5*time;
if(my.alpha <=0)
{
// entfernen
gibnow -= 1;
ent_remove(my);
return;
}
wait(1);
}
}
function blood_spat()
{
scan_sector.pan = 360;
scan_sector.roll = 360;
scan_sector.tilt = 360;
my_angle.pan = my.pan;
my_angle.tilt = my.tilt;
scan(my.x,my_angle,scan_sector);
if(bullet_hole_counter <= kmaxbullethole && you != player)
{
bullet_hole_counter += 1; // inc bullet hole counter
my.transparent = on;
my.passable = on;
my.oriented = on;
vec_to_angle(my.pan,normal); // dreht sich zur Zielnormalen
waitt(160); // Lebensdauer des Blutes, bevor es verschwindet.
// warte einen festgelegte Zeit mit waitt(160), besser,
// als 160 Frames wait(160)
while(my.alpha > 0) // fade out
{
my.alpha -= time;
waitt(1);
}
bullet_hole_counter -= 1; // verringere bullet hole counter
ent_remove(my);
}
else
{
ent_remove(my);
}
} 7)天气
//需要自备很多图
DEFINE weather_rain = 1; //Regen
DEFINE weather_storm = 2; //Gewitter
DEFINE weather_snow = 3; //Schnee
define rain_fog = 50;
define sky_color_rain = 80;
define snow_fog = 40;
var weather;
var weather_strength;
var weather_timer;
var weather_mem;
var distance;
var mypos;
var myangle;
var night;
var act_weather = 9;
bmap slider = <slider.pcx>;
bmap slider_background = <slider_b.pcx>;
bmap akt_w = <akt_w.pcx>;
string empty_str = " ";
string fog_str = "CAMERA.FOG =";
string rain_str = "RAIN PARTICLE =";
string snow_str = "SNOW PARTICLE =";
TEXT panel_txt {
POS_X = 0;
POS_Y = 60;
FONT = standard_font;
STRING = empty_str;
}
PANEL fog_panel {
POS_X = 10;
POS_Y = 35;
BMAP slider_background;
DIGITS 065,25,3,standard_font,1,camera.fog;
HSLIDER 0,0,100,slider,0,100,camera.fog;
FLAGS= refresh,overlay;
}
PANEL weather_particel_panel {
POS_X = 10;
POS_Y = 35;
BMAP slider_background;
DIGITS 80,25,3,standard_font,1,weather_strength;
HSLIDER 0,0,100,slider,0,100,weather_strength;
FLAGS= refresh,overlay;
}
BMAP sky = <sky.pcx>;
BMAP sky_light = <sky_light.pcx>;
BMAP sky_light2 = <sky_light2.pcx>;
BMAP cloud =<cloud.pcx>;
BMAP sky_day = <sky_day.pcx>;
BMAP cloud_day =<cloud_d.pcx>;
BMAP drop = <drop.pcx>;
BMAP snow = <snow.pcx>;
BMAP raining = <rain.pcx>;
BMAP snowing = <snowfall.pcx>;
BMAP day = <day.pcx>;
BMAP night_p = <night.pcx>;
BMAP th_storm= <thstorm.pcx>;
BMAP fog_p = <fog.pcx>;
BMAP lightn = <lightn.pcx>;
BMAP tornado = <tor_ic.pcx>;
BMAP fog_sky = <fog_sky.pcx>;
PANEL weather_panel {
POS_X = 30;
POS_Y = 440;
BUTTON 0,0,snowing,snowing,snowing,start_snow,null,null;
BUTTON 40,0,raining,raining,raining,start_rain,null,null;
BUTTON 80,0,th_storm,th_storm,th_storm,start_storm,null,null;
BUTTON 120,0,fog_p,fog_p,fog_p,start_fog,null,null;
BUTTON 160,0,lightn,lightn,lightn,lightning,null,null;
BUTTON 200,0,day,day,day,set_day,null,null;
BUTTON 240,0,night_p,night_p,night_p,set_night,null,null;
BUTTON 280,0,tornado,tornado,tornado,null,null,null;
flags = refresh;
}
PANEL act_weather_panel {
POS_X = 26;
POS_Y = 436;
hbar 0,0,320,akt_w,40,act_weather;
flags = refresh,transparent;
}
SOUND thunder = <thunder.wav>;
SOUND rain = <rain.wav>;
#'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
# Schnee
#'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
function stop_snow;
function start_snow ()
{
if (weather == weather_snow)
{
weather_particel_panel.visible = off;
fog_panel.visible = off;
panel_txt.string = empty_str;
act_weather = 9;
stop_snow ();
return;
}
if (weather == weather_rain || weather == weather_storm) {return;}
act_weather = 0;
weather_particel_panel.visible = on;
fog_panel.visible = off;
panel_txt.string = snow_str;
let_it_snow ();
}
function let_it_snow ()
{
if (weather == weather_snow) {stop_snow (); return;}
if (weather == weather_rain || weather == weather_storm) {return;}
weather = weather_snow;
weather_strength = 80;
snow_akt ();
if (night == 0)
{
fog_color = 1;
camera.fog = snow_fog;
}
}
function stop_snow ()
{
if (night == 0)
{
camera.fog = 0;
fog_color = 0;
}
weather = 0;
}
function snow_eff ()
{
my.bmap = snow;
my.lifespan = 40;
my.x += random(1000)-500;
my.y += random(1000)-500;
my.z += random(100)-50;
my.move = on;
my.flare = on;
my.vel_x = random(16)-8;
my.vel_y = random(16)-8;
my.vel_z = -6;
my.function = null;
}
function snow_akt ()
{
WHILE (weather == weather_snow)
{
set_cam_pos ();
distance = 200;
set_pos ();
MyPos.Z = CAMERA.Z + 150;
effect (snow_eff,weather_strength,MyPos,nullskill);
wait (3);
}
}
#'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
# Regen
#'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
function stop_rain;
function start_rain ()
{
if (weather == weather_rain)
{
stop_rain ();
weather_particel_panel.visible = off;
fog_panel.visible = off;
panel_txt.string = empty_str;
act_weather = 9;
return;
}
if (weather == weather_snow || weather == weather_storm) {return;}
act_weather = 1;
weather_particel_panel.visible = on;
fog_panel.visible = off;
panel_txt.string = rain_str;
let_it_rain ();
}
functionlet_it_rain ()
{
if (weather == weather_rain) {stop_rain (); return;}
if (weather == weather_snow || weather == weather_storm) {return;}
weather = weather_rain;
play_loop (rain,30);
weather_mem = result;
weather_strength = 70;
rain_akt ();
if (night == 0)
{
fog_color = 1;
sky_color.red = sky_color_rain;
sky_color.green= sky_color_rain;
sky_color.blue = sky_color_rain;
camera.fog = rain_fog;
}
}
function stop_rain ()
{
stop_sound (weather_mem);
if (night == 0)
{
sky_color.red = 250;
sky_color.green= 250;
sky_color.blue = 250;
camera.fog = 0;
fog_color = 0;
}
weather = 0;
}
function rain_eff ()
{
my.bmap = drop;
my.lifespan = 20;
my.x += random(1000)-500;
my.y += random(1000)-500;
my.z += random(100)-50;
my.move = on;
my.flare = on;
my.vel_x = 0;
my.vel_y = 0;
my.vel_z = -40;
my.size = 8;
my.function = null;
}
function rain_akt ()
{
WHILE (weather == weather_storm || weather == weather_rain)
{
set_cam_pos ();
distance = 200;
set_pos ();
MyPos.Z = CAMERA.Z + 200;
effect (rain_eff,weather_strength,MyPos,nullskill);
wait (3);
}
}
#'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
# Gewitter
#'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
function start_storm ()
{
if (weather == weather_snow || weather == weather_rain) {return;}
if (weather == weather_storm)
{
stop_rain ();
weather_particel_panel.visible = off;
fog_panel.visible = off;
panel_txt.string = empty_str;
act_weather = 9;
return;
}
storm();
wait (1);
act_weather = 2;
weather_particel_panel.visible = on;
fog_panel.visible = off;
panel_txt.string = rain_str;
}
function storm ()
{
if (weather == weather_snow || weather == weather_rain) {return;}
if (weather == weather_storm) {stop_rain (); return;}
let_it_rain ();
weather = weather_storm;
anfang:
weather_timer = RANDOM(100)+150;
WHILE (weather_timer > 0)
{
weather_timer -= 1*time;
WAIT (1);
}
IF (weather == weather_storm)
{
lightning ();
GOTO anfang;
}
}
#'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
# Blitze
#'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
function lightning ()
{
temp = RANDOM(20);
IF (temp <=10 ) {lightning1 ();}
ELSE {lightning2 ();}
}
function lightning1 ()
{
create <blitz.pcx>,temp,lightning_ent;
play_sound (thunder,50);
SKY_MAP = sky_light;
if (night) {CAMERA.FOG -= 80;}
wait (1);
SKY_MAP = sky_light2;
if (night) {CAMERA.FOG += 30;}
wait (2);
if (night) {CAMERA.FOG += 20;}
wait (1);
SKY_MAP = sky_light;
if (night) {CAMERA.FOG -= 40;}
wait (3);
SKY_MAP = sky_light2;
if (night) {CAMERA.FOG += 30;}
wait (1);
SKY_MAP = sky;
if (night) {CAMERA.FOG += 40;}
wait (2);
SKY_MAP = sky_light2;
if (night) {CAMERA.FOG -= 30;}
wait (1);
if (night == 1) {SKY_MAP = sky;}
else {SKY_MAP = sky_day;}
if (night) {CAMERA.FOG += 30;}
}
function lightning2 ()
{
create <blitz.pcx>,temp,lightning_ent;
play_sound (thunder,50);
SKY_MAP = sky_light;
if (night) {CAMERA.FOG -= 80;}
wait (4);
SKY_MAP = sky_light2;
if (night) {CAMERA.FOG += 50;}
wait (3);;
SKY_MAP = sky_light;
if (night) {CAMERA.FOG -= 40;}
wait (2);
if (night == 1) {SKY_MAP = sky;}
else {SKY_MAP = sky_day;}
if (night) {CAMERA.FOG += 70;}
}
function lightning_ent ()
{
temp = ent_path ("lightning_path");
if (temp == 0) {goto blitz_end;}
temp.z = int(random(temp)+1);
ent_waypoint (temp,temp.z);
vec_set (my.pos,temp);
my.flare = on;
my.blend = on;
my.scale_x = 2;
my.scale_y = 5;
wait (10);
blitz_end:
remove me;
}
#'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
# NEBEL
#'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
function start_fog ()
{
if (weather != 0 || night) {return;}
if (fog_color != 3)
{
act_weather = 3;
weather_particel_panel.visible = off;
fog_panel.visible = on;
panel_txt.string = fog_str;
}
else
{
act_weather = 9;
weather_particel_panel.visible = off;
fog_panel.visible = off;
panel_txt.string = empty_str;
}
set_fog ();
}
function set_fog ()
{
if (weather != 0 || night) {return;}
if (fog_color != 3)
{
fog_color = 4;//3;
camera.fog = 50;
sky_map = fog_sky;
cloud_map = fog_sky;
}
else
{
fog_color = 0;
sky_map = sky_day;
cloud_map = cloud_day;
}
}
#'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
# TAG / NACHT
#'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
function set_day ()
{
if (night == 0) {return;}
SKY_MAP = sky_day;
CLOUD_MAP = cloud_day;
sky_color.red = 25;
sky_color.green= 25;
sky_color.blue = 25;
night = 0;
while (1)
{
sky_color.red += 25*time;
sky_color.green += 25*time;
sky_color.blue += 25*time;
camera.fog -= 5 * time;
if (weather == 0)
{
if (sky_color.red >= 250 && sky_color.green >= 250 && sky_color.blue >= 250)
{
fog_color = 0;
sky_color.red = 250;
sky_color.green = 250;
sky_color.blue = 250;
break;
}
}
if (weather == weather_snow)
{
if (sky_color.red >= 250 && sky_color.green >= 250 && sky_color.blue >= 250)
{
fog_color = 1;
camera.fog = snow_fog;
break;
}
}
if (weather == weather_rain || weather == weather_storm)
{
if (sky_color.red >= sky_color_rain && sky_color.green >= sky_color_rain && sky_color.blue >= sky_color_rain)
{
fog_color = 1;
camera.fog = rain_fog;
sky_color.red = sky_color_rain;
sky_color.green= sky_color_rain;
sky_color.blue = sky_color_rain;
break;
}
}
wait (1);
}
}
function set_night ()
{
if (night) {return;}
night = 1;
fog_color = 1;
while (1)
{
sky_color.red -= 25*time;
sky_color.green -= 25*time;
sky_color.blue -= 25*time;
camera.fog += 5 * time;
if (camera.fog > 80) {camera.fog = 80;}
if (sky_color.red <= 25) {break;}
wait (1);
}
SKY_MAP = sky;
CLOUD_MAP = cloud;
camera.fog = 80;
sky_color.red = 250;
sky_color.green= 250;
sky_color.blue = 250;
}
#'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
functionset_pos ()
{
temp.X = COS(MyAngle.PAN);
temp.Y = SIN(MyAngle.PAN);
temp.Z = distance*COS(MyAngle.TILT);
MyPos.X = MyPos.X + temp.Z*temp.X;
MyPos.Y = MyPos.Y + temp.Z*temp.Y;
MyPos.Z = MyPos.Z + distance*SIN(MyAngle.TILT);
}
function set_cam_pos ()
{
vec_set (MyPos,camera.pos);
MyAngle.PAN = CAMERA.PAN;
}
#'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
//on_1 = let_it_snow;
on_2 = let_it_rain;
//on_3 = storm;
//on_4 = set_fog;
//on_5 = lightning;
//on_6 = set_day;
//on_7 = set_night;
页:
[1]