Wild_qwerty said:
just make sure the scripts do not delete quest items. It would suck if someone sold a quest item and then the shop deleted it...
Okay I have this figured out ... how to get rid of all items in store inventory but quest items ... then run the restocking commands. I made a new command objpid_is_quest_item and added it to the command.h header. Then in the store script, before restocking, I do this:
// Destroy all non quest items
pid_counter:=0;
while (pid_counter < 1000) do begin
pid_counter := pid_counter + 1;
if not objpid_is_quest_item(pid_counter) then begin
item_qty := obj_is_carrying_obj_pid(self_obj, pid_counter);
if (item_qty) then begin
item_ptr := obj_carrying_pid_obj(self_obj, pid_counter);
removed_qty := rm_mult_objs_from_inven(self_obj, item_ptr, item_qty);
destroy_object(item_ptr);
end
end
end
check_restock_item(PID_BOTTLE_CAPS, 150, 1000, 100)
etc ...
I tested it and it seems to work fine. It did not destroy vic's water flask or the temple key, but it did destroy flowers, broken bottles, lighter etc. Then it did its restock. This also makes the inventory more random because in my store scripts I do things like this:
check_restock_item(random(816,822), 0, 1, 70) // random spear
check_restock_item(random(827,835), 0, 1, 70) // random punching weapon
check_restock_item(random(851,859), 0, 1, 70) // random thrown weapon
This should take care of the "too many items" bug caused by excessive selling to stores. The command to check if quest item is below. I'm working on similar commands to do better randomization of store inventories, and also loot that you find. The loot should be random if its not a quest item. Every time you play you should find different things, ideally in different places. I'm working on this ....
#define objpid_is_quest_item(x) ((x == PID_KEY) OR \
(x == PID_KEYS) OR \
(x == PID_JAIL_KEY) OR \
(x == PID_NUKE_KEY) OR \
(x == PID_TRAPPER_TOWN_KEY) OR \
(x == PID_TEMPLE_KEY) OR \
(x == PID_VAULT_13_SHACK_KEY) OR \
(x == PID_CELL_DOOR_KEY) OR \
(x == PID_RED_PASS_KEY) OR \
(x == PID_BLUE_PASS_KEY) OR \
(x == PID_YELLOW_PASS_KEY) OR \
(x == PID_YELLOW_REACTOR_KEYCARD) OR \
(x == PID_RED_REACTOR_KEYCARD) OR \
(x == PID_V15_KEYCARD) OR \
(x == PID_TANKER_FOB) OR \
(x == PID_ACCESS_CARD) OR \
(x == PID_SECURITY_CARD) OR \
(x == PID_PRESIDENTIAL_PASS) OR \
(x == PID_PRES_ACCESS_KEY) OR \
(x == PID_DAY_PASS) OR \
(x == PID_FAKE_CITIZENSHIP) OR \
(x == PID_STABLES_ID_BADGE) OR \
(x == PID_DR_HENRY_PAPERS) OR \
(x == PID_BECKY_BOOK) OR \
(x == PID_ACCOUNT_BOOK) OR \
(x == PID_ENLIGHTENED_ONE_LETTER) OR \
(x == PID_MEMO_FROM_FRANCIS) OR \
(x == PID_RAIDERS_MAP) OR \
(x == PID_SURVEY_MAP) OR \
(x == PID_VERTIBIRD_PLANS) OR \
(x == PID_DERMAL_PIP_BOY_DISK) OR \
(x == PID_PIP_BOY_MEDICAL_ENHANCER) OR \
(x == PID_ELRON_MEMBER_HOLO) OR \
(x == PID_ECON_HOLODISK) OR \
(x == PID_HOLODISK) OR \
(x == PID_HOLODISK_FAKE_V13) OR \
(x == PID_GECKO_DATA_DISK) OR \
(x == PID_REACTOR_DATA_DISK) OR \
(x == PID_BISHOPS_HOLODISK) OR \
(x == PID_ENCLAVE_HOLODISK_1) OR \
(x == PID_ENCLAVE_HOLODISK_2) OR \
(x == PID_ENCLAVE_HOLODISK_3) OR \
(x == PID_ENCLAVE_HOLODISK_4) OR \
(x == PID_ENCLAVE_HOLODISK_5) OR \
(x == PID_EVACUATION_HOLODISK) OR \
(x == PID_EXPERIMENT_HOLODISK) OR \
(x == PID_MEDICAL_HOLODISK) OR \
(x == PID_PASSWORD_HOLODISK) OR \
(x == PID_BROADCAST_HOLODISK) OR \
(x == PID_SIERRA_MISSION_HOLODISK) OR \
(x == PID_NCR_HISTORY_HOLODISK) OR \
(x == PID_LYNETTE_HOLO) OR \
(x == PID_WESTIN_HOLO) OR \
(x == PID_SPY_HOLO) OR \
(x == PID_ELRON_MEMBER_HOLO) OR \
(x == PID_ELRON_TEACH_HOLO) OR \
(x == PID_DOG_TAGS) OR \
(x == PID_BLONDIE_DOG_TAG) OR \
(x == PID_ANGEL_EYES_DOG_TAG) OR \
(x == PID_TUCO_DOG_TAG) OR \
(x == PID_WATCH) OR \
(x == PID_GOLD_LOCKET) OR \
(x == PID_ANNA_GOLD_LOCKET) OR \
(x == PID_CORNELIUS_GOLD_WATCH) OR \
(x == PID_TALISMAN) OR \
(x == PID_VIC_RADIO) OR \
(x == PID_VIC_WATER_FLASK) OR \
(x == PID_EMPTY_JET) OR \
(x == PID_OXYGEN_TANK) OR \
(x == PID_POISON_TANK) OR \
(x == PID_GECK) OR \
(x == PID_V15_COMPUTER_PART) OR \
(x == PID_NAV_COMPUTER_PARTS) OR \
(x == PID_COMPUTER_VOICE_MODULE) OR \
(x == PID_CAR_FUEL_CELL_CONTROLLER) OR \
(x == PID_CAR_FUEL_INJECTION) OR \
(x == PID_PLASMA_TRANSFORMER) OR \
(x == PID_EXCAVATOR_CHIP) OR \
(x == PID_SUPER_TOOL_KIT) OR \
(x == PID_MOTIVATOR) OR \
(x == PID_K9_MOTIVATOR) OR \
(x == PID_HY_MAG_PART) OR \
(x == PID_MINE_PART) OR \
(x == PID_BRIEFCASE) OR \
(x == PID_MOORE_BAD_BRIEFCASE) OR \
(x == PID_MOORE_GOOD_BRIEFCASE) OR \
(x == PID_RAMIREZ_BOX_CLOSED) OR \
(x == PID_RAMIREZ_BOX_OPEN) OR \
(x == PID_PSYCHIC_NULLIFIER) OR \
(x == PID_MR_NIXON_DOLL) OR \
(x == PID_SPECTACLES) OR \
(x == PID_MIRROR_SHADES) OR \
(x == PID_DIXON_EYE) OR \
(x == PID_CLIFTON_EYE) OR \
(x == PID_CYBERNETIC_BRAIN) OR \
(x == PID_HUMAN_BRAIN) OR \
(x == PID_CHIMP_BRAIN) OR \
(x == PID_ABNORMAL_BRAIN) OR \
(x == PID_BIO_GEL) OR \
(x == PID_SMITTY_MEAL) OR \
(x == PID_MEM_CHIP_BLUE) OR \
(x == PID_MEM_CHIP_GREEN) OR \
(x == PID_MEM_CHIP_RED) OR \
(x == PID_MEM_CHIP_YELLOW))