OSP Code Combat Exploding fire (balls) box (troy)

正在查看此主题的用户

builder of the gods

Sergeant at Arms
Working troy fire balls

inspiration

images


IT al works just one little problem i aint got no model for it anybody who has an idea better than using a FACKING BOX please pm me its very important to get a good model for this

But well atleast the code is all fine this works as a scene prop with gravity (rolls of hill)
and when shot it explodes also explodes when very close to enemy agent

at the moment the defenders and player ar not affected in code i told how to change that.
have fun with it!

module_scene_props
插入代码块:
("fire_ball",sokf_destructible|sokf_moveable|spr_hit_points(1),"barrel","bo_barrel", 
   [ # mesh not right yet
   (ti_on_init_scene_prop,
    [
		(store_trigger_param_1, ":instance_no"),
		(scene_prop_set_hit_points, ":instance_no", 1),
    ]),
	
   (ti_on_scene_prop_hit,
    [
      (store_trigger_param_1, ":instance_no"),       
      (store_trigger_param_2, ":damage"),
      
      (try_begin),
        (scene_prop_get_hit_points, ":hit_points", ":instance_no"),
        (val_sub, ":hit_points", ":damage"),
        (gt, ":hit_points", 0),
        (play_sound, "snd_dummy_hit"),
      (else_try),
        (neg|multiplayer_is_server),
        (play_sound, "snd_dummy_destroyed"),
      (try_end),

      (try_begin),
        (this_or_next|multiplayer_is_server),
		(neg|game_in_multiplayer_mode),

        (particle_system_burst, "psys_dummy_smoke", pos1, 3),
        (particle_system_burst, "psys_dummy_straw", pos1, 10),
      (try_end),      
    ]),
     
   (ti_on_scene_prop_destroy,
    [
      (play_sound, "snd_dummy_destroyed"),
      
      (assign, ":rotate_side", 86),
      
      (try_begin),
        (this_or_next|multiplayer_is_server),
		(neg|game_in_multiplayer_mode),

        (store_trigger_param_1, ":instance_no"),      
        (store_trigger_param_2, ":attacker_agent_no"),

        (set_fixed_point_multiplier, 100),
        (prop_instance_get_position, pos1, ":instance_no"),

        (try_begin),
          (ge, ":attacker_agent_no", 0),
          (agent_get_position, pos2, ":attacker_agent_no"),
          (try_begin),
            (position_is_behind_position, pos2, pos1),
            (val_mul, ":rotate_side", -1),
          (try_end),
        (try_end),
      
        (init_position, pos3),

        (try_begin),
          (ge, ":rotate_side", 0),
          (position_move_y, pos3, -100),
        (else_try),
          (position_move_y, pos3, 100),
        (try_end),
      
        (position_move_x, pos3, -50),
        (position_transform_position_to_parent, pos4, pos1, pos3),
        (position_move_z, pos4, 100),
        (position_get_distance_to_ground_level, ":height_to_terrain", pos4),
        (val_sub, ":height_to_terrain", 100),
        (assign, ":z_difference", ":height_to_terrain"),
        (val_div, ":z_difference", 3),

        (try_begin),
          (ge, ":rotate_side", 0),
          (val_add, ":rotate_side", ":z_difference"),
        (else_try),
          (val_sub, ":rotate_side", ":z_difference"),
        (try_end),

        (position_rotate_x, pos1, ":rotate_side"),
		(particle_system_burst, "psys_greek_fire", pos1, 10000),
	    (try_for_agents,":agent"), # search all agents
			(agent_is_alive,":agent"), # exclude dead agents
			#(agent_is_human,":agent"),  # exclude not human agents (for race mods)
			(get_player_agent_no, ":player_agent"),        
			(neq,":agent",":player_agent"), # exclude player comment out if not wanted
            (agent_get_team, ":agent_team", ":agent"),
			(this_or_next|neq, ":agent_team", "$defender_team"), # exclude defenders
			(neq, ":agent_team", "$defender_team_2"), # exclude defenders 2
			(agent_get_position,pos7,":agent"), # store agents position pos7
			(get_distance_between_positions,":dist",pos1,pos7), #store distance troop and prop
			(lt,":dist",500), # before working hit should be before 500 meters distance
			(agent_play_sound,":agent","snd_man_die"), # play sound dieing man
			(store_agent_hit_points, ":cur_hit_points",":agent",1), # store hit points from remaining agents
			(val_sub,":cur_hit_points",25), # substract 25 hit points
			(agent_set_hit_points,":agent",":cur_hit_points",1), # set hit points to 1
			
			(agent_deliver_damage_to_agent,":player_agent",":agent",150), # deliver damage so troop dies
		(try_end),
        (prop_instance_animate_to_position, ":instance_no", pos1, 70), #animate to position 1 in 0.7 second
      (try_end),
    ]), 
  ]),

module_mission_templates (imp add common in every template you want it to work)
插入代码块:
common_check_fire_ball_hit = (
 0, 0, 0, [],
  [
      (try_for_agents,":agent"), # search all agents
		(agent_is_alive,":agent"), # exclude dead agents
		(agent_is_human,":agent"),  # exclude not human agents (for more race mod)
		(agent_get_team, ":agent_team", ":agent"),
		(this_or_next|neq, ":agent_team", "$defender_team"),
		(eq, ":agent_team", "$defender_team_2"),
		(get_player_agent_no, ":player_agent"),  
        (agent_get_position,pos3,":agent"), # store missile_hit position pos3
		(prop_instance_get_position, pos1, "spr_fire_ball"),
	    (get_distance_between_positions,":dist",pos1,pos3), #store distance shooter and troop_got_hit
	    (lt,":dist",50), # before working hit should be before 50 meters distance
		(scene_prop_get_num_instances, ":max", "spr_fire_ball"),
		(try_for_range, ":prop", 0, ":max"),
	    (scene_prop_get_instance, ":instance", "spr_fireball", ":prop"),
	    (prop_instance_receive_damage, ":instance", ":player_agent", 1000),
	  (try_end),
    ])



Okay for modders only i first tried to implent it as a deployable item working similar to a deployable pavise shield but wouldn't work for bots but well here is the unfinished code
module_mission_templates
插入代码块:
common_troy_fire_ball = (
 0, 0, 0, [],
   [
     (try_for_agents,":agent"), # search all agents
	  (agent_is_alive,":agent"), # exclude dead agents
	  (agent_is_human,":agent"),  # exclude not human agents (for more race mod)
	  (agent_get_team, ":agent_team", ":agent"),
	  #(this_or_next|eq, ":agent_team", "$defender_team"),
      #(eq, ":agent_team", "$defender_team_2"),
      (agent_get_wielded_item, ":wielded_item", ":agent", 1),
	  (eq, ":wielded_item", "itm_fire_ball"),
	  (agent_get_position, pos2, ":agent"),
      (key_clicked, key_p),
      (position_move_y, pos2, 50),
      (set_spawn_position, pos2),
      (spawn_scene_prop, "spr_fire_ball"),
      (agent_unequip_item, ":agent", "itm_fire_ball"),
     (try_end),
     ])

you will need an item with name fire ball to but that should'nt be that hard to make.
 
I don't suppose you could post a video of what it looks like right now, could you? I think it sounds like a really neat idea!
 
Mandible 说:
I don't suppose you could post a video of what it looks like right now, could you? I think it sounds like a really neat idea!
I will do that tonight
Looks pretty good but i really need a better model
 
Will this work for a giant crossbow or even a crossbow that shoots rocks. 
Speaking of those; wonder if we can make walls be destroyable objects. 
 
formergamer 说:
Will this work for a giant crossbow or even a crossbow that shoots rocks. 
Speaking of those; wonder if we can make walls be destroyable objects.
You could use a ti on scene prop hit trigger, then move the old wall under the ground and let a new damaged model come up i guess
 
后退
顶部 底部