peterhughes Posted September 2, 2008 Share Posted September 2, 2008 One of the things that really bugs me in oblivion, and that I'd like to fix, is that if I'm in combat with an enemy and I cast invisiblity, the enemy will instantly stop, stand still for a few seconds, and then start searching for me in a complete different direction from where I'm standing! This is dumb, the enemy should at least start searching at the location where you were last seen! Secondly, if I'm invisible in the middle of a group of enemies, and I then re-cast invisiblity, even though the invisiblity spell casts a flash of light, and makes a loud noise, none of the enemies around me react to this in any way! Solution: When the player casts the invisibility spell (regardless of whether the player is already invisible or not), all aggresive NPC's in the area shold run to the spot where the player was last seen, and then start searching for the player from there. So, being a software developer myself, I've decided to have a look into scripting the above solution. However, so far, I've been looking into scripting for only a couple of days, have been through a couple of tutorials, and have the beginnings of an idea as to how this might be achieved, but I wondered if someone could advise me if the approach is correct, or if there are better ways to achieve it? Design for script is as follows: 1) Attach a "ScriptEffectStart" Blocktype to the PC (is this possible, if so how?), which will be executed when the PC casts a spell. Then use the HasMagicEffect function to check if the PC is invisible. (Maybe use GetNthActiveEffectTimeElapsed to ensure that the invisiblity spell has only just be cast, and that we're not casting a different spell). If all is well, then record the PC's current location in a local variable. Question: Instead of attaching a script to the PC, would it be better/possible to attach it to the Invisibility spell itself, and then add code to check to see if it is the player that is the caster? 2) Set up a GetFirstRef (69 for actors) ... GetNextRef loop to iterate through all "actors" in the current location. 3) For each actor, use the code snippet below to determine if the actor is aggressive to the PC if ( callingActor.getAV aggression > 5 ) if ( callingActor.getDisposition target < callingActor.getAV aggression ) ; actor is hostile toward target endifendif 4) For each actor that is aggressive: check the GetLOS function to determine if the actor can "see" the PC. 5) For each actor that is "aggressive" and can "see" the PC: use "AddScriptPackage PackageID" to add a new custom Travel or Find Package to the actor that makes them travel directly to the PC's last seen location. (I could use some advice on which is the best package type to use, and the best settings for that package. Bear in mind that the package must work even though the player is invisible!) 6) When the Travel/Find package is completed (i.e. the NPC has moved to the PC's last known location), then the package should use "StartCombat" to get the NPC to attack the player, and then remove itself from the NPC using "RemoveScriptPackage". CheersPete Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.