Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- case "idle":
- {
- var search = false;
- if(npc_heat < 25){state="cold";update_count=0;}else{search=true}
- if(npc_heat > 75){state="hot";update_count=0;}else{search=true}
- if(npc_food < 60){state="hungry";update_count=0;}else{search=true}
- if(npc_thirst < 60){state="thirsty";update_count=0;}else{search=true}
- if(npc_anger > 25){state="angry";update_count=0;}else{search=true}
- if(npc_fear > 25){state="scared";update_count=0;}else{search=true}
- if(search){
- if ( ai_reproduce_cd <= 0 ){
- inst = collision_circle(x,y,1300,obj_npc_wolf,false,true);if ( inst == noone ){path_point[0]=0;path_point[1]=0;}
- if ( inst != noone ){
- if ( point_distance(x,y,inst.x,inst.y) < 1400 ){path_point[0]=floor(inst.x/16)*16;path_point[1]=floor(inst.y/16)*16;}else{path_point[0]=0;path_point[1]=0;}}
- if ( !ai_path_set ){ai_path_set=true;
- if ( path_point[0] != 0 && path_point[1] != 0 ){
- ai_test_path=mp_grid_path(global.pathing_grid,ai_path_id,x,y,path_point[0],path_point[1],true);
- if(ai_test_path){path_start(ai_path_id,v_speed/2,0,true);}else{
- ai_test_path=mp_grid_path(global.pathing_grid,ai_path_id,x,y,path_point[0],path_point[1],true);
- if(ai_test_path){path_start(ai_path_id,v_speed/2,0,true);}else{
- ai_test_path=mp_grid_path(global.pathing_grid,ai_path_id,x,y,path_point[0],path_point[1],true);
- if(ai_test_path){path_start(ai_path_id,v_speed/2,0,true);}else{
- ai_test_path=mp_grid_path(global.pathing_grid,ai_path_id,x,y,path_point[0],path_point[1],true);
- if(ai_test_path){path_start(ai_path_id,v_speed/2,0,true);}}}}
- }else{
- move_dir=random_range(move_dir-(30*ai_expand_search),move_dir+(30*ai_expand_search));ai_path_set=true;ai_dir = point_direction(x,y,x+lengthdir_x(200,move_dir),y+lengthdir_y(200,move_dir));
- ai_test_path=mp_grid_path(global.pathing_grid,ai_path_id,x,y,x+lengthdir_x(200,move_dir),y+lengthdir_y(200,move_dir),true);ai_expand_search=1;
- if(ai_test_path){path_start(ai_path_id,v_speed/1.5,0,true);}else{ai_expand_search+=0.25;}
- }}else{
- update_count++;
- if(30 <= update_count){update_count=0;ai_path_set=false;}}
- inst = collision_circle(x,y,32,obj_npc_wolf,false,true);
- if ( inst != noone ){state="reproduce";update_count=0;path_end();ai_path_set=false;inst_cache=inst;}
- }else{
- if ( !ai_path_set ){ai_path_set=true;
- move_dir=random_range(move_dir-(30*ai_expand_search),move_dir+(30*ai_expand_search));ai_path_set=true;ai_dir = point_direction(x,y,x+lengthdir_x(200,move_dir),y+lengthdir_y(200,move_dir));
- ai_test_path=mp_grid_path(global.pathing_grid,ai_path_id,x,y,x+lengthdir_x(200,move_dir),y+lengthdir_y(200,move_dir),true);ai_expand_search=1;
- if(ai_test_path){path_start(ai_path_id,v_speed/2,0,true);}else{ai_expand_search+=0.25;}}
- update_count++;
- if(15 == update_count){update_count=0;ai_path_set=false;}}
- }
- break;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement