|
Re: ilevels and ent_create models changing after load
[Re: cro_games]
#226073
09/07/08 18:50
09/07/08 18:50
|
Joined: Jan 2005
Posts: 12 Shelby, Montana
toby2000
OP
Newbie
|
OP
Newbie
Joined: Jan 2005
Posts: 12
Shelby, Montana
|
here is the crow script- its acctually a pretty nice bird script- looks awesome- its dependent upon the players pos - also i am using the generic menu/opening screen script from aum8(i believe) and the start game opens a funciton that loads all the caracters in the begining- check after the crow script for the last_load_function - thank you
//****crow script //****modified from the serious grass script by George Pirvu
var number_of_crow = 0; // counts the number of models that are placed in the level at a certain moment
entity* crow;
var player_position1; var player_position2;
var crow_speed; var in_front; var crow_attack; var walk_speed_crow;
string crow1_mdl = <crow.MDL>; string crow2_mdl = <crow.MDL>;
function killer_crow();
action place_crow() {
crow = my; exclusive_entity; number_of_crow += 1; my.enable_detect = on; my.enable_scan= on; my.enable_entity = on; my.enable_impact = on; my.enable_trigger = on; my.trigger_range = 300; my.enable_stuck = on; my._health = 100;
drop_shadow();
my.event = killer_crow;
my.pan = random(360); vec_set (temp, my.x); temp.z -= 3000; trace_mode =ignore_me + ignore_sprites + ignore_models + use_box; my.z -= trace (my.x, temp) - (100 + random(300)); // place the crow model on the ground
while (vec_dist(player.x, my.x) < 8000) {
crow = me;
killer_crow();
//if(my._health <= 0) { crow_die(); return;} crow_speed.x = 40 * time; crow_speed.y = 0; crow_speed.z = 0; crow_speed *= time; in_front.x = my.x + 40 * cos(my.pan); in_front.y = my.y + 40 * sin(my.pan); in_front.z = my.z; while (vec_dist (player.x,my.x)<= 175) { ent_playsound(me,crow_wav,500); //PLAY_ENTSOUND(ME,crow_wav,500); walk_speed_crow.x = 80; walk_speed_crow.y = 0; walk_speed_crow.z = 0; walk_speed_crow *= time; //if(my._health <= 0) { crow_die(); return;} ent_cycle("walk",my._animdist); //PLAY_ENTSOUND(ME,crow_wav,500); my._animdist += 20 * 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 = 6; actor_turn(); force = 1; move_mode = ignore_passable + ignore_me + ignore_sprites + use_box + glide ; result = ent_move (walk_speed_crow, nullvector); //player._score += 1; killer_crow();
if (result == 0) // got stuck? { crow_speed.x *= -1; my.skill40 = my.pan; my.skill41 = 30 + random(90); while (my.pan < my.skill40 + my.skill41) { my.pan += 5 * time; ent_cycle("walk", my.skill20); my.skill20 -= 10 * time; my.skill20 %= 100; // loop move_mode = ignore_passable; ent_move (crow_speed, nullvector); wait (1); } crow_speed.x *= -1; // restore the initial speed }
/* vec_set (temp.x, my.x); temp.z -= 3000; trace_mode = ignore_me + ignore_sprites + ignore_models + use_box; my.z -= trace (my.x, temp); */
if (content(in_front) == content_solid) { my.skill40 = my.pan; my.skill41 = 30 + random(90); while (my.pan < my.skill40 + my.skill41) // rotate 30..120 degrees { my.pan += 5 * time; ent_cycle("walk", my.skill20); // play the "run" animation my.skill20 += 10 * time; my.skill20 %= 100; // loop wait (1); } }
wait(1); }
if (content(in_front) == content_solid) { my.skill40 = my.pan; my.skill41 = 30 + random(90); while (my.pan < my.skill40 + my.skill41) // rotate 30..120 degrees { my.pan += 5 * time; ent_cycle("walk", my.skill20); // play the "run" animation my.skill20 += 10 * time; my.skill20 %= 100; // loop wait (1); } } else // free to move { //if(my._health <= 0) { crow_die(); return;} ent_cycle("walk", my.skill20); // play the "run" animation my.skill20 += 10 * time; my.skill20 %= 100; // loop move_mode = ignore_passable + glide; // ignore passable entities result = ent_move (crow_speed, nullvector); if (result == 0) // got stuck? { crow_speed.x *= -1; // then reverse the movement direction my.skill40 = my.pan; my.skill41 = 30 + random(90); while (my.pan < my.skill40 + my.skill41) // rotate 30..120 degrees { my.pan += 5 * time; ent_cycle("walk", my.skill20); // play reversed "run" animation my.skill20 -= 10 * time; my.skill20 %= 100; // loop move_mode = ignore_passable; // ignore passable entities ent_move (crow_speed, nullvector); wait (1); } crow_speed.x *= -1; // restore the initial speed } if (content(in_front) == content_solid) {
my.skill40 = my.pan; my.skill41 = 30 + random(90); while (my.pan < my.skill40 + my.skill41) // rotate 30..120 degrees { ent_cycle("walk", my.skill20); // play the "run" animation my.skill20 += 10 * time; my.skill20 %= 100; // loop my.pan += 5 * time; wait (1); } } } wait (1);
}
while (vec_dist(player.x, my.x) < 8000) { my.alpha = min (100, (10000 / (vec_dist(player.x, my.x)))); wait (1); }
ent_remove (my); number_of_crow -= 1; // killer_crow(); }
function generate_crow() { while (player == null) {wait (1);} while (1) { while (player == null) {wait (1);} while (freeze_mode == 1) {wait(1);} vec_set (temp.x, player.x); temp.x += 4000 - random(8000); vec_set (temp.y, player.y); temp.y += 4000 - random(8000); temp.z = player.z + 200; if ((abs(temp.x - player.x) > 500 ) || (abs(temp.y - player.y) > 500 )) { // increase the nexus if you want to have more than 280 crow at once
if (number_of_crow < 100) { if (random(1) > 0.5) { ent_create (crow1_mdl, temp.x, place_crow); } else { ent_create (crow2_mdl, temp.x, place_crow); } } }
wait (1);
} }
function killer_crow {
my.enable_entity = on; my.enable_impact = on; my.enable_trigger = on; my.trigger_range = 500; my = crow; // = my;
if (event_type == event_impact && you == player) { player._health -= 1; feather_gib(5); vec_to_angle(player.pan, bounce); feather_gib(5); } if (event_type == event_trigger && you == player) { ent_playsound(me,crow_wav,500); }
}
//***** last load funtion //***** load all the npc into game
function last_load_func() {
camera_dist[0] =125; camera_dist[1] = -35; camera_dist[2] = -40;
game_started = 1;
barn_max = 5; barn_number = 0; flight_level = 1;
temp_baron_dies = 0;
number_of_barn = 0; number_of_tree = 0; number_of_grass = 0; number_of_straw = 0; number_of_windmill = 0; number_of_sheep = 0; number_of_crow = 0;
wait(1);
randomize(); generate_barn(); generate_tree(); generate_grass(); generate_straw(); generate_windmill(); generate_sheep(); generate_crow(); show_panels(); toggle_fog();
run_panels();
STOP_SOUND enghandle; wait(1); enghandle = 0;
}
there are many other things that are going on in my script but perhaps this will be a good start- thanks again for any help
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|