Game modification

Do to be able to store loot in containers

First you need to decide what objects are containers - and they can be(logically) something to hide all kinds of boxes, cabinets, camode.

I made a test map for this - just to show these items that you can put your loot:

Скриншот контейнеров

If you add to them a random item, then poking around in the garbage will be so much more interesting. While eksperementiruyu with chances and items.

I will be glad to listen to the universal offers.

Here's the list and a function for assigning script:

 

picklocks = [ "SET_BASIC_PICKLOCK", "SET_VAMPED_PICKLOCK_SET", "SET_SET_OF_PICKLOCKS", "SET_SPECIAL_PICKLOCK" ]
Loot_crates=['RES3D_HOLZKISTE', 'RES3D_TRES_OBJECTS_BUILDING_HOLZKISTE', 
 'RES3D_TRES_OBJECTS_BUILDING_KISTE', 'RES3D_TRES_OBJECTS_BUILDING_KISTEHAUFEN',
 'RES3D_TRES_OBJECTS_BUILDING_METALLKISTE', 'RES3D_TRES_OBJECTS_BUILDING_AMMOBOX_1',
 'RES3D_TRES_OBJECTS_BUILDING_AMMOBOX_2', 'RES3D_TRES_OBJECTS_BUILDING_AMMOBOX_3',
 'RES3D_TRES_OBJECTS_BUILDING_AMMOBOX_4', 'RES3D_HOLZKISTENSTAPEL',
 'RES3D_TRES_OBJECTS_BUILDING_HOLZKISTENSTAPEL', 'RES3D_TRES_OBJECTS_BUILDING_METALLKISTENSTAPEL',
 'RES3D_MUELLTONNE', 'RES3D_FASS', 'RES3D_TRES_OBJECTS_BUILDING_FASS_1',
 'RES3D_TRES_OBJECTS_BUILDING_WOODBARREL_1', 'RES3D_TRES_OBJECTS_BUILDING_FASS_2',
 'RES3D_TRES_OBJECTS_BUILDING_WOODBARREL_2', 'RES3D_FASS_LIEGEND',
'RES3D_TRES_OBJECTS_BUILDING_FASS_4','RES3D_TRES_OBJECTS_BUILDING_TRUHEMITSCHLOSS_ANIMATE',
'RES3D_TRES_OBJECTS_BUILDING_STABILEHOLZKISTEMITSCHLOSS_ANIMATE',
'RES3D_TRES_OBJECTS_BUILDING_GROSSEMETALLKISTEMITSCHLOSS_ANIMATE',
'RES3D_TRES_OBJECTS_BUILDING_FELDKISTEMITSCHLOSS_ANIMATE',
 'RES3D_TRES_OBJECTS_BUILDING_BUNKER_KISTE_01', 'RES3D_TRES_OBJECTS_BUILDING_HOLZKOMMODE2BUCHE',
 'RES3D_TRES_OBJECTS_BUILDING_HOLZKOMMODE3EICHE', 'RES3D_TRES_OBJECTS_BUILDING_HOLZKOMMODE1AHORN',
 'RES3D_TRESOR_01', 'RES3D_TRESOR_02', 'RES3D_TRESOR_03', 'RES3D_TRESOR_04', 'RES3D_TRES_OBJECTS_BUILDING_ANBAUWAND1TEIL2',
 'RES3D_TRES_OBJECTS_BUILDING_ANBAUWAND1TEIL4', 'RES3D_TRES_OBJECTS_BUILDING_ANBAUWAND1TEIL1',
 'RES3D_TRES_OBJECTS_BUILDING_REFRIGERATOR', 'RES3D_TRES_OBJECTS_BUILDING_BUNKER_SPINT',
 'RES3D_TRES_OBJECTS_BUILDING_WERKBANK', 'RES3D_TRES_OBJECTS_BUILDING_SPUELE',
 'RES3D_TRES_OBJECTS_BUILDING_STAHLREGAL01', 'RES3D_TRES_OBJECTS_BUILDING_STAHLREGAL02',
 'RES3D_TRES_OBJECTS_BUILDING_STAHLREGAL03', 'RES3D_TRES_OBJECTS_BUILDING_STAHLREGAL',
 'RES3D_TRES_OBJECTS_BUILDING_SPIND', 'RES3D_TRES_OBJECTS_BUILDING_SPINDE_GEKIPPT',
 'RES3D_TRES_OBJECTS_BUILDING_AKTENSCHRANK', 'RES3D_TRES_OBJECTS_BUILDING_ANBAUWAND2TEIL2',
 'RES3D_TRES_OBJECTS_BUILDING_ANBAUWAND2TEIL3', 'RES3D_TRES_OBJECTS_BUILDING_ANBAUWAND2TEIL4',
 'RES3D_TRES_OBJECTS_BUILDING_ANBAUWAND2TEIL5', 'RES3D_TRES_OBJECTS_BUILDING_ANBAUWAND2TEIL1',
 'RES3D_TRES_OBJECTS_BUILDING_ANBAUWAND3TEIL2', 'RES3D_TRES_OBJECTS_BUILDING_ANBAUWAND3TEIL3',
 'RES3D_TRES_OBJECTS_BUILDING_ANBAUWAND3TEIL4', 'RES3D_TRES_OBJECTS_BUILDING_ANBAUWAND3TEIL5',
 'RES3D_TRES_OBJECTS_BUILDING_ANBAUWAND3TEIL1', 'RES3D_TRES_OBJECTS_BUILDING_REFRIGERATOR2',
 'RES3D_MUELLCONTAINER', 'RES3D_MUELLCONTAINER_2', 'RES3D_ELEKTROKASTEN', 'RES3D_TRES_OBJECTS_BUILDING_BUNKER_KISTE_02',
 'RES3D_TRES_OBJECTS_BUILDING_BUNKER_KISTE_03', 'RES3D_TRES_OBJECTS_BUILDING_BUNKER_KISTE_04',
 'RES3D_TRES_OBJECTS_BUILDING_ANBAUWAND1TEIL4U5_GEKIPPT', 'RES3D_TRES_OBJECTS_BUILDING_ANBAUWAND1TEIL1_GEKIPPT',
 'RES3D_TRES_OBJECTS_BUILDING_ANBAUWAND1TEIL2_GEKIPPT', 'RES3D_TRES_OBJECTS_BUILDING_ANBAUWAND1TEIL3_GEKIPPT',
 'RES3D_TRES_OBJECTS_BUILDING_KISTE_OFFEN', 'RES3D_TRES_OBJECTS_BUILDING_KISTE_KAPUTT', 'RES3D_FASS_KAPUTT',
 'RES3D_TRES_OBJECTS_BUILDING_WOODBARREL_3', 'RES3D_TRES_OBJECTS_BUILDING_FASS_3']
refill_interval = timerepr.time( "24:00:00" )
refill_chance = 60

def fill_loot_crate(object_id):
 inventorylist = objects.get_inventory_list(object_id)
 typeID = objects.get_attribute(object_id,"typeid")
 if (inventorylist or not inventorylist == []) and refill_chance > random.randint(1,100):
 objects.create_item_in_inventory(object_id, get_random_item_2())
 objects.set_attribute( object_id, "is_examined", False )
 if 'AMMOBOX' in typeID:
 objects.create_item_in_inventory(object_id, [get_random_ammo() for x in range(5)])
 if 'TRESOR' in typeID or 'ANIMATE' in typeID:
 objects.create_item_in_inventory(object_id, [get_random_ammo() for x in range(10)]+[random.choice(picklocks)])
 objects.add_closed_lock(object_id, "lock1", closure_type=random.choice(['normal','lock-trap','booby-trap','poison trap']))

def set_loot_crates():
 if not hasattr (data(), "fill_time"):
 data().fill_time = system.get_mission_time()
 for object_id in the system.get_objects():
 if objects.has_attribute(object_id,"typeid") and objects.get_attribute(object_id,"typeid") in Loot_crates:
system.mark_for_script_use(object_id)
 objects.set_attribute(object_id, "lootcrate", True)
fill_loot_crate(object_id)

def refill_loot_crates():
 if hasattr (data(), "fill_time") and system.get_mission_time()-data().fill_time > refill_interval:
 for object_id in the system.get_objects():
 if objects.has_attribute(object_id,"typeid") and objects.get_attribute(object_id,"typeid") in Loot_crates:
fill_loot_crate(object_id)
 data().fill_time = system.get_mission_time()

For this to work, the function call set_loot_crates should be made of on_map_loaded function - otherwise objects are not assigned scripted and nothing can be put. refill_loot_crates - is called funkcii on_map_reentry or in each zone or in system_events.py

items taken from that list as for thefts, there are rt_mod the extended list, but most likely I'll make my list, but later.

the chance of adding any object - made of 60% if more than - be too bold. Items will be added randomly when you log in location if there's nothing there, re-adding through the reentry after 24hrs.

In safes and gun boxes - added ammo, and safes boxes back to the castle.

 

Also it is necessary to have the handler peretekanie items:

it is almost independent from the code above, just the items are placed only in those cases where something lay.

somewhere in the body of the funtion def on_use( character_id, object_id, item_id, item_type ):

 if (object_id != None) and ( item_id != None ) and not is_locked_object(object_id) and(objects.has_attribute(object_id, "lootcrate") or objects.can_transfer_item(object_id, item_id)):
objects.transfer_item(character_id,item_id,object_id)
 objects.set_attribute( object_id, "is_examined", True )
 return True

Have made a call set_loot_cratesof all zone_X.py because of system_events.py work did not, although there are also on_map_loaded and global.

Buying and selling game cars from traders

In continuation of modding - and an idea came to cars sold merchants. For the test we made further object key machines, analog red key "SET_RED_KEY". Every merchant in regular updating of products - you receive the machine, and the key. Bought the key - you can climb in the car and go. It is possible to make each merchant Parking space for cars - upgrade your car the next reentry on the map. For those machines that in the story also possible to make the keys and put them in the machine itself or to hide somewhere.

Better yet think of how easier it is to implement - to make the old machines were removed from merchants, and in return they was a new spawn.

 

NeiroN 16.09.2018 | Comments (3)













Development by Sergey A.Zhukov 2007-2012