Wouldn't you need to define a separate script for each actor in that case, though? Targeted global scripts can only be attached to one reference at a time. And while you could conceivably come up with a local script equivalent so that a copy could be attached to each actor in the CS manually, it would preclude attachment to those actors who already have scripts.
[quote name='NMZmaster' date='07 October 2010 - 04:21 PM' timestamp='1286482879' post='16458873']
Just to clarify, it isn't all scripts that have such limitation. A local script can be attached to as many references in the CS as you want. But if you have a global targeted script, it can only be running on one reference at a time.
[/quote]
Mm... not sure. I could've sworn I've used ref->StartScript with the same script more than once and had it work, but I'd have to check, it's been a while since I played with that.
[quote]Not to mention, anything added by another mod would be an "incompatibility" which wouldn't provide experience points. The MWSE cycling script wouldn't necessarily be efficient, but it would be plausible.
[/quote]
No it wouldn't? By starting the script on references when they are first encountered (a single MWSE cycle OnCellChanged), it should work just fine with modded stuff. Assuming it works at all.
Using MWSE to cycle through all NPCs and creatures every frame would be next to useless, speed-wise. You'd have to test if either is fast enough to work.
[quote name='The Greatness' date='07 October 2010 - 04:15 PM' timestamp='1286482550' post='16458853']
I like this idea. You could put this at the beginning:
And then underneath you could have a full XP value calculation. I might have a go at this. There's only one problem I can think of, and that's that any loaded creature that dies while add XP, but you could add a distance check.[/quote]
That would work, in general. Whether the PC killed them or not would be somewhat hit-or-miss, but it would be better than nothing. Using a distance check (an un-sqrt-ed version, especially) for each OnDeath with have a minimal FPS hit.
[quote]EDIT2: ninja'd by NMZmaster. I didn't realise you could only attach a script to one creature, but I have a work arround. When scanning for creatures you scan for the players target, and attach it to that. Then you'd need to run that script every frame though, but it could be kept short.
[/quote]
If it's not possible to attach it to all NPCs, then that would be a better idea. Either occasionally scanning and attaching to any in combat and near the PC, or the PC's combat target. It might not play nice with AoE spells and such, definitely not scripted spells, but it would be better than nothing.
You could even have a small set, set 16 or so, scripts set up and use globals to keep track of whether they've been used. If a free slot is available, start that script on the next combat target. It wouldn't work for huge battles, but Morrowind doesn't have battles with more than 8/16 enemies all that often anyway.