Sign in to follow this  
Followers 0
hentai

(REQ)I need some help with my mods script

32 posts in this topic

Hello. This is Hentai

Im working on Hentai Mania Episode 2 and need your help especially in script.

I have been trying to mark total damages inflicted by any kinds of weapon-attack on the screen. Not from the enemy, From the player.

I have used script fuctions of "GetAttackDamage" but it only indicate weapons base damage not the total damage.

I know the Oblivion's damage fomula is extreamly complex

So i thought It is better to use enemy's health info than player's attack damage.

But the problem is that The only fuction I know about health is "target.getav health"

If I can get the info kind of " enemy's current health - enemy's previoud health before the attack ", I can get the The total damages inflcted on the enemys by single attack.

IF anyone can help me

please semd me a mssage

If you can kindly make a script for me

I can send you HentaiMania2.esp files

Thank you for considering me

0

Share this post


Link to post
Share on other sites

just to check:

You are looking forthe amount of health lost on an enemy after the player hits it with a weapon right?

Does this apply to all enemies, or just the one?

0

Share this post


Link to post
Share on other sites

just to check:

You are looking forthe amount of health lost on an enemy after the player hits it with a weapon right?

Does this apply to all enemies, or just the one?

the answer is

all enemies fighting with player.

thanks

0

Share this post


Link to post
Share on other sites

This is something I have not done before, so it will need a bit of thinking :thumbup:

Ok so if we detect when the player enters combat we can then use Target.GetAv Health, we can store that in a variable called BaseHealth so we always know what the base health was.

Next is to work out the damage the weapon caused and then take that away from the BaseHealth, now thats where I need to think.

Edit: GetAttackDamage will work but has to be used in conjunction with the appropriate skill, so check for the type of weapont the player is using then work out which skill is used.

0

Share this post


Link to post
Share on other sites

Thank you very much for considering my asking

I have tried out figure the total damages but It wasn't easy

here is the complete damage fomulas uesp.net

hope it can help you

The complete formula for Blades, Blunts and Bows is:

Damage = WeaponRating * (Fatigue/MaxFatigue + 1)/2 * SneakMultiplier * PowerAttackMultiplier

* OpponentArmorRating * OpponentWeaponResistance

The WeaponRating (WR) for Bows is the WR for the Bow + the WR for the Arrow.

Where WeaponRating is:

WeaponRating = BaseWeaponDamage * 0.5 * ( 0.75 + Attribute * 0.005 ) *

( 0.2 + ModifiedSkill * 0.015 ) * ( WeaponHealth/BaseWeaponHealth + 1 )/2

BaseWeaponDamage is the damage value provided on this site for the weapon.

WeaponRating is the damage shown for the weapon in your character's inventory.

Attribute and ModifiedSkill are constrained between 0 and 100.

Attribute is Strength for melee weapons; Agility for bows

ModifiedSkill is your skill (Blade, Blunt, or Marksman) modified according to Luck. The equation is ModifiedSkill = Skill + 0.4 * (Luck - 50)). Skill includes any skill-altering magical effects (Fortify, Damage, Absorb, etc; in the form of spells, potions, enchantments, abilities, etc). Luck also takes into account any magical effects.

SneakMultiplier is 1 unless your character is sneaking and undetected by the target in which case it is taken from the following table:

Sneak Skill SneakMultiplier

for One Hand Weapons SneakMultiplier

for Bows

0-24 4 2

25+ 6 3

PowerAttackMultiplier is the additional damage possible if the attacker chooses to do a power attack instead of a normal attack.

Normally the power attack multiplier is 2.5

If the attacker does a standing power attack and is at least apprentice level, then the power attack multiplier is 3

OpponentArmorRating is 1 if your character is successfully sneaking and has the Master Sneak perk, otherwise it is:

(100 - CombinedArmorRating) / 100

CombinedArmorRating may not exceed 85.

CombinedArmorRating is the sum of all pieces of armor the opponent is wearing and any boosting effects like Shield. The rating for each individual piece is:

BaseArmorRating * ( 0.35 + 0.0065 * OpponentArmorSkill) * ArmorHealth/MaxArmorHealth

OpponentWeaponResistance is the opponent's resistance to normal weapons; if using Silver/Daedric/Enchanted weapons it is always 1. Otherwise it is:

(100 - NormalWeaponResistance)/100

Enchantments on the weapon are handled as a spell hitting the target. The SneakMultiplier is not applied to either Enchantments or Poisons.

0

Share this post


Link to post
Share on other sites

Luckily, like the little pack rat I am, I save every solution to a difficult problem I see to a text file. AND, I have one just for this problem.

TalkieToaster over at the BGS forums posted this to someone who was trying to calculate the player's damage. That's what you are trying to do right?

Put this script on an activator, and make a copy of it as a persistent reference somewhere. Then:

To calculate someone's attack damage, set attacker to the attacker and target to 0.

To calculate the damage that one actor would deal to another, set attacker to the person attacking and target to the person being struck.

To calculate the damage that one actor would deal to another if their blow landed on a specific piece of armour, extrapolating the armour from that location to what their AC would be if they had a whole set of the armour, then set attacker and target as above, and Slot to the armour slot you want to extrapolate from.

Then use ActivatorRef.activate Player 1, and get the damage dealt off it by using "set myVar to ActicatorRef.damage". The activator is set up to assume that the default attacker is the player.

scn aaaCalcDamage

;outputs

float damage

;inputs

float multiplier

ref target

ref attacker

short slot

;internal

ref weapon

ref ammo

ref armour

float defence

float conditionbase

float conditionmult

float skillbase

float skillmult

float attrbase

float attrmult

float defskillbase

float defskillmult

float defmin

float defmax

float defcap

float defcondbase

float defcondmult

float weaponmult

float powermult

float handmin

float handmax

float handskillbase

float handskillmult

float handattrbase

float handattrmult

begin onactivate

if(getgameloaded)

if(attacker == 0)

set attacker to player

set slot to 99

set multiplier to 1

endif

set conditionbase to getgamesetting fDamageWeaponConditionBase

set conditionmult to getgamesetting fDamageWeaponConditionMult

set skillbase to getgamesetting fDamageSkillBase

set skillmult to getgamesetting fDamageSkillMult

set attrbase to getgamesetting fDamageStrengthBase

set attrmult to getgamesetting fDamageStrengthMult

set weaponmult to getgamesetting fDamageWeaponMult

set powermult to getgamesetting fDamagePowerAttackBonus

set defmin to getgamesetting farmorratingbase

set defmax to getgamesetting farmorratingmax

set defcap to getgamesetting fmaxarmorrating

set defcondbase to getgamesetting farmorratingconditionbase

set defcondmult to getgamesetting farmorratingconditionmult

set handskillbase to getgamesetting fHandDamageSkillBase

set handskillmult to getgamesetting fHandDamageSkillMult

set handattrbase to getgamesetting fHandDamageStrengthBase

set handattrmult to getgamesetting fHandDamageStrengthMult

set handmin to getgamesetting fHandHealthMin

set handmax to getgamesetting fHandHealthMax

printc "Loaded!"

endif

if(player.getweaponskilltype)

set weapon to attacker.getequippedobject 16

set damage to getattackdamage weapon

if(attacker.getweaponskilltype ==3)

set ammo to aaaCore.arrowBase

set damage to damage + getattackdamage ammo

endif

set damage to damage *(conditionbase + (attacker.getequippedcurrenthealth 16 / getobjecthealth weapon) * conditionmult);condition

set damage to damage *((attacker.getav fatigue / attacker.getbaseav fatigue )+1)/2 ;fatigue

set damage to damage *weaponmult *multiplier ;multipliers

else

set damage to (handmax - handmin)

endif

if(attacker.ispowerattacking) ;powerattack

set damage to damage * powermult

printtoconsole "Powerattack Damage %f" damage

endif

if(attacker.getweaponskilltype==1) ;skills & attributes

set damage to damage * (skillbase + attacker.getav blade * skillmult/100) * (attrbase + attacker.getav strength * attrmult/100)

elseif(attacker.getweaponskilltype==2)

set damage to damage * (skillbase + attacker.getav blunt * skillmult/100) * (attrbase + attacker.getav strength * attrmult/100)

elseif(attacker.getweaponskilltype==3)

set damage to damage * (skillbase + attacker.getav marksman * skillmult/100) * (attrbase + attacker.getav agility * attrmult/100)

else

set damage to 1+ damage * (handskillbase + attacker.getav handtohand * handskillmult/100) * (handattrbase + attacker.getav strength * handattrmult/100)

endif

if(target) ;target

if(player.getweaponskilltype)

if(getenchantment weapon == 0 && getignoresresistance weapon==0) ;resist normal

set damage to damage * (100 -target.getav resistnormalweapons)/100

printtoconsole "Damage post-resist %f" damage

endif

endif

if(slot != 99) ;armour

set armour to target.getequippedobject slot

if(isarmor armour)

set defence to getarmorAR armour / 100 ;base

set defence to defence *(defcondbase + (target.getequippedcurrenthealth slot/ getobjecthealth armour)*defcondmult) ;condition

if(armour.getarmortype) ;skill

set defence to defence *(( target.getav heavyarmor / 100)*(defmax - defmin) + defmin)

else

set defence to defence *(( target.getav lightarmor / 100)*(defmax - defmin) + defmin)

if(target.getav lightarmor >= 100)

set defence to defence * 1.5

endif

endif

if(slot==0||slot==1||slot==4) ;helm, gloves

set defence to defence * 13.5

elseif(slot==2) ;torso

set defence to defence * 2.7

elseif(slot==3) ;legs

set defence to defence * 4.5

elseif(slot==5) ;boots

set defence to defence * 9

elseif(slot==13) ;shield

set defence to defence * 6.75

endif

if(defence > defcap)

set defence to defmax

endif

set damage to damage * (100 - defence) /100

endif

else

set damage to damage * (100 - target.getarmorrating) / 100

endif

endif

set slot to 99

set target to 0

set multiplier to 1

set defence to 0

set armour to 0

set attacker to player

end

0

Share this post


Link to post
Share on other sites

Thanks Critterman

Cause I have little knowledge about scripting

I have to try this script on the games

The purpose of my request is to show a damages on the screen

So I tried to put the damages from enemy's reduced health. there could be another factors which can influence the damages like "modified damages from the user-made-mod"

anyway I'll go test this script adn see if it works ok.

Again... Thanks

0

Share this post


Link to post
Share on other sites

Once the damage is worked out you can use the Message function to display the damage on screen, like so:

Message"Damage Dealt %f", Damage

0

Share this post


Link to post
Share on other sites

Once the damage is worked out you can use the Message function to display the damage on screen, like so:

Message"Damage Dealt %f", Damage

Or if you want to get really handy, you could figure out how to display the damage on the screen with pluggy... but that would be too difficult and too much work.

0

Share this post


Link to post
Share on other sites

Or if you want to get really handy, you could figure out how to display the damage on the screen with pluggy... but that would be too difficult and too much work.

Indeed it would be to difficult and too much work. Though it could produce better results :thumbup:

0

Share this post


Link to post
Share on other sites

I fail to activate that script again and again

It has script error in this line

"set ammo to aaaCore.arrowBase"

Can you make a esp file of that script.

0

Share this post


Link to post
Share on other sites

I fail to activate that script again and again

It has script error in this line

"set ammo to aaaCore.arrowBase"

Can you make a esp file of that script.

I suspect that 'aaaCore' is a modded object/reference that can't be found in your CS. :)

0

Share this post


Link to post
Share on other sites

Ah i'll give it a shot.

And can you tell me briefly how to activate that script on the CS?

I mean Do I need to make a new quest to activate this script?

or I have to link this script to every single weapons?

0

Share this post


Link to post
Share on other sites

You need to create an activator and attach the script to it. I've never worked with scripted activators so someone else will have to guide you further.

0

Share this post


Link to post
Share on other sites

1. Make an activator doesn't matter what, just as long as it has a model of some sort.

2. Make a new cell. Do this by right click> edit then right click the left column and click new. Name the cellID something. Then load the cell up so you can see it in the render window. It should be empty.

3. Drag the activator from the object window to the render window. You have just made a reference.

4. Double click the reference in the render window. Check "Persistent Reference" this makes it so the object will run it's script even if the player isn't in the same cell as the object.

5. Now go to the base object of the activator you made and assign it the script that you have copied and pasted from my post above.

6. If it fails to save, it is most likely because you do not have the references the script is referring to. An example of this is the line "set ammo to aaaCore.arrowBase". The "aaaCore" is a quest and "arrowBase" is one of it's variables. You can put a ";" in front of that line to make the compiler ignore that line. The problem with doing this is that the variable "ammo" is now 0 and might throw off the math. From looking at the script I think "ammo" is supposed to be the player's equipped ammo. Soo...

7. Add in the line "set ammo to player.getequippedobject 17" right before the line "set damage to damage + getattackdamage ammo" No guarantees that that will make the script work, but from what I see it might.

8. Once you have the script successfully saved then "ok" the base object activator window and save your plugin. The script should work now and you can put in your messages outputting the player's damage. If the script simply is not running then I think it will be best to put the script on a new quest instead, not sure why TalkieToaster put it on an activator...

0

Share this post


Link to post
Share on other sites

Critter that's new for me - that's a great mini-tut! Thanks!

Good luck Hentai!

0

Share this post


Link to post
Share on other sites

I have tried a couple time as Critterman says.

I sucessly saved but looks like didn't works in game.

I think this has something to do with what TalkieToaster says in Script

"To calculate someone's attack damage, set attacker to the attacker and target to 0.

To calculate the damage that one actor would deal to another, set attacker to the person attacking and target to the person being struck.

To calculate the damage that one actor would deal to another if their blow landed on a specific piece of armour, extrapolating the armour from that location to what their AC would be if they had a whole set of the armour, then set attacker and target as above, and Slot to the armour slot you want to extrapolate from.

Then use ActivatorRef.activate Player 1, and get the damage dealt off it by using "set myVar to ActicatorRef.damage". The activator is set up to assume that the default attacker is the player."

I tried figure out what he said means but couldn't

Here's the link of esp files I made

http://mfiles.naver.net/2ff41aced58ae0527915/20090909_22_blogfile/radio_free_1252482407546_3WYj5E_esp/DamageTEST.esp?type=attachment

The script's name is "aaaCalcDamage"

The cell name id "0000hentai"

Sorry for bother you guys again and again.

Thank you

0

Share this post


Link to post
Share on other sites

Ok, so I'm learning a bit here myself but I think I finally get it. To make the script work you'll need to do this:

1. Make a new script and this time do something like this, make sure to save it as a quest script:

scn ActivateScript


float damageDealt

float fQuestDelayTime


Begin Gamemode

  Set fQuestDelayTime to 0.01

  ActivatorRefID.activate Player 1

  Set damageDealt to ActivatorRefID.damage

  Message "Damage Dealt = %f" damageDealt

End
The line "ActivatorRefID.activate Player 1" activates the reference in your empty cell. Since that object has a script on it with an onactivate block then that script is run through when the line "ActivatorRefID.activate Player 1" is called. Then you can set a variable to the calculated damage of the player, "Set damage to ActivatorRefID.damage". When you put a script with variables on a quests and objects that have persistent references, then you can return any of the variables in that script from another separate script with the syntax: [QuestID or ReferenceID].[variable in the script]. In this script we set the float variable "damageDealt" to the "damage" variable in TalkieToaster's script. To finish the script we print out a message to the player with their damage dealt. Now we need to make a new quest (character>quests) and attach the script to it. Now, the "Set fQuestDelayTime to 0.01" line makes the script run every 0.01 seconds. The default for quest scripts is 5 seconds, and to be efficient we will make it so it runs nearly every frame. Now save your plugin with the new quest with the new script attached. 2. There is still a problem with the script, however. This will make the game message spam the player his damage every 0.01 seconds... not good. So we can fix this with OBSE.
scn ActivateScript


float damageDealt

float fQuestDelayTime


Begin Gamemode

  if OnControlDown 4 == 1 && Player.IsWeaponOut == 1

    Set fQuestDelayTime to 0.01

    ActivatorRefID.activate Player 1

    Set damageDealt to ActivatorRefID.damage

    Message "Damage = %f" damageDealt

  endif

End

This makes it so that everytime the player attacks then the message with damage dealt will pop up. Unfortunately the script will still tell the damage dealt even if the blow hasn't landed (so message is now "Damage =...", instead of "Damage Dealt =..."). This really can't be fixed unless you somehow find out if the player hit someone, and this would require a lot of work for something so simple right now.

That's the way I would do it at least. I can't really try it right now to see if it works, but hopefully it does.

By the way, I tried your link to the esp and got a 403 forbidden, so you must have a permission thing set wrong.

And please, don't worry about asking questions :D, I actually enjoy answering them. Like I said, I'm actually learning a few things myself (like you can get the variables off of a script on a persistent reference). So ask away! :D

0

Share this post


Link to post
Share on other sites

Why not use an area of effect spell, to add an object to NPC's in the players cell, and monitor their health. When health changes, and the player is the attacker, display the damage dealt by subtracting current health from base health, and then update base health. This would allow for multiple targets, and bypasses the need to do the calculations, which I have found are not always accurate....

0

Share this post


Link to post
Share on other sites

Why not use an area of effect spell, to add an object to NPC's in the players cell, and monitor their health. When health changes, and the player is the attacker, display the damage dealt by subtracting current health from base health, and then update base health. This would allow for multiple targets, and bypasses the need to do the calculations, which I have found are not always accurate....

The problem I see with that is that you would truly never really know if the player was the one to hurt the target. If the player had a companion fighting the enemy they could attack them and it would show the damage they did, not the player. And GetCrosshairRef wouldn't be very reliable (bows, staffs, spells, or hitting the enemy without looking directly at them would throw off that function).

If only their were a way to do OnHit on any actor in the player's cell... (without having to add a script to them all of course).

By the way, I've found area effect spells that have script effects only work on the last actor hit by the spell.

Woah... I was just looking through the OBSE commands and I got an idea. Add a reflect damage spell at 100% to the target then when the player hits them and the damage hits the player, get the magnitude of that spell that hits the player and you have the damage amount. Then you could ModAV2 the health off of the target so that the target actually gets hurt. The same could be done with reflect spell. I don't really have the time to test it now, but I'll try it out later...

0

Share this post


Link to post
Share on other sites

It has script error like this

http://blogfiles9.na...5_jpg/error.jpg

I have loaded CS with obse newest version.

and Can't save the script before I make the quest.

Do I have to modify Talkytoaster's script?

I get:

Referral Denied

You don't have permission to access"http://blogfiles9.naver.net/20090910_184/radio_free_1252586841773_61H1e5_jpg/error.jpg"on this server.Reference #24.e5716d0.1252607911.2033016

When I try your link... maybe upload it to photobucket.

There are many things that can make a script fail to save. But I can't really tell without the error message :D

0

Share this post


Link to post
Share on other sites

I get:

When I try your link... maybe upload it to photobucket.

There are many things that can make a script fail to save. But I can't really tell without the error message :yes:

Im sorry I was busy fixing serious problem with Hentaimania2 mod and couldn't catch up with you quickly

Here's the pic

med_gallery_654_53_184490.jpg

Thank for your kindness and consideration

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0