Hello everyone! Recently unpacked mod Retribution v.2.5 and found a piece of code like to fully update asortimenta.Sam code: last_trade_time = objects.get_attribute (character_id, "last_trade")
act_time = system.get_mission_time ()
elapsed_time = act_time - last_trade_time
- If elapsed_time> = timerepr.time ("60:00:00"):
+ If elapsed_time> = timerepr.time ("48:00:00"): # (edited by Moonbear)
if objects.has_attribute (character_id, "backup_inventory"):
act_inventory = objects.get_inventory_list (character_id)
backup_inventory = objects.get_attribute (character_id, "backup_inventory")
missing_objects = backup_inventory [:]
for _id in act_inventory:
+ # Removing useless weapons from inventory (added by Moonbear)
+ If objects.has_attribute (_id, "weapon_type"):
+ Weapon_type = objects.get_attribute (_id, "weapon_type")
+ If (weapon_type == "leicht" or weapon_type == "schwer" or weapon_type == "sniper"):
+ If objects.count_in_inventory (character_id, _id)> 1:
+ Objects.remove_item_from_inventory (character_id, _id)
+ # Removing useless ammo from inventory (added by Moonbear)
+ If objects.has_attribute (_id, "kaliber"):
+ If objects.count_in_inventory (character_id, _id)> 10:
+ Objects.remove_item_from_inventory (character_id, _id)
+ # Removing useless armor from inventory (added by Moonbear)
+ If objects.has_attribute (_id, "armor"):
+ If objects.count_in_inventory (character_id, _id)> 1:
+ Objects.remove_item_from_inventory (character_id, _id)
if _id in missing_objects:
missing_objects.remove (_id)
if len (missing_objects):
@ @ @ @ 7819.19 -7425.6
new_item = random.choice (_list)
objects.create_item_in_inventory (object = character_id,
equipment = new_item)
+ # Adding 5 packs of ammo for created weapon (added by Moonbear)
+ If objects.has_attribute (new_item, "weapon_type"):
+ Weapon_type = objects.get_attribute (new_item, "weapon_type")
+ If (weapon_type == "leicht" or weapon_type == "schwer" or weapon_type == "sniper"):
+ If objects.has_attribute (new_item, "munitionsarten"):
+ Ammo_list = objects.get_attribute (new_item, "munitionsarten")
+ Ammo = random.choice (ammo_list)
+ If objects.count_in_inventory (character_id, ammo) <6:
+ Objects.create_item_in_inventory (object = character_id,
+ Equipment = [ammo] * 5)
+ # Adding two gas canisters (added by Moonbear)
+ If objects.count_in_inventory (character_id, "SET_GAS_CANISTER") <2:
+ Objects.create_item_in_inventory (object = character_id, equipment = ["SET_GAS_CANISTER"] * 2)
backup_inventory.remove (item)
backup_inventory.append (new_item)
else:
and the other in the game modes worth Derfflinger mod ver. 7.4 and there is a slightly different code:
last_trade_time = objects.get_attribute (character_id, "last_trade_update") # Derff's hack for reguar trade update
act_time = system.get_mission_time ()
elapsed_time = act_time - last_trade_time
if elapsed_time> = timerepr.time (update_time_limit ()):
objects.set_attribute (character_id, "last_trade_update", system.get_mission_time ()) # Derff's hack for reguar trade update
if objects.has_attribute (character_id, "backup_inventory"):
act_inventory = objects.get_inventory_list (character_id)
backup_inventory = objects.get_attribute (character_id, "backup_inventory")
missing_objects = backup_inventory [:]
for _id in act_inventory:
if _id in missing_objects:
missing_objects.remove (_id)
if len (missing_objects):
print missing_objects
all_items_list = system.get_item_list ()
all_items_list = filter (lambda act_item:
(Objects.has_attribute (act_item, "item_type") or
objects.has_attribute (act_item, "le_recovery") or
objects.has_attribute (act_item, "armor")), all_items_list)
all_items_list = filter (lambda act_item:
((Objects.has_attribute (act_item, "not_tradable") and
not objects.get_attribute (act_item, "not_tradable")) or
not objects.has_attribute (act_item, "not_tradable")), all_items_list)
for item in missing_objects:
_list = helper_get_equivalent_items_list (all_items_list, item)
if len (_list):
new_item = random.choice (_list)
new_id = objects.create_item_in_inventory (object = character_id,
equipment = new_item)
objects.set_attribute (new_id, "trader_new_item", data (). number_of_trade)
backup_inventory.remove (item)
backup_inventory.append (new_item)
else:
And now tell me where to add and where?