Jump to content

[WIP] Targetting System


paladicprince

Recommended Posts

I am currently working on a mod to add a targetting system to Oblivion. So far I've been able to implement many of the features and everything else I plan to add seems fairly feasible.

 

But I have some major bug issues that confuse me, so I need some people to beta test it and give me their results. And hopefully I can get an experienced scripter to help solve some of the bugs. I may not get any scripting help, but with this post I'm sure I'll get some testers. :)

 

That said here's the information about this mod and its current state (see the comment section of the mod itself for currently found bugs):

 

 

About this Mod:

This mod adds a targetting system to oblivion. Pressing "g" will cycle through all Actors and Creatures in Line of Sight. Your currently selected target will glow.

 

Currently when you cast a target spell with a selected target it will arch towards the target. I tried to achieve a balance between hitting most of the time without 100% accuracy. So far it feels pretty good, but I'm open to suggestions. (I still need to implement height correction, currently if you cast a spell too high it will simply circle above the targets head until it dissipates, or you cast a new spell [in which case it will shoot off in a random direction])

 

Also when you have a bow equipped as long as you are holding the attack key it will make you face your target directly until you release the attack key when you'll be able to turn as normal. You can still run around, just not rotate your character.

 

This mod was originally intended for third person view, but after consideration I'll make sure it can be used in First Person just as well.

 

Notes:

This is currently a Beta mod and as such a few bugs wouldn't be surprising. I've spent 9 hours so far testing it myself and I've got the major kinks ironed out (Crash to Desktops for example). There are still small issues that have popped up that as of yet I haven't been able to consistently replicate to fix them. If you find a bug let me know exactly how you caused the bug and if it's repeatable and I'll be able to troubleshoot it.

 

Future Plans:

- Seperating friendly targets and enemy targets to two seperate targetting keys.

- Seperating followers/companions from other friendlies and assigning each a quick key (as well as the ability to cycle through them)

- Implementing HUD elements (especially designed for healing minded people) to display companions health and mana, as well as a HUD element for your current target.

- Make spells correct for hieght.

- Healing spell changes: All "target" healing spells cast on your target will become instant contact (i.e. no floating ball). You're character will play the animation of the "self" version of the same spell and your target will be healed. This will solve the problem of constantly healing those darn jumpy dremora.

- Streamline the tracking process attached to spell projectiles in order to work better with mods that increase projectile speed.

 

Requirements:

OBSE

 

Change Log:

v0.2

- Added an ini file for user customization of all controls.

- Added a clear target button (default "]"). This button should be useful in general but is exceptionally useful if you encounter a bug where you can no longer target anyone, simply tap the Clear button and a majority of the time it will start working again.

- Added functionality to melee weapons and changed ranged weapons (bows and staffs) to match. Now when you attempt to attack a target you character will face the target directly, which should help solve a lot of those "near miss" scenarios that end up with you killing your companion. Note that this effect will only take place if the target is less than 20 degrees off (i.e. your character won't spin around to attack a target behind him)

- Majorly cleaned up and reorganized the scripting to greatly reduce the number of bugs. I haven't found a bug yet with the latest version, but I expect they're lurking in there somewhere.

Link to comment
Share on other sites

I actually had an epiphany moments after posting this... I was browsing the OBSE command documentation and discovered it could handle arrays. as such I think that could help solve several of my issues. I'm not sure though, so we'll see. Its more syntax for me to make sure I got right ><

 

But once I work it out it'll also help with the aspect of targetting companions as well without limiting it to the number of variables I decide to type in.

Link to comment
Share on other sites

If there's anyone interested in this mod I'd like to ask for a little bit of input.

 

1) When targetting I have two options: GetLineOfSight, or GetHeadingAngle.

GetLineOfSight is useful because it won't allow you to target characters behind buildings and such, but it also can be annoying because if a target it only partially obscrued by say a lamp post it might skip over him.

GetHeadingAngle will resolve this issue, but instead you could end up targetting characters behind walls (which may or may not be useful)

 

So my questiong is would you rather occasionally target enemies behind walls, or skip enemies behind lamp posts?

 

2) Does anyone know of the most reliable way to determine if an actor is friendly or not? Currently I have all creatures marked as enemies, but I'm not sure of the best reliable way to decide whether NPCs are friendly or not. My options are:

GetShouldAttack - Sounds like and seems like it works well, except occasionally says that a target will not attack you if he is in a different cell (mostly an issue in worldspaces), even though he would.

IsActorEvil - I haven't thouroughly play tested with this but it sounds like it would instantly mark say.. all vampires as enemies even though there are several you don't fight.

Comparing GetAV Agression with GetDisposition - I'm not sure about this one, it doesn't really make sense to me... I've made people absolutely hate me (with 0 disposition) with the persuasion minigame, but that doesn't make them attack me on sight. And even if itdid it would still be a crime for me to attack them first.

 

If there's maybe a more reliable way to see if an actor is friendly I could scan for all friendly targets first and just put the rest into the enemies list, but I haven't found a reliable way to do that yet either.

Link to comment
Share on other sites

Hmm... if a companion had a specific item, couldn't you make the code mark those npc's as friendlies?

 

But that would only work for companions, since you would have the chance to put the item in their inventory.

 

...What if you add that item to all npc's, and the moment they target you, have that item remove itself, which would make the targeting spell mark them as hostile npc's, what do think?

Link to comment
Share on other sites

Companions themselves will be handled differently from say guards in towns. And companions will be easy without that.

 

So I'm leaning towards doing this:

 

Generate a list of Companions

Scan through Actors in range and if they are 1)friendly and 2) not in the Companions list - add them to the friendly list

Place all remaining actors in the enemies list

 

I'll have to figure out how to handle circumstances where you decide to kill your companion because they shouldn't be friendly at that point. I think GetCombatTarget should help there.

Link to comment
Share on other sites

Oh no. Sorry. That's the method I want to use. There's a convenient function: GetFollowers that generates an array of your companions (and summons), so that part is easy.

 

But I haven't gotten a 'reliable' way to distinguish the two. I wish I knew the exact formula oblivion used to decide if an actor should attack the player...

Link to comment
Share on other sites

Shouldn't "getCombatTarget" work?

 

something like this?

 

if npcRef.getCombatTarget == player
;mark as hostile
 else
;mark as friendly

 

Then you could use a getfirstref loop to get the references

 

set NPC getfirstRef 35 2
while (NPC)
if npc.getcombatTarget == player
 ;mark as hostile
 else
 ;mark as friendly
 endif
set npc to getnextref
loop

Link to comment
Share on other sites

Well. Yes.

 

But what if he's your enemy but actually attacking your companion? Or say some bad dude tries to run around IC killing everyone? He wouldn't be targetting you directly, but he'd definitely be someone worth killing, and if he's killing everyone else he'd most likely kill you as well.

 

But I think I found the formula which is based solely on disposition and aggression... I'll test that out a bit.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...