Jump to content

Scripting help


WarRatsG

Recommended Posts

Hi :)

 

I am in the process of creating A revival of the Terran Vampires Mod and I'm having a little trouble with one particular area. Feeding on a sleeping character.

 

Truth is, I found it quite easy to come up with a way of doing it with a touch spell. It works perfectly and completely as planned, but because I am a perfectionist I don't want to use an On Touch spell to accomplish what I am trying to do. It isn't as immersive and there will always be players who don't look at the manual and try to feed the normal way. Only when they do that nothing will happen.

So instead of using a spell, I used an event handler (OnVampireFeed, to be precise) which runs after the player has fed. Now this may seem fair enough, I can do most of what I want to do from here - except from damage or kill the victim, because I can't get his reference

 

Plenty of other vampire mods feature damaging the victim after feeding, so there is a workaround. I just can't do much without the reference really.

 

So basically the question is: How can I obtain his reference?

Link to comment
Share on other sites

GetCrosshairRef could work, but it seems a little unreliable at best. Event Handlers run instantly after the event has been completed, for example if you take damage the relevant event handler kicks in before you even lose health. The point I'm making is that you may still be locked in third person when this script kicks in, plus out of habit I tend to move the camera about a lot even when I am in third person, so who knows what could go wrong.

 

I'll try it out when I get the chance.

Link to comment
Share on other sites

If GetCrosshairRef doesn't work for you, you could try setting a second event handler. This would be an OnActivate event handler, and it should save the activated reference to a quest script if the PC is a vampire and the NPC is sleeping.

 

If that doesn't work either, I guess you can only try ref walking functions. Find all the NPCs within 1 cell and narrow it down to the NPC closest to the player, and where Player.GetHeadingAngle NPC is between -90 and 90.

Link to comment
Share on other sites

After a little bit of work, I have deduced that it would ultimately be best to divert all feeding through a keyboard button. This is on both sleeping and awake characters.

 

I found that I can make sure that players will not attempt to feed through activating by using "SetAv Vampirism 0". As far as I am aware the morphing effects remain so long as a spell containing vampirism is on the character, but reducing the actor value to nothing seems to stop the menu appearing when activating a sleeping NPC. Time will tell if this causes bugs :/

 

For whatever reason though, most other vampire mods have an effect on whoever the player bites, so I can't really figure out what to do. In my opinion though, routing all feeds through a keyboard button is more immersive, at least more so than spells. That's my excuse :P

 

Thanks for your help though, with a little time more time and research I could probably have put your ideas to use :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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