Skip to content

Lua General Functions

Alex edited this page Jul 13, 2013 · 13 revisions

All Lua General Functions are in the global table 'eq'.

Return to the Lua API

Void load_encounter(String name);
Void unload_encounter(String name);
Void register_npc_event(String name, Integer evt, Integer npc_id, LuaFunction func);
Void unregister_npc_event(String name, Integer evt, Integer npc_id);
Void register_player_event(String name, Integer evt, LuaFunction func);
Void unregister_player_event(String name, Integer evt);
Void register_item_event(String name, Integer evt, Integer item_id, LuaFunction func);
Void unregister_item_event(String name, Integer evt, Integer item_id);
Void register_spell_event(String name, Integer evt, Integer spell_id, LuaFunction func);
Void unregister_spell_event(String name, Integer evt, Integer spell_id);
Mob spawn2(Integer npc_type, Integer grid, Integer unused, Real x, Real y, Real z, Real heading);
Mob unique_spawn(Integer npc_type, Integer grid, Integer unused, Real x, Real y, Real z, Real heading = 0.0);
Mob spawn_from_spawn2(Integer spawn2_id);
Void enable_spawn2(Integer spawn2_id);
Void disable_spawn2(Integer spawn2_id);
Void set_timer(String timer, Integer time_ms);
Void stop_timer(String timer);
Void stop_all_timers();
Void depop();
Void depop(Integer npc_type);
Void depop_with_timer();
Void depop_with_timer(Integer npc_type);
Void depop_all();
Void depop_all(Integer npc_type);
Void depop_zone(Boolean start_spawn_status);
Void repop_zone();
Boolean is_disc_tome(Integer item_id);
Void safe_move();
Void rain(Integer weather);
Void snow(Integer weather);
Integer scribe_spells(Integer max);
Integer scribe_spells(Integer max, Integer min);
Integer train_discs(Integer max);
Integer train_discs(Integer max, Integer min);
Void set_sky(Integer sky);
Void set_guild(Integer guild_id, Integer rank);
Void create_guild(String name, String leader);
Void set_time(Integer hour, Integer min);
Void signal(Integer npc_id, Integer signal_id);
Void signal(Integer npc_id, Integer signal_id, Integer wait);
Void set_global(String name, String value, Integer options, String duration);
Void target_global(String name, String value, String duration, Integer npc_id, Integer char_id, Integer zone_id);
Void delete_global(String name);
Void start(Integer wp);
Void stop();
Void pause(Integer duration);
Void move_to(Real x, Real y, Real z);
Void move_to(Real x, Real y, Real z, Real h);
Void move_to(Real x, Real y, Real z, Real h, Boolean save_guard_spot);
Void resume();
Void set_next_hp_event(Integer hp);
Void set_next_inc_hp_event(Integer hp);
Void respawn(Integer npc_type, Integer grid);
Void set_proximity(Real min_x, Real max_x, Real min_y, Real max_y);
Void set_proximity(Real min_x, Real max_x, Real min_y, Real max_y, Real min_z, Real max_z);
Void clear_proximity();
Void enable_proximity_say();
Void disable_proximity_say();
Void set_anim(Integer npc_type, Integer anim_num);
Void spawn_condition(String zone, Integer instance_id, Integer condition_id, Integer value);
Void get_spawn_condition(String zone, Integer instance_id, Integer condition_id);
Void toggle_spawn_event(Integer event_id, Boolean enable, Boolean reset);
Void summon_burried_player_corpse(Integer char_id, Real x, Real y, Real z, Real h);
Void summon_all_player_corpses(Integer char_id, Real x, Real y, Real z, Real h);
Integer get_player_burried_corpse_count(Integer char_id);
Boolean bury_player_corpse(Integer char_id);
Void task_selector(IntegerArray table);
Void task_set_selector(Integer task_set);
Void enable_task(IntegerArray table);
Void disable_task(IntegerArray table);
Boolean is_task_enabled(Integer task);
Boolean is_task_active(Integer task);
Boolean is_task_activity_active(Integer task, Integer activity);
Integer get_task_activity_done_count(Integer task, Integer activity);
Void update_task_activity(Integer task, Integer activity, Integer count);
Void reset_task_activity(Integer task, Integer activity);
Void task_explored_area(Integer explore_id);
Void assign_task(Integer task_id);
Void fail_task(Integer task_id);
Integer task_time_left(Integer task_id);
Integer is_task_completed(Integer task_id);
Integer enabled_task_count(Integer task_set);
Integer first_task_in_set(Integer task_set);
Integer last_task_in_set(Integer task_set);
Integer next_task_in_set(Integer task_set, Integer task_id);
Integer active_speak_task();
Integer active_speak_activity(Integer task_id);
Integer active_tasks_in_set(Integer task_set);
Integer completed_tasks_in_set(Integer task_set);
Boolean is_task_appropriate(Integer task);
Void popup(String title, String text, Integer id, Integer buttons, Integer duration);
Void clear_spawn_timers();
Void zone_emote(Integer type, String str);
Void world_emote(Integer type, String str);
Integer get_level(Integer type);
Void create_ground_object(Integer item_id, Real x, Real y, Real z, Real h);
Void create_ground_object(Integer item_id, Real x, Real y, Real z, Real h, Integer decay_time);
Void create_ground_object_from_model(String model, Real x, Real y, Real z, Real h);
Void create_ground_object_from_model(String model, Real x, Real y, Real z, Real h, Integer type);
Void create_ground_object_from_model(String model, Real x, Real y, Real z, Real h, Integer type, Integer decay_time);
Void create_door(String model, Real x, Real y, Real z, Real h, Integer open_type, Integer size);
Void modify_npc_stat(String id, String value);
Integer collect_items(Integer item_id, Boolean remove);
Void update_spawn_timer(Integer id, Integer new_time);
Void merchant_set_item(Integer npc_id, Integer item_id);
Void merchant_set_item(Integer npc_id, Integer item_id, Integer quantity);
Integer merchant_count_item(Integer npc_id, Integer item_id);
String item_link(Integer item_id);
Void say_link(String phrase, Boolean silent, String link_name);
String get_guild_name_by_id(Integer guild_id);
Integer create_instance(String zone, Integer version, Integer duration);
Void destroy_instance(Integer instance_id);
Integer get_instance_id(String zone, Integer version);
Void assign_to_instance(Integer instance_id);
Void assign_group_to_instance(Integer instance_id);
Void assign_raid_to_instance(Integer instance_id);
Void flag_instance_by_group_leader(Integer zone, Integer version);
Void flag_instance_by_raid_leader(Integer zone, Integer version);
Void fly_mode(Integer flymode);
Integer faction_value();
Void check_title(Integer title_set);
Void enable_title(Integer title_set);
Void remove_title(Integer title_set);
Void wear_change(Integer slot, Integer texture);
Void voice_tell(String str, Integer macro_num, Integer race_num, Integer gender_num);
Void send_mail(String to, String from, String subject, String message);
Void cross_zone_signal_client_by_char_id(Integer player_id, Integer signal);
Void cross_zone_signal_client_by_name(String player, Integer signal);
Void cross_zone_message_player_by_name(Integer type, String player, String message);
HashTable get_qglobals(NPC npc, Client client);
HashTable get_qglobals(Client client, NPC npc);
HashTable get_qglobals(Client client);
HashTable get_qglobals(NPC npc);
HashTable get_qglobals();
EntityList get_entity_list();
Integer get_zone_id();
String get_zone_long_name();
String get_zone_short_name();
Integer get_zone_instance_id();
Integer get_zone_instance_version();
Integer get_zone_weather();
HashTable get_zone_time(); -- three fields in the table returned: zone_hour, zone_minute, zone_time
Void add_area(Integer id, Integer type, Real min_x, Real max_x, Real min_y, Real max_y, Real min_z, Real max_z);
Void remove_area(Integer id);
Void clear_areas();
Void remove_spawn_point(Integer spawn2_id);
Void add_spawn_point(SpawnPointOptions table);
Void attack(String client_name);
Void attack_npc(Integer npc_entity_id);
Void attack_npc_type(Integer npc_type);
Void follow(Integer entity_id);
Void follow(Integer entity_id, Integer distance);
Void stop_follow();
Client get_initiator(); -- These three are mostly for writing modules that extend the eq namespace
Mob get_owner();
ItemInst get_quest_item();
Void map_opcodes(); -- will refresh the internal opcode dispatch
Void clear_opcode(Integer opcode); -- removes the internal opcode handler for the following opcode

SpawnPointOptions is a lua table that accepts the following values:

{
	Integer spawn2_id;
	Integer spawngroup_id;
	Real x;
	Real y;
	Real z;
	Real heading;
	Integer respawn;
	Integer variance;
	Integer timeleft;
	Integer grid;
	Integer condition_id;
	Integer condition_min_value;
	Boolean enabled;
	Integer animation;
}

The values for spawn2_id, spawngroup_id, x, y, z, heading, respawn and variance are not optional and must be included when passed to add_spawn_point or the addition will fail.

Clone this wiki locally