Skip to content

Scripting API

Dude McDude edited this page Jan 27, 2023 · 66 revisions

Table of Contents

Note: this document was originally written for vanilla ToEE. Temple+ has expanded the python API quite a bit, rendering this somewhat outdated. Nevertheless it's a good reference for beginner modders. Keep in mind Temple+ can quite easily extend the API further.

See the following for up to date method lists:

Python object methods: https://github.com/GrognardsFromHell/TemplePlus/blob/master/TemplePlus/python/python_object.cpp#L4426
PyGame methods:
https://github.com/GrognardsFromHell/TemplePlus/blob/master/TemplePlus/python/python_game.cpp#L1457

1. General

2. Basics

4.a. General



1. General

2. Basics

Return a list of objects near a location: (up to a fairly large but limited radius - in terms of pc.distance_to(x) function, roughly 64)

  • game.obj_list_vicinity(game.leader.location, type)
  • game.obj_list_cone(game.leader, type, range, 0, 360) 360 degree cone, up to , around game.leader Haven't tested "pathological" cases yet type can be:
    OLC_PC for PCs
    OLC_NPC for NPCs
    OLC_SCENERY for scenery objects
    OLC_GENERIC for generic objects (includes the commonly used spell_obj )
    OLC_CONTAINER for containers
    OLC_PORTAL for portals (doors, maybe more?)
    OLC_ALL for all of the above and everything else

NOTE WELL: objects that are OFF (OF_OFF is set) cannot be found by this method.

  • game.obj_list_range seems like ( location, type, ??) couldn't get it to fetch more than the person exactly in location
  • game.obj_list(location, OLCtype) Lists objects in the exact tile


3. "Advanced Basics"

###Range of numbers: range(1,5) # will return [1,2,3,4]

###String operations:

Converting from number to string:

str(5)

Concatenating strings:

a = 'abc'
b = '123'
c = a+b ## c assigned 'abc123'
c += 'xyz' ## c will now equal 'abc123xyz'

Splitting strings:

'asdf'.split('c')
# Where 'c' is the delimiter string

Converting from string to integer number:

int('5')
# only works on "number strings", e.g. int('a') will return an error

Concatenating arrays:

a = [(1,1), (2,2)]
b = [(3,3), (4,4)]
c = a + b
# c now equals [(1,1), (2,2), (3,3), (4,4)]
# e.g. c[3] will return (4,4)

Writing Hexadecimal:

0xFF #will return 255

###Bit Operations: Binary Shift: << - shift left (towards MSB) >> - shift right (towards LSB) # number to be shifted (integer) << amount of shifting (integer) # examples: 3 << 1 # shift left - returns 6 3 << 2 # returns 12 3 >> 1 # shift right - will return 1

~x 	# Bitwise NOT (not accessible in console :) )
x & y  	# AND
x | y 	# OR
x^y	# XOR

###Math:

x**y # exponentiation - x^y
x % y # division remainder

###File operations: f = open('filename.txt', 'w') # 'w' - creates a new file called 'filename.txt', deleting and overwriting if one exists # 'a' - append mode. Will only add to existing file. Seems you can't access existing content this way (?) f.write("string") f.write( chr(11) ) #write ascii char 11 (used in TAB files as line break) f.seek(offset[, whence=0]) # whence == 0 then use absolute indexing. # whence == 1 then offset relative to current pos. # whence == 2 then offset relative to file end. f.tell() f.writelines(list) f.read([size]) # size is optional, otherwise whole file is read f.readline() f.close()

###Functions return multiple arguments from a function:

def sheker(kolshehu):
    x = kolshehu/2
    y = kolshehu+1
    return (x,y)

optional function arguments:

def tai(strat, prot = 14262)
	npc=game.obj_create( prot, location_from_axis (481L, 536L) )
	npc.obj_set_int(324, strat)
	#create a troll by default, may be changed if the user so wishes

	# Example of usage:
	tai(28) #will spawn troll
	tai(28, 14313)  # will spawn brigand archer (proto 14313)
	tai(28, prot = 14313) 	# same as above
				# may be used to alter specific optional parameter if there are many or the order is different etc.

	# NB: optional arguments are not static in ToEE

###Ternary operator

Python doesn't really have that, except maybe in advanced versions, but it can be simulated:

	a = ([condition] and [value_if_true]) or [value_if_false]
	# short for:
	if [condition]:
		a = [value_if_true]
	else:
		a = [value_if_false]
	# Note - the square brackets are just for illustration
	# E.g.
	weaponx1_1 = (weapon1_1 != 0 and npc.item_find_by_proto(weapon1_1)) or OBJ_HANDLE_NULL

Truly global (across saves!) variables:

# Define within a function with the global statement
# E.g.
def jjj(jhg = 2):
	global fdsa
	if jhg != 2:
		fdsa = jhg
	print fdsa

List Comprehension (shortcut for a for loop):

[game.particles_kill(i) for i in range(0, 200)]

Nested: [[float(y) for y in x] for x in l] With condition: [p for p in range(0,10) if p > 5]

###try / except: try: print 'insert commands you fear will return an error here, so they don't completely break the script' except: print 'error!' finally: print 'statements in this clause are executed anyway'

exec()

# can read commands from a file, as though it were a normal py file
# useful for debugging / testing new scripts without relaunching the game
fff = open('command_file.py', 'r')
try:
	exec(fff)
except:
	print 'error'
fff.close()


4. Reading and Modifying Critter attributes

a. General:

Map, location:

game.party[0].location
game.party[0].map

e.g.: if (attachee.map == 5121):

game.fade_and_teleport(t, sound_id, movie_id, map_id, X,Y)
# t - time to pass [seconds]
# sound_id - sound ID to play
# movie_id - movie ID to play
# map_id - map ID to teleport to
game.fade(48800,0,0,1) 
# first number is game time passed, measured in seconds
# second number is what sound should play
# third number is movie played
# fourth number is how long the game fades out in seconds (i.e. for how long you get a black screen)

Check proximity / distance:

obj.distance_to(attachee) #checks distance between outlining circles of obj and attachee

Find out how much money party has:

game.party[0].money_get()

Adjust money (in coppers):

pc.money_adj(-50000) # subtracts 500 gold

Alignment check:

game.party_alignment ==  NEUTRAL_EVIL
game.party_alignment &  ALIGNMENT_EVIL != 0

pc.stat_level_get(stat_alignment) == LAWFUL_GOOD

Facing:

npc.rotation = [angle]

# Control what direction the character is looking.
# 0 - north
# 1.5 - east
# 3 - south
# 4.5 - west
# more accurately: 
# Rotation is measured in radians, so the real south is pi (3.14...), the real east pi/2 (1.57...), etc.
# It can be any number, e.g. npc.rotation = 4.7

Is Combat Active:

game.combat_is_active()

b. Stats and Skills:

Change/get attributes/stats:

game.party[X].stat_base_set(stat_strength,Y) game.party[X].stat_base_set(stat_experience,Y)

pc.stat_level_get( STAT )

Stats:

Money: stat_money, stat_money_cp, stat_money_ep, stat_money_gp, stat_money_pp, stat_money_sp,

stat_experience,

stat_size, stat_height, stat_weight, stat_gender (may be gender_male, gender_female), stat_age, stat_alignment, stat_deity, stat_domain_1 , stat_domain_2, stat_race (race_orc, race_...), stat_subrace,

stat_level, ## returns level

stat_level_paladin, stat_level_wizard, stat_level_cleric, stat_level_fighter, stat_level_bard, ..

stat_strength, stat_intelligence, stat_wisdom, stat_charisma, stat_dexterity, stat_constitution,

stat_hp_current, stat_hp_max, stat_subdual_damage stat_ac stat_attack_bonus, stat_damage_bonus, stat_melee_attack_bonus, stat_ranged_attack_bonus, stat_carried_weight, stat_load, stat_caster_level, stat_caster_level_barbarian, stat_caster_level_bard, stat_caster_level_cleric, stat_caster_level_druid, stat_caster_level_fighter, stat_caster_level_monk, stat_caster_level_paladin, stat_caster_level_ranger, stat_caster_level_rogue, stat_caster_level_sorcerer, stat_caster_level_wizard

stat_alignment_choice, stat_category, stat_cha_mod, stat_con_mod, stat_dex_mod, stat_int_mod, stat_str_mod, stat_wis_mod,

stat_favored_enemies,

'stat_initiative_bonus', 'stat_known_spells', 'stat_memorized_spells', 'stat_school_prohibited', 'stat_school_specialization', 'stat_spells_per_day',

'stat_movement_speed', 'stat_run_speed', stat_save_fortitude, stat_save_reflexes, stat_save_willpower,

These checks take modifiers into account (at least racial modifiers)

Hit Dice:

obj.hit_dice
## These are NPC "extra" HD; PCs have 0d0

Check Skills:

pc.skill_level_get(npc, skill_sense_motive) >= 10

also possible, it seems: pc.skill_level_get(skill_sense_motive) >= 10

Feats:

pc.has_feat(feat_track)

attachee.feats 
# list of attachee's feat;
# it returns a tuple of feats - e.g. "(alertness, iron will, power attack)"

    pc.feat_add(x) # adds feat; Temple+ only

Reputation:

Check reputation: if (game.party[0].reputation_has(1) == 1): for pc in game.party:

Add/remove reputation:

game.party[0].reputation_add(23)
pc.reputation_remove( 1 )

Note that NPCs can't have reputations (so you can't add factions by attaching a reputation)

Allegiance:

Check if attachee is party NPC:

if (attachee.leader_get() != OBJ_HANDLE_NULL) ## party NPC follower

Test for friendliness: (EXPLICIT ALLIES ONLY!)

obj.is_friendly(obj)

Category type:

dude.is_category_type( mc_type_animal )

c. Health and damage:

Check if unconscious:

if attachee.is_unconscious() == 1:
# does this account for sleep etc?
critter_is_unconscious(attachee)
# the above is just a script that checks the HP

Check if dead:

obj.stat_level_get( stat_hp_current ) <= -10

Access one's subdual (nonlethal) damage, compare to remaining HP (to see if it's unconscious)

if ( attachee.stat_level_get(stat_subdual_damage) >= attachee.stat_level_get(stat_hp_current)  )

HP percent from max:

obj_percent_hp(attachee)

Test for HP (hit points) of some object:

attachee.stat_level_get(stat_hp_current) >= 0

Get maximum HP:

attachee.stat_level_get(stat_hp_max) >= 0

Damage NPC:

npc=game.obj_create( 14398, location_from_axis (481L, 536L) )
npc.damage( OBJ_HANDLE_NULL, 0, dice_new("52d1"))
npc.damage(OBJ_HANDLE_NULL,D20DT_SUBDUAL,dice_new("1d3"),D20DAP_NORMAL) //subdual damage
## the first argument is probably the damager's ID. (presumeably, the damaged critter would want to take revenge) OBJ_HANDLE_NULL for deux-ex-machina damage...?

Damage but with reflex save:

def damage(attachee, triggerer): dam = dice_new( '1d2' ) attachee.reflex_save_and_damage( attachee, 20, D20_Save_Reduction_Half, D20STD_F_NONE, dam, D20DT_SUBDUAL, D20DAP_UNSPECIFIED, D20A_CAST_SPELL, 0 )

Heal NPC: npc.heal( OBJ_HANDLE_NULL, dice_new("2d8") ) ## the first argument is probably the healer's ID (OBJ_HANDLE_NULL for none) ## needs testing! npc.healsubdual( OBJ_HANDLE_NULL, dice_new("2d8") )

See internal variables 27 and 29 for direct manipulation of base HP and total damage taken.

attachee.obj_set_int( 29, 0 ) - completely heals subject (from lethal damage), can be used to resurrect! (w/o the XP penalty) obj_f_hp_damage=29 - indeed contains amount of lethal damage taken

Kill:

critter_kill_by_effect()
critter_kill()

I think the former is thwarted by the Death Ward spell. Neither grant experience, though.

Poison / Disease List: // Poisons 0 - Small Centipede 1 - Greenblood Oil 2 - Spider Venom 3 - Blood Root 4 - Purple Worm 5 - Large Scorpion Type: Injury DC 18; Initial Damage: 1d6 Str; Secondary Damage: 1d6 Str 6 - Wyvern 7 - Giant Wasp 8 - Black Adder 9 - Malyss Root Paste 10 - Dragon Bile 11 - Sassone Leaf Residue 12 - Terinav Root 13 - Carrion Crawler Brain Juice 14 - Black Lotus Extract 15 - Id Moss 16 - Striped Toadstool 17 - Lich Dust 18 - Dark Reaver Powder 19 - Burnt Othur Fumes 20 - Quasit 21 - Violet Fungi 22 - Yellow Mold 23 - Mystical 24 - Other 25 - Blue Whinnis 26 - Shadow Essence 27 - Deathblade 28 - Nitharit 29 - Oil of Taggit 30 - Arsenic 31 - Ungol Dust 32 - Insanity Mist

// Diseases 0 - Blinding Sickness 1 - Cackle Fever 2 - Demon Fever 3 - Devil Chills 4 - Filth Fever 5 - Mindfire 6 - Mummy Rot 7 - Red Ache 8 - Shakes 9 - Slimy Doom

d. Special/spell conditions:

D20 Query:

Check if fallen paladin:

pc.d20_query(Q_IsFallenPaladin) == 1

Check if prone:

pc.d20_query(Q_Prone) == 1

Can be Coup De Grace'd:

obj.d20_query(Q_CoupDeGrace)
# Unconscious? Paralyzed? Held? Needs testing!

Is charmed: 'Q_Critter_Is_Charmed',

'Q_AI_Fireball_OK', 'Q_AI_Has_Spell_Override',

'Q_AOOIncurs', 'Q_AOOPossible', 'Q_AOOWillTake', 'Q_Critter_Is_AIControlled' - doesn't return 1 for AI controlled party members (animal comps. or summons), or even plain enemies Haven't been able to extract good information from these

'Q_ExperienceExempt' - DOES return 1 for summoned creatures; but also for animal companions note: animal companions have ONF_CHECK_LEADER = 1, whereas recruited party members (player controlled or not) and summons do not! haven't checked charmed yet tho attachee.d20_query_has_spell_condition( sp_Summoned )

'Q_ActionAllowed', 'Q_ActionTriggersAOO', 'Q_Armor_Get_AC_Bonus', 'Q_Armor_Get_Max_DEX_Bonus', 'Q_Armor_Get_Max_Speed', 'Q_Autoend_Turn', 'Q_Barbarian_Fatigued', 'Q_Barbarian_Raged', 'Q_BardicInstrument', 'Q_CanBeAffected_ActionFrame', 'Q_CanBeAffected_PerformAction', 'Q_CanBeFlanked', 'Q_CannotCast', 'Q_CannotUseChaSkill', 'Q_CannotUseIntSkill', 'Q_Commanded', 'Q_CoupDeGrace', 'Q_Critter_Can_Call_Lightning', 'Q_Critter_Can_Detect_Chaos', 'Q_Critter_Can_Detect_Evil', 'Q_Critter_Can_Detect_Good', 'Q_Critter_Can_Detect_Law', 'Q_Critter_Can_Detect_Magic', 'Q_Critter_Can_Detect_Undead', 'Q_Critter_Can_Discern_Lies', 'Q_Critter_Can_Dismiss_Spells', 'Q_Critter_Can_Find_Traps', 'Q_Critter_Can_See_Darkvision', 'Q_Critter_Can_See_Ethereal', 'Q_Critter_Can_See_Invisible', 'Q_Critter_Cannot_Loot', 'Q_Critter_Cannot_Wield_Items', 'Q_Critter_Has_Condition', 'Q_Critter_Has_Endure_Elements', 'Q_Critter_Has_Freedom_of_Movement', 'Q_Critter_Has_Mirror_Image', 'Q_Critter_Has_No_Con_Score', 'Q_Critter_Has_Protection_From_Elements', 'Q_Critter_Has_Resist_Elements', 'Q_Critter_Has_Spell_Active', 'Q_Critter_Has_Spell_Resistance', 'Q_Critter_Has_True_Seeing',

'Q_Critter_Is_Afraid', 'Q_Critter_Is_Blinded',

'Q_Critter_Is_Concentrating', 'Q_Critter_Is_Confused', 'Q_Critter_Is_Cursed', 'Q_Critter_Is_Deafened', 'Q_Critter_Is_Diseased', 'Q_Critter_Is_Encumbered_Heavy', 'Q_Critter_Is_Encumbered_Light', 'Q_Critter_Is_Encumbered_Medium', 'Q_Critter_Is_Encumbered_Overburdened', 'Q_Critter_Is_Grappling', 'Q_Critter_Is_Held', 'Q_Critter_Is_Immune_Critical_Hits', 'Q_Critter_Is_Immune_Death_Touch', 'Q_Critter_Is_Immune_Energy_Drain', 'Q_Critter_Is_Immune_Poison', 'Q_Critter_Is_Invisible', 'Q_Critter_Is_On_Consecrate_Ground', 'Q_Critter_Is_On_Desecrate_Ground', 'Q_Critter_Is_Poisoned', 'Q_Critter_Is_Spell_An_Ability', 'Q_Critter_Is_Stunned', 'Q_Dead', 'Q_Dying', 'Q_Elemental_Gem_State', 'Q_EnterCombat',

'Q_FailedDecipherToday', 'Q_Failed_Copy_Scroll', 'Q_FavoredClass', 'Q_FightingDefensively', 'Q_Flatfooted', 'Q_Has_Aura_Of_Courage', 'Q_Has_Temporary_Hit_Points', 'Q_Has_Thieves_Tools', 'Q_Helpless', 'Q_HoldingCharge', 'Q_IsActionInvalid_CheckAction', 'Q_IsFallenPaladin', 'Q_Is_BreakFree_Possible', 'Q_Item_Has_Enhancement_Bonus', 'Q_Item_Has_Keen_Bonus', 'Q_Masterwork', 'Q_Mute', 'Q_NewRound_This_Turn', 'Q_Obj_Is_Blessed', 'Q_OpponentSneakAttack', 'Q_Play_Critical_Hit_Anim', 'Q_Polymorphed', 'Q_Prone', 'Q_RapidShot', 'Q_Rebuked', 'Q_RerollAttack', 'Q_RerollCritical', 'Q_RerollSavingThrow', 'Q_SneakAttack', 'Q_SpellInterrupted', 'Q_Turned', 'Q_Unconscious', 'Q_Untripable', 'Q_Weapon_Get_Keen_Bonus', 'Q_Weapon_Is_Mighty_Cleaving', 'Q_Wearing_Ring_of_Change', 'Q_WieldedTwoHanded',

obj.d20_query_has_spell_condition(sp_Glitterdust) # works
obj.d20_query_has_spell_condition(sp_Glitterdust_Blindness) # doesn't work

Condition add with args:

Hide/ Reveal:

zuggtmoy.condition_add_with_args( "Invisible", 0, 0 )
zuggtmoy.object_flag_set(OF_DONTDRAW)

new_zuggtmoy.concealed_set( 1 )
new_zuggtmoy.unconceal()

# NB: when something is concealed, you can't walk on it

needs test!

Make prone:

npc.condition_add_with_args( "prone", 0, 0 )

Make unconscious:

npc.condition_add_with_args( "unconscious", 0, 0)

Make Paladin fallen:

triggerer.condition_add_with_args("Fallen_Paladin",0,0)

to atone:

obj.has_atoned()

(it doesn't check for atonement, it makes you atoned)

List of known conditions: prone unconscious fallen_paladin flatfooted invisible Encumbered Heavy Encumbered Medium

Nauseated - doesn't work Temp Negative Level # args: 1st: spell ID, 2nd: Save DC, 3rd: ???

Spell effected conditions:

target_item.obj.condition_add_with_args( 'sp-Sleep', spell.id, spell.duration, 0 )
target_item.obj.condition_add_with_args( 'sp-Protection From Alignment', spell.id, spell.duration, 2 )

see spell scripts for more!

Game object properties:

game.selected - list of selected party members game.maps_visited - list of map numbers you have been to game.sid - hmm game.hovered - party member you're hovering your mouse over!



5. Object & Inventory Manipulation

Creating/spawning objects

spider2 = game.obj_create( 14398, location_from_axis (481L, 536L) )
obj = game.obj_create( [proto id], [location])

Create item in NPC's inventory:

ring_givr = game.obj_create(14460, location_from_axis( 465, 499 ))
frogi = find_npc_near(ring_givr, 14057 )
create_item_in_inventory( 6270, frogi ) # could be buggy?
ring_givr.destroy()

# apparently more reliable method:
b = game.obj_create(6270, location_from_axis(465, 499) )
frogi.item_get(b)
# Seems NPCs won't be able to equip it when used this way, though!

Transfer item to someone

dude.item_transfer_to_by_proto(receiver_obj, proto_num) # doesn't return a value on success/failure
dude.item_transfer_to(receiver_obj, obj_name) # returns 1 if succeeded

Look for item in a critter's inventory

attachee.item_find(6016) == OBJ_HANDLE_NULL
attachee.item_find_by_proto(#) != OBJ_HANDLE_NULL
attachee.has_item(#) # returns boolean

Directly access critter/container inventory (Temple+ only)

obj.inventory_item(n) # n is the inventory index. 0 is the item in the top left slot.

Check if anyone has some item: (e.g. 3003)

anyone( pc.group_list(), "has_item", 3003 )
	^-bug?
anyone( game.leader.group_list(), "has_follower", 14072 )

One of them is buggy IIRC! (look for falrinth dialogue bug with elemental gem or sthg...)

Worn items

obj.item_worn_at([slot index])
# 0 - Helm
# 1 - Necklace
# 2 - Gloves
# 3 - Main hand (left on the screen)
# 4 - Offhand Weapon (most definitely NOT shield! see 11)
# 5 - Armor
# 6 - Left ring
# 7 - Right ring
# 8 - Boots
# 9 - Arrows
# 10 - Cloak
# 11 - Shield
# 12 -	Robe
# 13 - Bracers
# 14 - Bardic Instrument
# 15 - Misc. (Thieves' Tools / belt / ioun stones)

Equipping items

To auto-equip all items:

npc.item_wield_best_all()

Equipping a specific item (Temple+ only)

obj.item_wield(item, slot_index ) # slot_index as above

Unquipping an item (Temple+ only)

obj.item_worn_unwield( slot_index )

Move an object across the map

obj.move(location, offsetx [floating point!], offsety [floating point!])
obj.move(location_from_axis(x,y) , offsetx [floating point!], offsety [floating point!])

# The second commands makes use of the utilities.py function location_from_axis
# In order to use it, you must have "from utilities import *" at the beginning of the py file!
# Note that an x,y coordinate shift is equivalent to an offset of 28.0.

# NB: The offset is partially only graphical in nature; 
# The game will disregard the offset for purposes of light of sight, pathfinding, and such.
# It does seem to affect whether the character is hit by AoE spells, weapon reach, etc.

# Also: AI controlled critters who have a standpoint will always try to go back to it.
# Creatures that are spawned via script have their standpoint set to where they were created.

Mark as unlootable: (won't show up when looting nor in inventory) obj.item_flag_set(OIF_NO_LOOT)



6. Actions

Make someone face the triggerer:

attachee.turn_towards( triggerer )

# Very important when using the npc.can_see(pc) command to condition triggering of dialog! (otherwise you're out of the NPC's LOS)
# Also a nice visual animation :)

Make someone runoff: attachee.runoff(attachee.location) # Note: while they fade away, they might come back later - you should set OF_OFF if you want to prevent that! Begin dialogue:

triggerer.begin_dialog(with whom, line# to begin)

Float comments:

attachee.float_line(380,triggerer) 
# line taken from dialogue file

attachee.float_mesfile_line( 'mes\\narrative.mes', line_ID_number, color_ID ) 

# floating line of text, without portrait (this is how the Moathouse zombies say 'brains, brains...')
# Color IDs:
# 0 - White		5 - azure		10 - light green
# 1 - red		6 - dark blue		11 - dark blue (same as 6)
# 2 - green		7 - blue (same as 3)	12 - black
# 3 - blue		8 - grey green
# 4 - yellow		9 - light/pinkish red	

#New in Temple+: you can float freeform text lines
attachee.float_text_line('freeform text', color_ID ) 

Attack:

npc.attack( pc )

note that this can be very finnicky! (sometimes npcs refuse to attack, etc)

obj.add_to_initiative() # adds to initiative queue
game.update_combat_ui() # refeshes game queue UI to include manually added critters

# As mentioned, sometimes NPCs just freeze in their place.
# Dunno why.
# Things I've tried in vain to combat this:
#	* Whacking them with a character...
#	* obj.damage(game.leader, 0, dice_new("1d1") ) # the first entry is the identity of the damager...
# 	* obj.remove_from_initiative() - they get readded afterwards by the engine, but still do nothing
# 	* Changing the strategy_state internal variable
#	* obj.attack(game.leader)
#	* StopCombat(game.leader, 1) and then attack
#	* obj.ai_shitlist_add(game.leader)
#	* obj.set_initiative(19) # i.e. changing the initiative to something else
	* verified he has_los and can_see party members
# Interestingly, obj.turn_towards(game.leader) didn't work either - and that's not because he wasn't the active combatant! (other not currently active combatants, i.e. PCs waiting for their turn, did react to the command and turn towards the object)
# obj.is_unconscious() returned 0
# Hmm, it seems an AoE spell did it??? (entangle) - only did it once at least... maybe in conjunction with other stuff I did?

Touch Attack:

caster.perform_touch_attack( obj ) # make touch attack roll; returns 1 if hit, 2 on critical hit

Set Power Attack Level:

obj.d20_send_signal(S_SetPowerAttack, <num>)
	# Where <num> is the desired power attack level (don't include the brackets)

Set Defensive Casting:

obj.d20_send_signal(S_SetCastDefensively, <num>)
	# Where <num> 1 for enabling and 0 for disabling

Set Total Defense:

obj.condition_add('Total Defense')
	# Will grant Total Defense status for 1 round (6 sec in real time, 1 round in combat); +4 AC bonus seems to work

Combine gems into Golden Skull:

[pc].d20_send_signal(S_Golden_Skull_Combine,gem)
	# Where [gem] is a gem's object handle. 
	# Wonder what happens if you insert a non-gem item there?

Cast spell:

nSpellEnum Most functions use a spell enumeration code - nSpellEnum - which is ultimately just a number ID code See data\rules\spell_enum.mes for full list You can use the strings in there e.g. npc.cast_spell( spell_raise_dead, ...)

npc.cast_spell( nSpellEnum, picker_obj )
# Will cast a memorized spell.
# Spell that is not memorized cannot be cast this way!
# Does not work during combat (even if NPC is not actually engaged in combat, i.e. not in the initiative queue)


npc.spells_pending_to_memorized() 
# Spells that are pending to be memorized, become memorized - at least for clerics/wizards, not sure about Sorcerers

npc.spell_memorized_add( nSpellEnum, nCasterClassCode, nSpellLevel )
npc.spell_known_add( nSpellEnum, nCasterClassCode, nSpellLevel )
	# nCasterClassCode is code for the caster class - starting from 7 for Barbarian and upto 17 for Wizard, in alphabetical order. See data\mes\stats.mes

You can also apply some spell effects manually, see chapter 4.

Remove from / Add to party:

game.party[0].follower_remove( obj )
# note: probably needs game.party[0] to be a PC! But it should be anyway
# Also: ai_follower_remove probably does nothing

pc.ai_follower_add(npc)
# will add as uncontrollable NPC


7. Audiovisual Effects

game.leader.anim_callback(ag_anim_get_up)

Play a sound:

game.sound( [sound index number], [no of times to play] )

Play Particle Effects: (not case sensitive)

game.particles( "[effect name]", [object] )
# The second field can be a location in some cases! 
# (e.g. sp-Fireball-Hit), probably related to object skeletons/models

# Effect names:
# For full list, see partsys0.tab, partsys1.tab, partsys2.tab in rules folder


# Some Cool effects I've never seen, that spark the imagination:
MM-TextGlow

game.particles( "sp-summon monster I", spider1 )
game.particles( "ef-MinoCloud", juggernaut )
game.particles( 'sp-Bless Water', target_item.obj ) - a waterfall effect on a cylinder surface around the target
game.particles( 'sp-Righteous Might', target_item.obj ) - a red aura erupts into a cylinder of ascending particles, which then converge onto the target again from the top, recreating the aura and slowly fading


game.particles( "DesecrateEarth", triggerer )  - big area of effect, bluish particles and webs

game.particles( 'Orb-Summon-Air-Elemental', attachee )

game.particles( "sp-Hold Person", attachee )
game.particles( "sp-Bestow Curse", attachee )
game.particles( 'sp-Fog Cloud', spell_obj )
game.particles( 'sp-Dimension Door', spell.caster )


game.particles( 'Orb-Summon-Air-Elemental', monster_obj )
game.particles( 'Orb-Summon-Fire-Elemental', monster_obj ) - can be used for 5 foot diameter explosion
game.particles( 'Orb-Summon-Water-Elemental', monster_obj )
game.particles( 'sp-Summon Natures Ally II', spell.target_loc ) - a tornado of leaves and greenery
game.particles( 'sp-Protection From Undead', target_item.obj )
game.particles( 'sp-Protection From Magic', target_item.obj )
game.particles( 'sp-Wind Wall', target_item.obj ) - fog billows upwards. permanent
game.particles( 'sp-Unholy Blight', spell.target_loc ) - a black cloud dotted with red converges onto the target, and then slowly fades away
game.particles( 'sp-Stinking Cloud', spell_obj ) - fast appearing purple noxious looking cloud
game.particles( 'sp-Spell Resistance', target_item.obj ) - lasting colourful corona/aura effect
game.particles( 'sp-Solid Fog', spell_obj ) - slowly expanding fog. 20-25 feet in diameter
game.particles( 'sp-Sleet Storm', sleet_storm_obj ) - an aggressive downpour of particles bounded by a thin ring. huge diameter.
game.particles( 'sp-Repel Vermin', target_item.obj )
game.particles( 'sp-Phantasmal Killer', target.obj ) - a black orb appears, orbiting the target and tracing a purple ring which eventually explodes
game.particles( 'sp-Orders Wrath', spell.target_loc )
game.particles( 'sp-Obscuring Mist', spell_obj ) - 5 foot diameter mist
game.particles( 'sp-Mind Fog', spell_obj ) - slow spawning light green/white fog, very concentrated in the diameter
game.particles( 'sp-Meld Into Stone', target.obj ) - grey miasma and white particles on the floor. permanent
game.particles( 'sp-Holy Smite', spell.target_loc ) - expanding bluish light with some yellow particles at the rim
game.particles( 'sp-Hold Portal', target.obj ) - orange sparks surround you. permanent
game.particles( 'sp-Healing Circle', spell.target_loc ) - expanding cloud of holy-looking light.
game.particles( 'sp-Halt Undead', target_item.obj ) - purple miasma at your feet. meh
game.particles( 'sp-Gust of Wind', spell.caster ) - a brief jet erupts from the caster, aimed at where the character is facing
game.particles( 'sp-Gaseous Form', target_item.obj )
game.particles( 'ef-Faerie Fire', target_item.obj ) - yellowish fire surrounds you, beginning with a burst and then reducing in size to a permanent effect
game.particles( 'sp-Dimensional Anchor', target_item.obj ) - creates a black-hole-like object on the ground, with dancing green lines inside translating from the center outwards
game.particles( 'sp-Circle of Doom', spell.target_loc ) - purple particle cloud preceding purple expanding rings. not too impressive. not permanent.
game.particles( 'sp-Clairaudience-Clairvoyance', spell.caster ) - creates sonar rings as well as expanding eye graphic. permanent.
game.particles( 'sp-Cloudkill', cloudkill_obj ) - green noxious eruption, fading to a permanent ring of toxins about 20 feet in diameter
game.particles( 'sp-Chaos Hammer', spell.target_loc ) - a firey/white hammer erupts from the ground, striking the ground and creating a shockwave
game.particles( 'sp-Calm Emotions', spell.caster ) - an expanding ring of particles. leaves small sparkling lights at the end over the char's head
game.particles( 'sp-Calm Animals', spell.target_loc ) - a blanket of particles falls down in a 15 foot diameter, leaving small tracers on the ground and then fading away slowly

game.particles( "sp-Wall of Force", spell.caster ) - permanent yellow rings pulsing/up and down, roughly PC size
game.particles( "sp-Wall of Ice", spell.caster ) - permanent glistening ice shard, roughly PC size
game.particles( "sp-Wall of Fire", spell.caster ) - permanent purple jet, unlike other wall-of effects

game.particles( "sp-cool stuff", spell.caster ) - permanent orange tree-like thing rotating around object

game.particles( "sp-Web Flamed", spell.caster ) - similar to Fireball; one central pillar and ground flare up





game.particles( "sp-abjuration-conjure", spell.caster ) - does nothing
game.particles( "sp-conjuration-conjure", spell.caster ) - does nothing
game.particles( 'Orb-Summon-Earth-Elemental', monster_obj ) - does nothing
game.particles( "sp-enchantment-conjure", spell.caster ) - does nothing
game.particles( "sp-necromancy-conjure", spell.caster ) - does nothing
game.particles( "sp-transmutation-conjure", spell.caster ) - does nothing
game.particles( "sp-evocation-conjure", spell.caster )

Change object's visibility/alpha over time

obj.fade_to( [0-255 value (visibility)], ??? , [rate of change])
# e.g.
# to make obj invisible in about 1 second
obj.fade_to ( 0, 1, 15) 

# NB: Hovering the cursor over an alpha = 0 target will still display the tooltip!

Fade to black, pass time, and (optionally) play movie/sound

game.fade(48800,0,0,1) 
# first number is game time passed, measured in seconds
# second number is what sound should play
# third number is movie played
# fourth number is how long the game fades out in seconds (i.e. for how long you get a black screen)

8. Time

Time an event

game.timevent_add( callback, callback_args_tuple, time_ms, is_realtime )
	# callback - the function to be executed when the time event transpires.
	# callback_args_tuple - a tuple containing the args to be used in the callback. 
	# time_ms - The time to pass (in milliseconds) until the event transpires.
	#	Note: a combat round is supposed to last 6 seconds per D&D rules, but in ToEE it lasts for 1 	second.
	#	Check out Spell795 - Vigor.py (in co8fixes.dat) to see how this should be handled.
	# is_realtime (optional arg) - if set to 1, the timer will use a real time clock, meaning it will also pass time during turn based combat.


# Example: 
# Spell123 - Dimension Door.py
game.timevent_add( fade_back_in, ( target, spell.target_loc, spell ), 750 )

game.timevent_add( fade_back_in, ( target, spell.target_loc, spell ), 750, 1 ) - will count time in real-time (useful for combat, where time is frozen)

NOTE: It's timevent, not timeevent or time_event

USAGE NOTE: once the time event is added to the game, it counts the number specified (in ms).

HOWEVER! The event will only trigger in THE MAP WHERE IT WAS SPAWNED. If you go to another map, it will only trigger when you return to that map! Otherwise you can wait for years and nothing will happen.
It does, however, count the time no matter where you are (i.e. you can pass the time in a completely different area, and it will work, once you return to where it was triggered that is)

Note on callback args

For long term events, this should only consist of objects the game knows how to save to file. Thus you shouldn't use any of the new Temple+ objects here. It's generally best to keep this simple (just numeric types, PyObjHandle and PyDice).

An example of a mistake you can easily make -

target = spell.target_list[0]
game.timevent_add( some_callback, ( target ), t) # BAD!!!! GAME WILL CRASH!

This is wrong because target is not a PyObjHandle object - it's a PySpellTarget object, which will become invalid when the spell expires.

Instead, you should do:

target = spell.target_list[0]
game.timevent_add( some_callback, ( target.obj ), t) # GOOD!!!!

Get Current Time

Hours elapsed from start of game + 2367: (i.e. there's an offset of 2367)

game.time.time_game_in_hours2(game.time)

Seconds elapsed from start of game:

game.time.time_game_in_seconds(game.time)
	# Likewise, there's an offset of about 2367 hours, plus a few seconds perhaps.
	# I.e. it starts at about 2367*60*60 = 8521200
	# Tested ok to at least day 1023
	# game flags should be able to store up to day 11208 at least (over 30 game years)

Shorter method:

game.time.time_in_game_in_seconds()

Year: game.time.time_game_in_years(game.time) Month (for date; ranges from 1 to 13; is 4 at the beginning of the game): game.time.time_game_in_months(game.time) Day (for date; ranges from 1 to 28; is 15 at the beginning of the game): game.time.time_game_in_days(game.time) Hour (of the day; goes from 0-23, well, haven't tested for exact midnight yet): game.time.time_game_in_hours(game.time) Minute: game.time.time_game_in_minutes(game.time)

In general, the date at the beginning of the game is 15/4/579, 15:00


Change the running script's ID:

game.new_sid = 0 

Change any script's ID for particular object: obj_sheker.scripts[9]=9 ## 9 is the number for san_dialog and 9 is someone's py script number mnemonic: dying - 12 monkeys dialogue9

9 - san_dialog 10 - san_first_heartbeat - note - this still runs even if NPC is in your party. Also note: you should return RUN_DEFAULT or bad things can happen! (e.g. had dialogue script failures on heartbeat due to this...)
12 - san_dying
13 - san_enter_combat - entering combat mode
14 - san_exit_combat - exiting combat mode; doesn't work when you're dead; works for unconscious enemies that ended battle and auto-died
15 - san_start_combat - critter's turn; unconscious combatants execute this too BUT THEY SEEM TO EXECUTE HALF-ASSEDLY
16 - san_end_combat - end of round; unconscious combatants execute this too BUT THEY SEEM TO EXECUTE HALF-ASSEDLY
17 - san_buy_object
19 - san_heartbeat - works for OF_OFF objects too; in combat, fires once ON THE NPC's TURN ONLY! ; doesn't work when dialogue is active; works when unconscious, but not when dead 20 - san_leader_killing - ??
21 - san_insert_item - an item associated with this script will activate it when you insert the item into a container (possibly an NPCs body too?)
22 - san_will_kos
23 - san_taking_damage
24 - san_wield_on
28 - san_remove_item
36 - san_join (0x24h)
37 - san_disband (0x25h)
38 - san_new_map
39 - san_trap
41 - san_spell_cast(attachee, triggerer, spell) - triggered when you cast a spell on attachee

Execute one of the above scripts: (AWESOME!)

obj.object_script_execute( obj, 18 )

PC working scripts: san_new_map san_exit_combat san_dialog san_dying


Scan NPCs in the vicinity of attachee.location, and make them non-hostile

for npc in game.obj_list_vicinity(attachee.location,OLC_NPC):
		for pc in game.party:
			npc.ai_shitlist_remove( pc )
			npc.reaction_set( pc, 50 )

!!ACHTUNG!! if running from san_start_combat, it is important to return SKIP_DEFAULT so they don't perform actions that could provoke AoO!



Display a message box (or text box, as in the tutorial):

a = game.obj_create(11001,game.leader.location)
a.obj_set_int(obj_f_written_text_start_line, 10)
game.written_ui_show(a)
a.destroy()

The script above creates a note, assigns a line to it (referenced by the written_ui.mes file, which contains a link to the help.tab file)


Change an object's standpoint ID:

attachee.standpoint_set( STANDPOINT_NIGHT, 164 )
attachee.standpoint_set( STANDPOINT_DAY, 164 )

Note that this can't make an NPC appear on a different map! That's what caused problems with Corl, Paida, Mickey, Wicked, and maybe others. To move mobs across maps, the game uses the DayNight.nxd file, which can't be changed ingame.


Object flags:

Switch on/off:

attachee.object_flag_set(OF_OFF)
attachee.object_flag_unset(OF_OFF)

obj.critter_flags_get() obj.critter_flag_set( OCF_MUTE ) obj.critter_flag_unset( OCF_MUTE )

obj.object_flags_get() obj.object_flag_set() obj.object_flag_unset()

obj.npc_flags_get() obj.npc_flag_set() obj.npc_flag_unset()

obj.item_flag_set() ... ...

obj.critter_flags_get() - returns the critter flags as an integer. You can check them as follows:
	obj.critter_flags_get() & OCF_MUTE == OCF_MUTE
	obj.critter_flags_get() & (OCF_MUTE + OCF_IS_CONCEALED) == (OCF_MUTE + OCF_IS_CONCEALED) ##checks both muteness and concealedness
	
	# the & operator is a bitwise AND operator, e.g. 13 & 6 would translate to 1101 & 0110, which would return 0100 in binary, which equals 4 in decimal
	# OCF_MUTE, OCF_IS_CONCEALED are merely constants representing the bits where this information is stored
	# for instance, type OCF_MUTE into the console, and it returns 8192, which is 10000000000000 in binary
	# OCF_IS_MUTE returns 1 in the console, which is also 1 in binary
	# OCF_MUTE + OCF_IS_CONCEALED = 8193, which is 10000000000001 in binary

For a complete list of internal flags, see the world builder / Co8 thread

Abridged List:

OF_OFF OF_CLICK_THROUGH

ONF_KOS

ONF_WAYPOINTS_DAY - makes the NPC go through the waypoints ONF_WAYPOINTS_NIGHT - same, for nighttime ONF_USE_ALERTPOINTS - hmm...?



Internal Variables and Flags:

Read/Modify internal variables:

attachee.obj_get_int(obj_f_npc_faction)

a = attachee.obj_get_int(obj_f_npc_pad_i_5)
attachee.obj_set_int( obj_f_npc_pad_i_5, 1 )

obj_f_critter_description_unknown - contains the reference to the critter's name if you haven't spoken to it yet; can be changed by set_int

Big List of Internal Flags and Variables: (accessed via obj_get_int or obj_set_int) Note that messing with some of these may be dangerous, as some of them are floating variables While the functions available for manipulating these only deal with INTEGERS. The obj_f_whatever_pad_i_# internal variables are safe for manipulating and may be used to store local information (i.e. in place of game.global_vars[], when you don't need outside scripting to know the state)

Useful internal variables:


obj_f_pad_i_7=50 - type of thrown weapon obj_f_pad_i_8=51 - quantity of thrown / type of shield obj_f_pad_i_9=52 - type of melee weapon obj_f_pad_i_0=53 - original (protos.tab) strategy

obj_f_critter_pad_i_1=294 obj_f_critter_pad_i_4=320 obj_f_critter_pad_i_5=321 obj_f_critter_pad_i_3=325

obj_f_pc_pad_i_2=348

obj_f_npc_pad_i_3=379 obj_f_npc_pad_i_4=380 - npc_set / npc_get obj_f_npc_pad_i_5=381 Livonya casting of Web for targetting


obj_f_begin=0 obj_f_current_aid=1 is actually obj_f_location; type 4 obj_f_location=2 is actually offset_x type 0F obj_f_offset_x=3 is actually offset_y type 0F obj_f_offset_y=4 type 3 obj_f_shadow=5 obj_f_overlay_fore=6 obj_f_overlay_back=7 obj_f_underlay=8 is actualy obj_f_mode_scale obj_f_blit_flags=9 obj_f_blit_color=10 obj_f_blit_alpha=11 obj_f_scale=12 type 0F obj_f_light_flags=13 type 0F obj_f_light_aid=14 type 0F obj_f_light_color=15 type 3 obj_f_overlay_light_flags=16 type 0F (block that runs until obj_f_blocking_mask) obj_f_overlay_light_aid=17 obj_f_overlay_light_color=18 obj_f_flags=19 obj_f_spell_flags=20 obj_f_blocking_mask=21 type 0F obj_f_name=22 this is actually obj_f_object_flags!!! type 03 (runs until ) obj_f_description=23 obj_f_aid=24 obj_f_destroyed_aid=25 obj_f_size=26 obj_f_hp_pts=27 - base hp (doesn't account for CON bonus, etc.) obj_f_hp_adj=28 - doesn't seem to affect anything obj_f_hp_damage=29 - indeed contains amount of lethal damage taken obj_f_material=30 type 03 obj_f_scripts_idx=31 type 09 obj_f_sound_effect=32 type 03 obj_f_category=33 type 03 obj_f_rotation=34 type 0F obj_f_speed_walk=35 type 0F obj_f_speed_run=36 type 0F obj_f_base_mesh=37 - type 03 changes the base mesh, but not immediately (effects on map transition) obj_f_base_anim=38 type 03 obj_f_radius=39 - was not able to change, wasn't an integer anyway (possibly floating point?) obj_f_3d_render_height=40 obj_f_conditions=41 - type 07 obj_f_condition_arg0=42 type 07 obj_f_permanent_mods=43 type 07 obj_f_initiative=44 obj_f_dispatcher=45 obj_f_subinitiative=46 obj_f_secretdoor_flags=47 obj_f_secretdoor_effectname=48 obj_f_secretdoor_dc=49 obj_f_pad_i_7=50 obj_f_pad_i_8=51 obj_f_pad_i_9=52 obj_f_pad_i_0=53 obj_f_offset_z=54 obj_f_rotation_pitch=55 obj_f_pad_f_3=56 obj_f_pad_f_4=57 obj_f_pad_f_5=58 obj_f_pad_f_6=59 obj_f_pad_f_7=60 obj_f_pad_f_8=61 obj_f_pad_f_9=62 obj_f_pad_f_0=63 obj_f_pad_i64_0=64 type 04 obj_f_pad_i64_1=65 obj_f_pad_i64_2=66 obj_f_pad_i64_3=67 obj_f_pad_i64_4=68 obj_f_last_hit_by=69 - type 0C crashes the game... obj_f_pad_obj_1=70 - type 0C obj_f_pad_obj_2=71 - type 0C obj_f_pad_obj_3=72 - type 0C obj_f_pad_obj_4=73 - type 0C obj_f_permanent_mod_data=74 type 07 obj_f_attack_types_idx=75 type 07 obj_f_attack_bonus_idx=76 type 07 obj_f_strategy_state=77 type 07 obj_f_pad_ias_4=78 type 07 obj_f_pad_i64as_0=79 type 08 obj_f_pad_i64as_1=80 type 08 obj_f_pad_i64as_2=81 type 08 obj_f_pad_i64as_3=82 type 08 obj_f_pad_i64as_4=83 type 08 obj_f_pad_objas_0=84 type 0D obj_f_pad_objas_1=85 type 0D obj_f_pad_objas_2=86 type 0D obj_f_end=87

obj_f_portal_begin=88 obj_f_portal_flags=89 obj_f_portal_lock_dc=90 obj_f_portal_key_id=91 obj_f_portal_notify_npc=92 obj_f_portal_pad_i_1=93 obj_f_portal_pad_i_2=94 obj_f_portal_pad_i_3=95 obj_f_portal_pad_i_4=96 obj_f_portal_pad_i_5=97 obj_f_portal_pad_obj_1=98 type 0C obj_f_portal_pad_ias_1=99 obj_f_portal_pad_i64as_1=100 obj_f_portal_end=101

obj_f_container_begin=102 obj_f_container_flags=103 obj_f_container_lock_dc=104 obj_f_container_key_id=105 obj_f_container_inventory_num=106 obj_f_container_inventory_list_idx=107 type 0D obj_f_container_inventory_source=108 type 0C obj_f_container_notify_npc=109 type 0C obj_f_container_pad_i_1=110 obj_f_container_pad_i_2=111 obj_f_container_pad_i_3=112 obj_f_container_pad_i_4=113 obj_f_container_pad_i_5=114 obj_f_container_pad_obj_1=115 obj_f_container_pad_obj_2=116 obj_f_container_pad_ias_1=117 obj_f_container_pad_i64as_1=118 obj_f_container_pad_objas_1=119 obj_f_container_end=120

obj_f_scenery_begin=121 obj_f_scenery_flags=122 obj_f_scenery_pad_obj_0=123 obj_f_scenery_respawn_delay=124 obj_f_scenery_pad_i_0=125 obj_f_scenery_pad_i_1=126 obj_f_scenery_teleport_to=127 obj_f_scenery_pad_i_4=128 obj_f_scenery_pad_i_5=129 obj_f_scenery_pad_obj_1=130 obj_f_scenery_pad_ias_1=131 obj_f_scenery_pad_i64as_1=132 obj_f_scenery_end=133

obj_f_projectile_begin=134 obj_f_projectile_flags_combat=135 obj_f_projectile_flags_combat_damage=136 obj_f_projectile_parent_weapon=137 obj_f_projectile_parent_ammo=138 obj_f_projectile_part_sys_id=139 obj_f_projectile_acceleration_x=140 obj_f_projectile_acceleration_y=141 obj_f_projectile_acceleration_z=142 obj_f_projectile_pad_i_4=143 obj_f_projectile_pad_obj_1=144 obj_f_projectile_pad_obj_2=145 obj_f_projectile_pad_obj_3=146 obj_f_projectile_pad_ias_1=147 obj_f_projectile_pad_i64as_1=148 obj_f_projectile_pad_objas_1=149 obj_f_projectile_end=150

obj_f_item_begin=151 obj_f_item_flags=152 obj_f_item_parent=153 type 0C obj_f_item_weight=154 obj_f_item_worth=155 obj_f_item_inv_aid=156 obj_f_item_inv_location=157 obj_f_item_ground_mesh=158 obj_f_item_ground_anim=159 obj_f_item_description_unknown=160 type 03 obj_f_item_description_effects=161 type 03 obj_f_item_spell_idx=162 type 0E obj_f_item_spell_idx_flags=163 type 03 obj_f_item_spell_charges_idx=164 type 03 obj_f_item_ai_action=165 type 03 obj_f_item_wear_flags=166 obj_f_item_material_slot=167 obj_f_item_quantity=168 obj_f_item_pad_i_1=169 obj_f_item_pad_i_2=170 obj_f_item_pad_i_3=171 obj_f_item_pad_i_4=172 obj_f_item_pad_i_5=173 obj_f_item_pad_i_6=174 obj_f_item_pad_obj_1=175 obj_f_item_pad_obj_2=176 obj_f_item_pad_obj_3=177 obj_f_item_pad_obj_4=178 obj_f_item_pad_obj_5=179 obj_f_item_pad_wielder_condition_array=180 obj_f_item_pad_wielder_argument_array=181 obj_f_item_pad_i64as_1=182 obj_f_item_pad_i64as_2=183 obj_f_item_pad_objas_1=184 obj_f_item_pad_objas_2=185 obj_f_item_end=186

obj_f_weapon_begin=187 obj_f_weapon_flags=188 obj_f_weapon_range=189 obj_f_weapon_ammo_type=190 obj_f_weapon_ammo_consumption=191 obj_f_weapon_missile_aid=192 obj_f_weapon_crit_hit_chart=193 obj_f_weapon_attacktype=194 obj_f_weapon_damage_dice=195 obj_f_weapon_animtype=196 obj_f_weapon_type=197 obj_f_weapon_crit_range=198 obj_f_weapon_pad_i_1=199 obj_f_weapon_pad_i_2=200 obj_f_weapon_pad_obj_1=201 obj_f_weapon_pad_obj_2=202 obj_f_weapon_pad_obj_3=203 obj_f_weapon_pad_obj_4=204 obj_f_weapon_pad_obj_5=205 obj_f_weapon_pad_ias_1=206 obj_f_weapon_pad_i64as_1=207 obj_f_weapon_end=208

obj_f_ammo_begin=209 obj_f_ammo_flags=210 obj_f_ammo_quantity=211 obj_f_ammo_type=212 obj_f_ammo_pad_i_1=213 obj_f_ammo_pad_i_2=214 obj_f_ammo_pad_obj_1=215 obj_f_ammo_pad_ias_1=216 obj_f_ammo_pad_i64as_1=217 obj_f_ammo_end=218

obj_f_armor_begin=219 obj_f_armor_flags=220 obj_f_armor_ac_adj=221 obj_f_armor_max_dex_bonus=222 obj_f_armor_arcane_spell_failure=223 obj_f_armor_armor_check_penalty=224 obj_f_armor_pad_i_1=225 obj_f_armor_pad_ias_1=226 obj_f_armor_pad_i64as_1=227 obj_f_armor_end=228

obj_f_money_begin=229 obj_f_money_flags=230 obj_f_money_quantity=231 obj_f_money_type=232 obj_f_money_pad_i_1=233 obj_f_money_pad_i_2=234 obj_f_money_pad_i_3=235 obj_f_money_pad_i_4=236 obj_f_money_pad_i_5=237 obj_f_money_pad_ias_1=238 obj_f_money_pad_i64as_1=239 obj_f_money_end=240

obj_f_food_begin=241 obj_f_food_flags=242 obj_f_food_pad_i_1=243 obj_f_food_pad_i_2=244 obj_f_food_pad_ias_1=245 obj_f_food_pad_i64as_1=246 obj_f_food_end=247

obj_f_scroll_begin=248 obj_f_scroll_flags=249 obj_f_scroll_pad_i_1=250 obj_f_scroll_pad_i_2=251 obj_f_scroll_pad_ias_1=252 obj_f_scroll_pad_i64as_1=253 obj_f_scroll_end=254

obj_f_key_begin=255 obj_f_key_key_id=256 obj_f_key_pad_i_1=257 obj_f_key_pad_i_2=258 obj_f_key_pad_ias_1=259 obj_f_key_pad_i64as_1=260 obj_f_key_end=261

obj_f_written_begin=262 obj_f_written_flags=263 obj_f_written_subtype=264 obj_f_written_text_start_line=265 obj_f_written_text_end_line=266 obj_f_written_pad_i_1=267 obj_f_written_pad_i_2=268 obj_f_written_pad_ias_1=269 obj_f_written_pad_i64as_1=270 obj_f_written_end=271

obj_f_bag_begin=272 obj_f_bag_flags=273 obj_f_bag_size=274 obj_f_bag_end=275

obj_f_generic_begin=276 obj_f_generic_flags=277 obj_f_generic_usage_bonus=278 obj_f_generic_usage_count_remaining=279 obj_f_generic_pad_ias_1=280 obj_f_generic_pad_i64as_1=281 obj_f_generic_end=282

obj_f_critter_begin=283 obj_f_critter_flags=284 obj_f_critter_flags2=285 obj_f_critter_abilities_idx=286 type 05 obj_f_critter_level_idx=287 type 07 obj_f_critter_race=288 obj_f_critter_gender=289 obj_f_critter_age=290 obj_f_critter_height=291 obj_f_critter_weight=292 obj_f_critter_experience=293 obj_f_critter_pad_i_1=294 obj_f_critter_alignment=295 obj_f_critter_deity=296 obj_f_critter_domain_1=297 obj_f_critter_domain_2=298 obj_f_critter_alignment_choice=299 - determines whether the cleric spontaneously casts heal or inflict spells. 1 for heal, anything else for inflict obj_f_critter_school_specialization=300 obj_f_critter_spells_known_idx=301 obj_f_critter_spells_memorized_idx=302 obj_f_critter_spells_cast_idx=303 obj_f_critter_feat_idx=304 obj_f_critter_feat_count_idx=305 obj_f_critter_fleeing_from=306 obj_f_critter_portrait=307 obj_f_critter_money_idx=308 obj_f_critter_inventory_num=309 number of items in inventory! obj_f_critter_inventory_list_idx=310 type 0D obj_f_critter_inventory_source=311 obj_f_critter_description_unknown=312 obj_f_critter_follower_idx=313 type 0D obj_f_critter_teleport_dest=314 type 04 obj_f_critter_teleport_map=315 obj_f_critter_death_time=316 obj_f_critter_skill_idx=317 obj_f_critter_reach=318 obj_f_critter_subdual_damage=319 obj_f_critter_pad_i_4=320 obj_f_critter_pad_i_5=321 obj_f_critter_sequence=322 obj_f_critter_hair_style=323 obj_f_critter_strategy=324 obj_f_critter_pad_i_3=325 obj_f_critter_monster_category=326 type 04 crashes game! use obj.is_category_type() and obj.is_category_subtype() instead (they read the two 32-bit values here) obj_f_critter_pad_i64_2=327 obj_f_critter_pad_i64_3=328 obj_f_critter_pad_i64_4=329 obj_f_critter_pad_i64_5=330 obj_f_critter_damage_idx=331 obj_f_critter_attacks_idx=332 obj_f_critter_seen_maplist=333 type 08 obj_f_critter_pad_i64as_2=334 obj_f_critter_pad_i64as_3=335 obj_f_critter_pad_i64as_4=336 obj_f_critter_pad_i64as_5=337 obj_f_critter_end=338

obj_f_pc_begin=339 obj_f_pc_flags=340 obj_f_pc_pad_ias_0=341 obj_f_pc_pad_i64as_0=342 obj_f_pc_player_name=343 type 0B obj_f_pc_global_flags=344 obj_f_pc_global_variables=345 obj_f_pc_voice_idx=346 obj_f_pc_roll_count=347 obj_f_pc_pad_i_2=348 obj_f_pc_weaponslots_idx=349 obj_f_pc_pad_ias_2=350 obj_f_pc_pad_i64as_1=351 obj_f_pc_end=352

obj_f_npc_begin=353 obj_f_npc_flags=354 obj_f_npc_leader=355 type 0C obj_f_npc_ai_data=356 obj_f_npc_combat_focus=357 type 0C obj_f_npc_who_hit_me_last=358 type 0C obj_f_npc_waypoints_idx=359 type 08 obj_f_npc_waypoint_current=360 obj_f_npc_standpoint_day_INTERNAL_DO_NOT_USE=361 type 04 obj_f_npc_standpoint_night_INTERNAL_DO_NOT_USE=362 obj_f_npc_faction=363 - type 07 obj_f_npc_retail_price_multiplier=364 obj_f_npc_substitute_inventory=365 type 0C obj_f_npc_reaction_base=366 obj_f_npc_challenge_rating=367 obj_f_npc_reaction_pc_idx=368 type 0D obj_f_npc_reaction_level_idx=369 obj_f_npc_reaction_time_idx=370 obj_f_npc_generator_data=371 obj_f_npc_ai_list_idx=372 type 0D obj_f_npc_save_reflexes_bonus=373 obj_f_npc_save_fortitude_bonus=374 obj_f_npc_save_willpower_bonus=375 obj_f_npc_ac_bonus=376 obj_f_npc_add_mesh=377 obj_f_npc_waypoint_anim=378 obj_f_npc_pad_i_3=379 - used for internal flags, bitwise; 14587 has bytes written into it! obj_f_npc_pad_i_4=380 obj_f_npc_pad_i_5=381 obj_f_npc_ai_flags64=382 type 04 obj_f_npc_pad_i64_2=383 obj_f_npc_pad_i64_3=384 obj_f_npc_pad_i64_4=385 obj_f_npc_pad_i64_5=386 obj_f_npc_hitdice_idx=387 obj_f_npc_ai_list_type_idx=388 type 07 obj_f_npc_pad_ias_3=389 obj_f_npc_pad_ias_4=390 obj_f_npc_pad_ias_5=391 obj_f_npc_standpoints=392 type 08 obj_f_npc_pad_i64as_2=393 obj_f_npc_pad_i64as_3=394 obj_f_npc_pad_i64as_4=395 obj_f_npc_pad_i64as_5=396 obj_f_npc_end=397

obj_f_trap_begin=398 obj_f_trap_flags=399 obj_f_trap_difficulty=400 obj_f_trap_pad_i_2=401 obj_f_trap_pad_ias_1=402 obj_f_trap_pad_i64as_1=403 obj_f_trap_end=404

obj_f_total_normal=405

obj_f_transient_begin=406 obj_f_render_color=407 obj_f_render_colors=408 obj_f_render_palette=409 obj_f_render_scale=410 obj_f_render_alpha=411 obj_f_render_x=412 obj_f_render_y=413 obj_f_render_width=414 obj_f_render_height=415 obj_f_palette=416 obj_f_color=417 obj_f_colors=418 obj_f_render_flags=419 obj_f_temp_id=420 obj_f_light_handle=421 obj_f_overlay_light_handles=422 obj_f_internal_flags=423 obj_f_find_node=424 obj_f_animation_handle=425 obj_f_grapple_state=426 obj_f_transient_end=427

obj_f_type=428 - returns type (as in obj_t_pc etc.) obj_f_prototype_handle=429


9. Caster Reference

Wizard/Cleric/Druid:

spells per day
base: 1, 2 2, 3 3 3, 4 4 4 4, ... (1 at first eligibility level)
bonus: ability bonus -> highest level. If over 4, pattern is:
... 3 3 2 2 2 2 1 1 1 1 (starting at spell level 1, ending at ability bonus)

e.g. Lev 3, Int 16:
1+1 = 2 level 2
2+1 = 3 level 1

Lev 5, Int 18:
1+1 = 2 level 3
2+1 = 3 level 2
3+1 = 4 level 1

Lev 9, Int 18:
1+0 = 1 level 5
2+1 = 3 level 4
3+1 = 4 level 3
4+1 = 5 level 2
4+1 = 5 level 1

Wizard feats:
bonus feat on levels 5, 10, 15,...

Spells:

Wiz 1 - Magic Missile, Grease, Sleep; Enlarge Person, Shield
2 - Web, Glitterdust

Druid 1 - Cure Light Wounds, Magic Stone, Entangle, Produce Flame, Summon Nature's Ally I; Magic Fang, Shillelagh

Clr
1 - Bane, Bless, Cause Fear, Command, Cure Light Wounds, Divine Favor, Obscuring Mist, Sanctuary, Shield of Faith, Summon Monster I
2 - Aid, Bears Endurance, Hold Person, Inflict Moderate Wounds, Silence, Sound Burst, Summon Monster II
3 - Animate Dead, Bestow Curse, Blindness/Deafness, Cure Serious Wounds, Dispel Magic, Inflict Serious Wounds, Prayer, Searing Light, Summon Monster III; prebuff: Protection From Energy
4 - Cure Critical Wounds, Inflict Critical Wounds, Divine Power, Greater Magic Weapon, Poison, Summon Monster IV; prebuff: Freedom of Movement,
5 - Slay Living, Righteous Might, Flame Strike, Greater Command, Summon Monster V; prebuff: Spell Resistance
Domains:

Death 1 - Cause Fear 2 - Death Knell 3 - Animate Dead 4 - Death Ward 5 - Slay Living
Law 1 - Prot from Chaos 2 - Calm Emotions 3 - Magic Circle Against Chaos 4 - Hold Monster 5 - Dispel Chaos
Fire 1 - Burning Hands 2 - Resist Energy 3 - [none in ToEE] 4 - Fire Shield 5 - Dispel Fire
Sun 1 - Endure Elements 2 - Heat Metal 3 - Searing Light 4 - Fire Shield 5 - Flame Strike

Item Worth from Crafting Enchantments: (total)

+1 +2,000 gp +2 +8,000 gp +3 +18,000 gp +4 +32,000 gp +5 +50,000 gp +6 +72,000 gp3 +7 +98,000 gp3 +8 +128,000 gp3 +9 +162,000 gp3 +10 +200,000 gp3

#9. PyObjHandle Methods List

{"__getstate__", PyObjHandle_getstate, METH_VARARGS, NULL},
{"__reduce__", PyObjHandle_reduce, METH_VARARGS, NULL},
{"__setstate__", PyObjHandle_setstate, METH_VARARGS, NULL},
{ "add_to_initiative", PyObjHandle_AddToInitiative, METH_VARARGS, NULL },
{ "ai_flee_add", PyObjHandle_AiFleeAdd, METH_VARARGS, NULL },
{ "ai_follower_add", PyObjHandle_AiFollowerAdd, METH_VARARGS, NULL },
{ "ai_follower_remove", ReturnZero, METH_VARARGS, NULL },
{ "ai_follower_atmax", ReturnZero, METH_VARARGS, NULL },
{ "ai_shitlist_add", PyObjHandle_AiShitlistAdd, METH_VARARGS, NULL },
{ "ai_shitlist_remove", PyObjHandle_AiShitlistRemove, METH_VARARGS, NULL },
{ "ai_stop_attacking", PyObjHandle_AiStopAttacking, METH_VARARGS, NULL },
{ "allegiance_shared", PyObjHandle_AllegianceShared, METH_VARARGS, NULL },
{ "anim_callback", PyObjHandle_AnimCallback, METH_VARARGS, NULL },
{ "anim_goal_interrupt", PyObjHandle_AnimGoalInterrupt, METH_VARARGS, NULL },
{ "arcane_spell_level_can_cast", PyObjHandle_ArcaneSpellLevelCanCast, METH_VARARGS, NULL },
{ "attack", PyObjHandle_Attack, METH_VARARGS, NULL },
{ "award_experience", PyObjHandle_AwardExperience, METH_VARARGS, NULL },
{"balor_death", PyObjHandle_BalorDeath, METH_VARARGS, NULL },
{"begin_dialog", PyObjHandle_BeginDialog, METH_VARARGS, NULL},
{"begian_dialog", PyObjHandle_BeginDialog, METH_VARARGS, "I make this typo so much that I want it supported :P" },
{"barter", PyObjHandle_Barter, METH_VARARGS, NULL },
{"cast_spell", PyObjHandle_CastSpell, METH_VARARGS, NULL },
{"can_see", PyObjHandle_HasLos, METH_VARARGS, NULL },
{ "concealed_set", PyObjHandle_ConcealedSet, METH_VARARGS, NULL },
{ "condition_add_with_args", PyObjHandle_ConditionAddWithArgs, METH_VARARGS, NULL },
{ "condition_add", PyObjHandle_ConditionAddWithArgs, METH_VARARGS, NULL },
{ "container_flags_get", GetFlags<obj_f_container_flags>, METH_VARARGS, NULL },
{ "container_flag_set", SetFlag<obj_f_container_flags>, METH_VARARGS, NULL },
{ "container_flag_unset", ClearFlag<obj_f_container_flags>, METH_VARARGS, NULL },
{ "container_toggle_open", PyObjHandle_ContainerToggleOpen, METH_VARARGS, NULL },
{ "critter_flags_get", GetFlags<obj_f_critter_flags>, METH_VARARGS, NULL },
{ "critter_flag_set", SetFlag<obj_f_critter_flags>, METH_VARARGS, NULL },
{ "critter_flag_unset", ClearFlag<obj_f_critter_flags>, METH_VARARGS, NULL },
{ "critter_get_alignment", PyObjHandle_CritterGetAlignment, METH_VARARGS, NULL },
{ "critter_kill", PyObjHandle_Kill, METH_VARARGS, NULL },
{ "critter_kill_by_effect", PyObjHandle_KillByEffect, METH_VARARGS, NULL },
{ "d20_query", PyObjHandle_D20Query, METH_VARARGS, NULL },
{ "d20_query_has_spell_condition", PyObjHandle_D20QueryHasSpellCond, METH_VARARGS, NULL },
{ "d20_query_with_data", PyObjHandle_D20QueryWithData, METH_VARARGS, NULL },
{ "d20_query_test_data", PyObjHandle_D20QueryTestData, METH_VARARGS, NULL },
{ "d20_query_get_data", PyObjHandle_D20QueryGetData, METH_VARARGS, NULL },
{ "d20_send_signal", PyObjHandle_D20SendSignal, METH_VARARGS, NULL },
{ "d20_send_signal_ex", PyObjHandle_D20SendSignalEx, METH_VARARGS, NULL },
{ "d20_status_init", PyObjHandle_D20StatusInit, METH_VARARGS, NULL },
{ "damage", PyObjHandle_Damage, METH_VARARGS, NULL },
{ "damage_with_reduction", PyObjHandle_DamageWithReduction, METH_VARARGS, NULL },
{ "destroy", PyObjHandle_Destroy, METH_VARARGS, NULL },
{ "distance_to", PyObjHandle_DistanceTo, METH_VARARGS, NULL },
{ "divine_spell_level_can_cast", PyObjHandle_DivineSpellLevelCanCast, METH_VARARGS, NULL },
{ "dominate", PyObjHandle_Dominate, METH_VARARGS, NULL },
{ "faction_has", PyObjHandle_FactionHas, METH_VARARGS, "Check if NPC has faction. Doesn't work on PCs!" },
{ "faction_add", PyObjHandle_FactionAdd, METH_VARARGS, "Adds faction to NPC. Doesn't work on PCs!" },
{ "fade_to", PyObjHandle_FadeTo, METH_VARARGS, NULL },
{ "feat_add", PyObjHandle_ObjFeatAdd, METH_VARARGS, "Gives you a feat" },
{ "fall_down", PyObjHandle_FallDown, METH_VARARGS, "Makes a Critter fall down" },
{ "follower_add", PyObjHandle_FollowerAdd, METH_VARARGS, NULL },
{ "follower_remove", PyObjHandle_FollowerRemove, METH_VARARGS, NULL },
{ "follower_atmax", PyObjHandle_FollowerAtMax, METH_VARARGS, NULL },
{ "footstep", PyObjHandle_Footstep, METH_VARARGS, NULL },
{ "float_line", PyObjHandle_FloatLine, METH_VARARGS, NULL },
{ "float_mesfile_line", PyObjHandle_FloatMesFileLine, METH_VARARGS, NULL },
{ "float_text_line", PyObjHandle_FloatTextLine, METH_VARARGS, NULL },
{ "get_base_attack_bonus", PyObjHandle_GetBaseAttackBonus, METH_VARARGS, NULL },
{ "get_category_type", PyObjHandle_GetCategoryType, METH_VARARGS, NULL },
{ "get_initiative", PyObjHandle_GetInitiative, METH_VARARGS, NULL },
{ "get_deity", PyObjHandle_GetDeity, METH_VARARGS, NULL },
{ "get_wield_type", PyObjHandle_GetWieldType, METH_VARARGS, NULL },
{ "group_list", PyObjHandle_GroupList, METH_VARARGS, NULL },

{ "has_atoned", PyObjHandle_HasAtoned, METH_VARARGS, NULL },
{ "has_feat", PyObjHandle_HasFeat, METH_VARARGS, NULL },
{ "has_follower", PyObjHandle_HasFollower, METH_VARARGS, NULL },
{ "has_item", PyObjHandle_HasItem, METH_VARARGS, NULL },
{ "has_los", PyObjHandle_HasLos, METH_VARARGS, NULL },
{ "has_met", PyObjHandle_HasMet, METH_VARARGS, NULL },
{ "has_spell_effects", PyObjHandle_HasSpellEffects, METH_VARARGS, NULL },
{ "has_wielded", PyObjHandle_HasWielded, METH_VARARGS, NULL },
{ "hasMet", PyObjHandle_HasMet, METH_VARARGS, NULL },
{ "heal", PyObjHandle_Heal, METH_VARARGS, NULL },
{ "healsubdual", PyObjHandle_HealSubdual, METH_VARARGS, NULL },

{ "identify_all", PyObjHandle_IdentifyAll, METH_VARARGS, NULL },
{ "inventory_item", PyObjHandle_InventoryItem, METH_VARARGS, NULL },
{ "is_active_combatant", PyObjHandle_IsActiveCombatant, METH_VARARGS, NULL },
{ "is_category_type", PyObjHandle_IsCategoryType, METH_VARARGS, NULL },
{ "is_category_subtype", PyObjHandle_IsCategorySubtype, METH_VARARGS, NULL },
{ "is_friendly", PyObjHandle_IsFriendly, METH_VARARGS, NULL },
{ "is_unconscious", PyObjHandle_IsUnconscious, METH_VARARGS, NULL },
{ "item_condition_add_with_args", PyObjHandle_ItemConditionAdd, METH_VARARGS, NULL },
{ "item_find", PyObjHandle_ItemFind, METH_VARARGS, NULL },
{ "item_get", PyObjHandle_ItemGet, METH_VARARGS, NULL },
{ "item_transfer_to", PyObjHandle_ItemTransferTo, METH_VARARGS, NULL },
{ "item_find_by_proto", PyObjHandle_ItemFindByProto, METH_VARARGS, NULL },
{ "item_transfer_to_by_proto", PyObjHandle_ItemTransferToByProto, METH_VARARGS, NULL },
{ "item_worn_at", PyObjHandle_ItemWornAt, METH_VARARGS, NULL },
{ "item_flags_get", GetFlags<obj_f_item_flags>, METH_VARARGS, NULL },
{ "item_flag_set", SetFlag<obj_f_item_flags>, METH_VARARGS, NULL },
{ "item_flag_unset", ClearFlag<obj_f_item_flags>, METH_VARARGS, NULL },
{ "item_wield_best_all", PyObjHandle_WieldBestAll, METH_VARARGS, NULL },
{ "leader_get", PyObjHandle_LeaderGet, METH_VARARGS, NULL },
{ "make_wiz", PyObjHandle_MakeWizard, METH_VARARGS, "Makes you a wizard of level N" },
{ "make_class", PyObjHandle_MakeClass, METH_VARARGS, "Makes you a CLASS N of level M" },
{ "money_get", PyObjHandle_MoneyGet, METH_VARARGS, NULL},
{ "money_adj", PyObjHandle_MoneyAdj, METH_VARARGS, NULL},
{ "move", PyObjHandle_Move, METH_VARARGS, NULL },
{ "npc_flags_get", GetFlags<obj_f_npc_flags>, METH_VARARGS, NULL },
{ "npc_flag_set", SetFlag<obj_f_npc_flags>, METH_VARARGS, NULL },
{ "npc_flag_unset", ClearFlag<obj_f_npc_flags>, METH_VARARGS, NULL },

{ "object_event_append", PyObjHandle_ObjectEventAppend, METH_VARARGS, NULL },
{ "obj_get_int", PyObjHandle_GetInt, METH_VARARGS, NULL },
{ "obj_get_idx_int", PyObjHandle_GetIdxInt, METH_VARARGS, NULL },
{ "obj_get_int64", PyObjHandle_GetInt64, METH_VARARGS, "Gets 64 bit field" },
{ "obj_get_obj", PyObjHandle_GetObj, METH_VARARGS, "Gets Object field" },
{ "obj_remove_from_all_groups", PyObjHandle_RemoveFromAllGroups, METH_VARARGS, "Removes the object from all the groups (GroupList, PCs, NPCs, AI controlled followers, Currently Selected" },
{ "obj_set_int", PyObjHandle_SetInt, METH_VARARGS, NULL },
{ "obj_set_obj", PyObjHandle_SetObj, METH_VARARGS, NULL },
{ "obj_set_idx_int", PyObjHandle_SetIdxInt, METH_VARARGS, NULL },
{ "obj_set_int64", PyObjHandle_SetInt64, METH_VARARGS, NULL },
{ "obj_set_idx_int64", PyObjHandle_SetIdxInt64, METH_VARARGS, NULL },
{ "object_flags_get", GetFlags<obj_f_flags>, METH_VARARGS, NULL },
{ "object_flag_set", PyObjHandle_ObjectFlagSet, METH_VARARGS, NULL },
{ "object_flag_unset", PyObjHandle_ObjectFlagUnset, METH_VARARGS, NULL },
{ "object_script_execute", PyObjHandle_ObjectScriptExecute, METH_VARARGS, NULL },
{ "pc_add", PyObjHandle_PCAdd, METH_VARARGS, "Adds object as a PC party member." },
{ "perform_touch_attack", PyObjHandle_PerformTouchAttack, METH_VARARGS, NULL },
{ "portal_flags_get", GetFlags<obj_f_portal_flags>, METH_VARARGS, NULL },
{ "portal_flag_set", SetFlag<obj_f_portal_flags>, METH_VARARGS, NULL },
{ "portal_flag_unset", ClearFlag<obj_f_portal_flags>, METH_VARARGS, NULL },
{ "portal_toggle_open", PyObjHandle_PortalToggleOpen, METH_VARARGS, NULL },
{ "reaction_get", PyObjHandle_ReactionGet, METH_VARARGS, NULL },
{ "reaction_set", PyObjHandle_ReactionSet, METH_VARARGS, NULL },
{ "reaction_adj", PyObjHandle_ReactionAdjust, METH_VARARGS, NULL },
{ "reflex_save_and_damage", PyObjHandle_ReflexSaveAndDamage, METH_VARARGS, NULL },
{ "refresh_turn", PyObjHandle_RefreshTurn, METH_VARARGS, NULL },
{ "reputation_has", PyObjHandle_ReputationHas, METH_VARARGS, NULL },
{ "reputation_add", PyObjHandle_ReputationAdd, METH_VARARGS, NULL },
{ "remove_from_initiative", PyObjHandle_RemoveFromInitiative, METH_VARARGS, NULL },
{ "reputation_remove", PyObjHandle_ReputationRemove, METH_VARARGS, NULL },
{ "resurrect", PyObjHandle_Resurrect, METH_VARARGS, NULL },
{ "rumor_log_add", PyObjHandle_RumorLogAdd, METH_VARARGS, NULL },
{ "runoff", PyObjHandle_RunOff, METH_VARARGS, NULL },
{ "run_to", PyObjHandle_RunTo, METH_VARARGS, NULL },
{ "saving_throw", PyObjHandle_SavingThrow, METH_VARARGS, NULL },
{ "saving_throw_with_args", PyObjHandle_SavingThrow, METH_VARARGS, NULL },
{ "saving_throw_spell", PyObjHandle_SavingThrowSpell, METH_VARARGS, NULL },
{ "secretdoor_detect", PyObjHandle_SecretdoorDetect, METH_VARARGS, NULL },
{ "set_initiative", PyObjHandle_SetInitiative, METH_VARARGS, NULL },
{ "skill_level_get", PyObjHandle_SkillLevelGet, METH_VARARGS, NULL},
{ "skill_ranks_get", PyObjHandle_SkillRanksGet, METH_VARARGS, NULL },
{ "soundmap_critter", PyObjHandle_SoundmapCritter, METH_VARARGS, NULL },
{ "spell_known_add", PyObjHandle_SpellKnownAdd, METH_VARARGS, NULL },
{ "spell_memorized_add", PyObjHandle_SpellMemorizedAdd, METH_VARARGS, NULL },
{ "spell_damage", PyObjHandle_SpellDamage, METH_VARARGS, NULL },
{ "spell_damage_with_reduction", PyObjHandle_SpellDamageWithReduction, METH_VARARGS, NULL },
{ "spell_heal", PyObjHandle_SpellHeal, METH_VARARGS, NULL },
{ "spells_pending_to_memorized", PyObjHandle_PendingToMemorized, METH_VARARGS, NULL },
{ "spells_cast_reset", PyObjHandle_SpellsCastReset, METH_VARARGS, NULL },
{ "spells_memorized_forget", PyObjHandle_MemorizedForget, METH_VARARGS, NULL },
{ "standpoint_set", PyObjHandle_StandpointSet, METH_VARARGS, NULL },
{"stat_level_get", PyObjHandle_StatLevelGet, METH_VARARGS, NULL},
{"stat_base_get", PyObjHandle_StatLevelGetBase, METH_VARARGS, NULL},
{"stat_base_set", PyObjHandle_StatLevelSetBase, METH_VARARGS, NULL},
{"steal_from", PyObjHandle_StealFrom, METH_VARARGS, NULL },
{"turn_towards", PyObjHandle_TurnTowards, METH_VARARGS, NULL},
{"trip_check", PyObjHandle_TripCheck, METH_VARARGS, NULL },
{ "unconceal", PyObjHandle_Unconceal, METH_VARARGS, NULL },

#10. PyGame Methods List

These are the methods you can use from the predefined game object.

{ "create_history_freeform", PyGame_CreateHistoryFreeform, METH_VARARGS, NULL },
{"fade_and_teleport", PyGame_FadeAndTeleport, METH_VARARGS, NULL},
{"fade", PyGame_Fade, METH_VARARGS, NULL},
{ "fnn", PyGame_FindNpcNear, METH_VARARGS, NULL },
{"party_size", PyGame_PartySize, METH_VARARGS, NULL},
{"party_pc_size", PyGame_PartyPcSize, METH_VARARGS, NULL},
{"party_npc_size", PyGame_PartyNpcSize, METH_VARARGS, NULL},
{"obj_list", PyGame_ObjList, METH_VARARGS, NULL},
{"obj_list_vicinity", PyGame_ObjListVicinity, METH_VARARGS, NULL},
{"obj_list_range", PyGame_ObjListRange, METH_VARARGS, NULL},
{"obj_list_cone", PyGame_ObjListCone, METH_VARARGS, NULL},
{"sound", PyGame_Sound, METH_VARARGS, NULL},
// Not implemented, because it needs internal knowledge about the sound coordinate space
// {"sound_local_xy", PyGame_SoundLocalXY, METH_VARARGS, NULL},
{"sound_local_obj", PyGame_SoundLocalObj, METH_VARARGS, NULL},
{"sound_local_loc", PyGame_SoundLocalLoc, METH_VARARGS, NULL},
{"particles", PyGame_Particles, METH_VARARGS, NULL},
{"obj_create", PyGame_ObjCreate, METH_VARARGS, NULL},
{"timeevent_add", PyGame_TimeEventAdd, METH_VARARGS, NULL},
{"timevent_add", PyGame_TimeEventAdd, METH_VARARGS, NULL},
{"map_flags", PyGame_MapFlags, METH_VARARGS, NULL},
{"particles_kill", PyGame_ParticlesKill, METH_VARARGS, NULL},
{"particles_end", PyGame_ParticlesEnd, METH_VARARGS, NULL},
{"savegame", PyGame_SaveGame, METH_VARARGS, NULL},
{"loadgame", PyGame_LoadGame, METH_VARARGS, NULL},
{"update_combat_ui", PyGame_UpdateCombatUi, METH_VARARGS, NULL},
{"update_party_ui", PyGame_UpdatePartyUi, METH_VARARGS, NULL},
{"random_range", PyGame_RandomRange, METH_VARARGS, NULL},
{"target_random_tile_near_get", PyGame_TargetRandomTileNearGet, METH_VARARGS, NULL},
{"get_stat_mod", PyGame_GetStatMod, METH_VARARGS, NULL},
{"ui_show_worldmap", PyGame_UiShowWorldmap, METH_VARARGS, NULL},
{"worldmap_travel_by_dialog", PyGame_WorldmapTravelByDialog, METH_VARARGS, NULL},
{"pfx_call_lightning", PyGame_PfxCallLightning, METH_VARARGS, NULL},
{"pfx_chain_lightning", PyGame_PfxChainLightning, METH_VARARGS, NULL},
{"pfx_lightning_bolt", PyGame_PfxLightningBolt, METH_VARARGS, NULL},
{"gametime_add", PyGame_GametimeAdd, METH_VARARGS, NULL},
{"is_outdoor", PyGame_IsOutdoor, METH_VARARGS, NULL},
{ "scroll_to", PyGame_ScrollTo, METH_VARARGS, NULL },
{"shake", PyGame_Shake, METH_VARARGS, NULL},
{"moviequeue_add", PyGame_MoviequeueAdd, METH_VARARGS, NULL},
{"moviequeue_play", PyGame_MoviequeuePlay, METH_VARARGS, NULL},
{"moviequeue_play_end_game", PyGame_MoviequeuePlayEndGame, METH_VARARGS, NULL},
{"picker", PyGame_Picker, METH_VARARGS, NULL},
{"party_pool", PyGame_PartyPool, METH_VARARGS, NULL},
{"char_ui_hide", PyGame_CharUiHide, METH_VARARGS, NULL},
{"sleep_status_update", PyGame_SleepStatusUpdate, METH_VARARGS, NULL},
{"brawl", PyGame_Brawl, METH_VARARGS, NULL},
{"tutorial_toggle", PyGame_TutorialToggle, METH_VARARGS, NULL},
{"tutorial_is_active", PyGame_TutorialIsActive, METH_VARARGS, NULL},
{"tutorial_show_topic", PyGame_TutorialShowTopic, METH_VARARGS, NULL},
{"combat_is_active", PyGame_CombatIsActive, METH_VARARGS, NULL},
{"written_ui_show", PyGame_WrittenUiShow, METH_VARARGS, NULL},
{"is_daytime", PyGame_IsDaytime, METH_VARARGS, NULL},
{"vlist", PyGame_Vlist, METH_VARARGS, NULL },
{"getproto", PyGame_GetProto, METH_VARARGS, NULL },
{"get_bab_for_class", PyGame_GetBabForClass,METH_VARARGS, NULL },
{"is_save_favored_for_class", PyGame_IsSaveFavoerdForClass,METH_VARARGS, NULL },
// This is some unfinished UI for which the graphics are missing
// {"charmap", PyGame_Charmap, METH_VARARGS, NULL},
Clone this wiki locally