Jump to content

Player W/ Object Script


Trandoshan

Recommended Posts

Here's a problem I would like to share w/ my friends at Nexus Forums! I'm currently creating a script that operates a percentage chance of a 'Critical Hit' with the chances of it happening based on player stats. I'm sure another mod like Deadly Reflex does something like this, but not with the functions I have in mind.

 

At this stage of experimentation, I am working on making a script that makes the player receive critical hits (based on the agility stat). If the critical 'lands', then the player receives penalties (Such as losing X2 health, a stat damage, or losing a piece of armor - indefinitely.)

 

:thumbsup: SO far that part of the script is secure, and I'm happy to say that the only problem I'm having as of yet is making the script run when the player is hit by an enemy weapon. Of course an Object script would make my life simple, but God Almighty had other plans. I realized too late that the 'player' (00000007) in the construction set, and the 'player' (00000014) that actually runs in the game are two different refs and as a rule ref 00000014 is only active in-game. This destroys the option of attaching a script to the player with the 'OnHit' function. There are no commands outside of 'OnHit' that would run a script if the player was hit by any weapon -- short of scripting every weapon with a script that deals criticals (I've tried this, very VERY inefficient and time consuming!). I ask the pros at the Nexus to bestow me with a hidden work around to the following problem in the form of a quest type.

 

Thank you for your time as always,

TD

Link to comment
Share on other sites

I think the most efficient way of doing what you asked (and the only way I know of) is to put a script on the player character with an OnHit block.

 

What exactly went wrong when you tried adding a script to the player? According to my knowledge, references (ie Player 00000014) will inherit any scripts (and certain other attributes) that are attached to it's base object (ie Player 00000007). From what I've heard though, directly modifying the player record is supposed to be taboo in the modding community so I'll let you deal with that.

Link to comment
Share on other sites

Modifying the player base object is indeed a bad idea. 9 out of 10 times it won't work, and it almost always causes problems.

 

Perhaps you could take a look at Deadly Reflex's scripts to see how it's been done there. It may be very helpful.

Link to comment
Share on other sites

Well, despite all of the helpful hints...

 

It seems currently impossible to have a function that returns one if the player is hit by an attack. There is currently a wish list topic on the CSwiki that addresses, but it has been 3 years since it was wished up.

 

 

:wallbash:

 

Oh well, enough mental abuse for one day. I'll sleep on it.

Link to comment
Share on other sites

Yes, I've requested a similar function quite some time ago, but the OBSE team is too busy already. :P

 

But you could try to use some kind of a workaround. While you can't directly detect if the player's being hit, you could try to scan the cell for enemies. If their combat target is the player, apply a poison with a script effect to their weapon; if the player is hit, you can use that script effect to tell he's been hit. But that would not work for spells, of course. ;D

Link to comment
Share on other sites

Thank you. :P

 

Detecting hits by magic should not be very hard either though, simply check for spell effects on the player. If he's got a damage health effect, it is likely due to an angry hedge wizard tossing spells. It's not 100% fool proof though; if the players drinks a potion or gets a disease with that effect (not likely to happen, but possible) a check for that particular spell effect would return 1 too.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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