Hi I'm trying to gather information about ScriptId, SAN and python file naming. From what I gathered, ScriptID, that is written both in MOB and Protos references file of format "py<ScriptId><name>.py", for example from Girl (14003) )in protos there is "620 0 0 0 0" for san_exit_combat references "py00620generic_citizen.py". Questions: 1. What is <name> part of python file name? Is is arbitrary? 2. Anyone figured out what four zeros stands for in "620 0 0 0 0"? Is it Counters from WorldEd\..\Scripts dialog? Has anyone researched them? BR, A
1. Yes, the name is arbitrary, it does not need to correspond to anything in the proto. However, and this is very important, the <name> in the script file must match exactly the <name> in the dialog file for it to work properly. So if you script is py00733conan.py, the dialog file must be exactly 00733conan.dlg or it won't work. 2. The only place I've seen any of those zeros not be zeros is in trap protos (see proto 1019, for example). They are never used in ToEE other than for that. I vaguely remember reading somewhere that they are arguments passed into the script file, and left over from Arcanum, but I'm just going on old memory right now. If you experiment with them and find anything out, let us know.
Thank you @marc1967 ! Not sure how it will be defined in Python, but there is exported function available from TemplPlus\python_counters.cpp Code: static PyObject *PyCounters_GetItem(PyObject *obj, Py_ssize_t index) { auto self = (PyCounters*)obj; auto attachment = objects.GetScriptAttachment(self->handle, (int)self->evt); int val; if (attachment.scriptId) { val = (attachment.counters >> (index * 8)) & 0xFF; } else { val = 0; } return PyInt_FromLong(val); } I think it could be like this obj.counters[0], but I'm not sure. But this is Temple Plus addition.
As you can see Counter0 is 8 for Spiked Chest (Tresure Chest 1001) with san_trap as: 32007 8 0 0 0. The script Code: def san_trap( trap, triggerer ): game.particles( trap.partsys, trap.obj ) result = trap.attack( triggerer, 8, 20, 0 ) if (result & D20CAF_HIT): for dmg in trap.damage: if (dmg.type == D20DT_POISON): if (triggerer.saving_throw( 13, D20_Save_Fortitude, D20STD_F_POISON, trap.obj ) == 0): triggerer.condition_add_with_args("Poisoned",dmg.damage.bonus,0) else: d = dmg.damage.clone() if (result & D20CAF_CRITICAL): d.n = d.n * 2 d.bonus = d.bonus * 2 triggerer.damage( trap.obj, dmg.type, d ) return SKIP_DEFAULT Trips::Attack definition Code: D20CAF Traps::Attack(objHndl target, int attackBonus, int criticalHitRangeStart, BOOL ranged) Perhaps this Counter0 was supposed to be used as attackBonus. Not sure. Fun part from Arcanum manual.
Does that work in ToEE at all? I can think of many areas in the IWD mod that would benefit from a working floor trap.
Among Object Types, there is one of type "obj_t_trap". Code: public enum ObjectType : UInt32 { obj_t_portal = 0, obj_t_container = 1, obj_t_scenery = 2, obj_t_projectile = 3, obj_t_weapon = 4, obj_t_ammo = 5, obj_t_armor = 6, obj_t_money = 7, obj_t_food = 8, obj_t_scroll = 9, obj_t_key = 10, obj_t_written = 11, obj_t_generic = 12, obj_t_pc = 13, obj_t_npc = 14, obj_t_trap = 15, obj_t_bag = 16 } I will try to find if there is actual object instance among mob and sec files of that type.