For a proto, let's say I want to create multiple san_blah scripts for it. However, I want these separate scripts for the proto for THAT INSTANCE of the proto to interact with one another I.E. share a variable between that proto's scripts that apply to an instance of that proto in game. Am I talking nonsense, or does anyone have experience on this sort of thing?
I've had to read this a few times to try to understand it but since you said "variable" perhaps you need the individual variables? These can be set and read as follows: attachee.obj_set_int( obj_f_npc_pad_i_3, x ) x = attachee.obj_get_int( obj_f_npc_pad_i_3) They are attached to the object rather than a global flag so if you spawn 100 identical protos, each will have their own vars this way. There are vars _3, _4 and _5. I use them for some scripts for this and that (see scripts.py) and Sitra probably does to for some bit magic but if it is your own protos and scripts you can do what you like
Yes, I wanted a form of "global" variable so multiple separate scripts knowing nothing about each other could access it. Global would be undesirable of course, this sounds perfect for my needs. The use case here, for your context, is that I have a current script for item unwield, to destroy a mind blade since it dissipates when a soulknife relinquishes his grasp on it. However, the soulknife has the ability to throw the mind blade to attack at range, and obviously this could be problematic by destroying the item before it can reach and hit the target, so I wanted a way for a script to know that when he is beginning a throw action, I can tell the destroy script to hold off and not immediately vanish the blade until the attack has finished.
Another question. I've been rather personally interested lately in gaining full control over weapon glows because I'm a sucker for those colorful outlines. I've tried looking at everything I can related to an on weapon glow event type for a script on a weapon. evt obj data variables don't have anything that give me context of the item related to the glow callback. Arg params don't have anything that give me context of the item related to the glow callback. Args themselves have arg(2) giving me the inventory index of the item related to the glow callback, but even when I look at the item wielded there, it still doesn't help because it appears that if I hold two items, I get the callback for glow with arg(2) of the first item for both items wielded. The result is that if I use the glow callback, whatever glow I set is always applied to all weapons I wear, when I only want to apply it to one weapon.
Well, you've got san_throw (see HERE) which doesn't seem to work, and also the combat flags - flag D20CAF_THROWN is tagged for a thrown weapon, you can't normally access those flags I think but if you are using Temple+ that is probably a minor inconvenience. EDIT: You've posted something while I was typing, I'll read it shortly
Re glow - I'm sure Cujo wrote some stuff about this long long ago, try searching his content. Half-Knight also figured it out but not sure he shared what he knew.
Here's another personal curiosity I had. What if I wanted cursed items in the game, in the sense that once you equip them, you are unable to take them off? How could this be done? I have some belief it is possible because there is an analogue to this in game already - if you are in combat and you don't have that feat allowing item equipping as free actions and you have already taken an action, you are unable to remove/equip items IIRC. I don't know how this is done.
Well, I tried to script something like that - if you unequipped it, it just reequipped itself - but clicking on it really fast broke the script Again, something Temple+ should be able to do.
That's a good idea. I could probably do it very similar to how I made the mind blade dematerialize when unequipped. san_unwield script for a cursed item could just call a method forcing the player to equip it again. Is that what you did? The trouble there is when I dispel curse on the item. How would I kill a script from an item outside of that script?
You could add a flag for the item's curse. If (flag number) is not in effect and Remove Curse is cast on the (weapon number), add (flag number) and a timed event that will remove (flag number) at the end of the timed event, then add (flag number) as an exception to your curse script so that the (weapon number) cannot be unequipped if (flag number) is 1, but can if it is 0. You'll need to add the flag set and timed event to the spell script so when the spell is cast the flag and timed event is set.
Are there any 3.5 examples of cursed items like this that would be worth trying to add to the game? It's just a personal curiosity like I said, and probably would go nowhere if there isn't source material that it's applicable for.
There is a list of suggested curse effects that can be found here. Many of them are implementable with varying degrees of complexity, as well as a list of specific cursed items of which some may be relatively easy to add, others not so much, and yet more impossible to add. Delusion: Easy to add duplicates of existing items, remove the actual game changing properties, add the "is cursed" flag, done. Opposite Target or Effect: Copy existing items, reverse the effect if possible (-2 to -6 Belts of Giant Strength), add the "is cursed" flag done. Unreliable: Some of these should be able to be added, you may need both a functioning and non functioning version of each item, add a heartbeat script to check the item is worn and check the various variables (inside/outside/above ground/underground/in daylight/not in daylight etc...), add the curse if the variable implies it should not work and substitute the working version for the non functioning version, and add/remove the "is cursed" flag as appropriate. Requirement: Many of these don't seem to be easy to reproduce. Drawback: Some of these should be easy to implement, the item could just have a specific item model attached to it, so when it is worn the wearer has a new hair style or skin tone or a tattoo etc... Specific Cursed Items: Some of these will be easier to implement than others. Obviously if a single "cursed item" script could be written, and the item specific variables could be saved to the item itself, the same script could be used for all cursed items... and if it were possible for PC's to fail the magic item crafting check, it could be added to PC made items as well though that's beyond my ability to figure out how to accomplish that.
If you aren't using wearable items, it's easy enough to add some negative effect to an item that the player picks up, then flag it 'no_drop', 'no_transfer' etc when the player insert_items it. In KotB there is a cursed luckstone (another idea I borrowed from U1) - 50% of the time it will be the proper item, 50% it will be cursed and undropppable etc, requiring 'Remove Curse' to remove. Had to manually mod the Remove Curse script of course. More cursed items is definitely better, imho - they are a staple of D&D games.