Crossroads
Posts: 17372
Joined: 7/5/2009 Status: offline
|
Ok, so let us get this Diary on its way. First, here's the current set of CS Event Engine functions. They're at early 1.0 BETA stage, so expect to see some changes yet. The Event Engine functions come in two major groupings: trigger functions, and action functions. Trigger functions are something the game calls upon the particular event having taken place, they all start with on_* , for instance on_next_turn(turn); or on_next_phase(turn, side). It is these functions you first provide in your scenario specific .lua files, and within them you then have the actions you want to take place at the time. They provide some parameters for you to help on determining what's going on, for instance the on_next_phase() gives you the current turn and side. Trigger functions, as they currently stand, are: on_air_attack (x, y, pid, name, side, nation, points, strength) on_next_phase (turn, side) on_next_turn (turn) on_objective_capture (x, y, value, side) on_startup () on_unit_kill (x, y, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader) on_unit_reduce (x, y, trackid, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader, loss) on_unit_reinforce (x, y, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader) on_unit_release (pid, name, side, nation, oid, orgname, points, strength, HQ, Leader) on_unit_remove (x, y, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader) Action functions, then, are the stuff you want to happen when one of the events listed above happened, and the respective function in your in your scenario specific Lua file is called . Action functions come in two flavors as well, one for getting more information from the game, and another for setting new values in place of the existing ones. On the first, say if you need more information about some particular things, you'd use some of the "getter" functions to get them. You'd then have "setter" functions to pass back to the game engine. For instance, you'd first figure out what the Ammo level is for the side your interested in by calling ammo_level(side), a "getter" function. As a parameter you provide it the side you're interested to learn about its current ammo level, and as a return value you get the said ammo level. Then you then want to set a new value for the side's ammo level, you do it calling the set_ammo_level(side, value) function, a "setter", as youd guess. There you provide the side you want to change and the new ammo value to take place. Here's the current set of functions, then: (list updated since I wrote this post) quote:
ORIGINAL: berto LUA EE FUNCTIONS ------------------------------------------------------------------------------- on_air_attack (x, y, pid, name, side, nation, points, strength) on_next_phase (turn, side) on_next_turn (turn) on_objective_capture (x, y, value, side) on_startup () on_unit_kill (x, y, trackid, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader) on_unit_reduce (x, y, trackid, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader, loss) on_unit_reinforce (x, y, trackid, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader) on_unit_release (trackid, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader) on_unit_remove (x, y, trackid, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader) adaptive_ai (side, nation, index) advantage () aggressiveness (side) ai (side) ai_index (parm) ai_parameter (index) air_support (side) ammo_level (side) arrived (id) arty_ammo_level (side) average_morale (side) counter_airlevel (trackid) counter_assault (trackid) counter_defend (trackid) counter_flags (trackid) counter_hq (trackid) counter_isairborne (trackid) counter_ishq (trackid) counter_isleader (trackid) counter_leader (trackid) counter_morale (trackid) counter_name (trackid) counter_nation (trackid) counter_oid (trackid) counter_orgname (trackid) counter_pid (trackid) counter_points (trackid) counter_side (trackid) counter_strength (trackid) counter_type (trackid) counter_x (trackid) counter_y (trackid) current_side () current_turn () current_visibility () debug (text) event_points (side) fow (side) has_flag (flags, flag) hexcoor (x, y) inc_adaptive_ai (side, nation, index, increment) inc_advantage (increment) inc_aggressiveness (side, increment) inc_air_support (side, increment) inc_ammo_level (side, increment) inc_arty_ammo_level (side, increment) inc_event_points (side, increment) inc_luav (index, value) inc_morale_shift (nation, increment) inc_reinforcement_prob (id, increment) inc_release_prob (id, increment) inc_smoke_ammo (side, increment) inc_star_shells (side, increment) isai (side) isdisrupted (trackid) isfixed (trackid) isfow (side) isisolated (trackid) islowonammo (trackid) isnight () losses (side) loss_points (side) luav (index) map_center (x, y) map_height () map_side (x, y) map_slice (x, y) map_trackid (x, y, number) map_trackid_count (x, y) map_up () map_width () map_up_half (x, y) map_low_half (x, y) map_left_half (x, y) map_right_half (x, y) map_up_left_quadrant (x, y) map_up_right_quadrant (x, y) map_low_right_quadrant (x, y) map_low_left_quadrant (x, y) map_nw_quadrant (x, y) map_ne_quadrant (x, y) map_se_quadrant (x, y) map_sw_quadrant (x, y) map_north_half (x, y) map_south_half (x, y) map_east_half (x, y) map_west_half (x, y) map_above (row, side) map_below (row, side) map_left_of (col, side) map_right_of (col, side) major_defeat () major_victory () max_ai_index () max_luav_index () message (title, string) minor_defeat () minor_victory () morale_shift (nation) next_turn () night (turn) note (title, string) objective_owner (x, y) objective_points () objective_value (x, y) other_side (side) previous_turn () random (x) reinforcement_flags (id) reinforcement_hexcoor (id) reinforcement_prob (id) reinforcement_scatter (id) reinforcement_turn (id) reinforcement_x (id) reinforcement_y (id) release_prob (id) release_turn (id) released (id) set_adaptive_ai (side, nation, index, value) set_advantage (value) set_aggressiveness (side, value) set_air_support (side, value) set_ammo_level (side, value) set_arty_ammo_level (side, value) set_event_points (side, value) set_luav (index, value) set_major_defeat (value) set_major_victory (value) set_minor_defeat (value) set_minor_victory (value) set_morale_shift (nation, value) set_objective (x, y, value, side) set_objective_owner (x, y, side) set_objective_value (x, y, value) set_reinforcement (id, x, y, turn, prob, flags, scatter) set_reinforcement_flags (id, flags) set_reinforcement_hexcoor (id, hexcoor) set_reinforcement_prob (id, prob) set_reinforcement_scatter (id, scatter) set_reinforcement_turn (id, turn) set_reinforcement_x (id, x) set_reinforcement_y (id, y) set_release (id, turn, prob) set_release_prob (id, prob) set_release_turn (id, turn) set_smoke_ammo (side, value) set_star_shells (side, value) set_victory (majordefeat, minordefeat, minorvictory, majorvictory) smoke_ammo (side) star_shells (side) strength (side) total_points () total_strength (side) x (hexcoor) y (hexcoor) -------------------------------------------------------------------------------
< Message edited by Crossroads -- 7/18/2017 3:33:27 PM >
_____________________________
|