11-29-2023, 11:19 AM
SET @npc_id = 144; -- Id of the npc you want to update
SET @char_id = 1; -- Id of the char which logged out
UPDATE lc_data.t_npc_regen
SET
a_pos_h = (SELECT a_was_x FROM lc_db.t_characters WHERE a_index = @char_id),
a_pos_r = (SELECT a_was_z FROM lc_db.t_characters WHERE a_index = @char_id),
a_pos_x = (SELECT a_was_r FROM lc_db.t_characters WHERE a_index = @char_id),
a_pos_z = (SELECT a_was_h FROM lc_db.t_characters WHERE a_index = @char_id)
WHERE t_npc_regen.a_npc_idx = @npc_id
AND t_npc_regen.a_zone_num = 6 -- 6 is just for example purpose
You can archive the same result directly via query! (of course adapt to t_shop in case)
SET @char_id = 1; -- Id of the char which logged out
UPDATE lc_data.t_npc_regen
SET
a_pos_h = (SELECT a_was_x FROM lc_db.t_characters WHERE a_index = @char_id),
a_pos_r = (SELECT a_was_z FROM lc_db.t_characters WHERE a_index = @char_id),
a_pos_x = (SELECT a_was_r FROM lc_db.t_characters WHERE a_index = @char_id),
a_pos_z = (SELECT a_was_h FROM lc_db.t_characters WHERE a_index = @char_id)
WHERE t_npc_regen.a_npc_idx = @npc_id
AND t_npc_regen.a_zone_num = 6 -- 6 is just for example purpose
You can archive the same result directly via query! (of course adapt to t_shop in case)

