Jump to content

Determining Attacker


Geccs

Recommended Posts

Hi, I've been experimenting with some scripts and run into a problem. I'm trying to make the script figuring out who launched an attack.

I'm using GECK with FOSE.

 

If we take a look at the VictoryRifleKnockdown script it looks like this:

 

scn VictoryRifleKnockdownScript

 

ref myself

 

Begin ScriptEffectStart

 

set myself to GetSelf

player.pushactoraway myself 5

 

End

And the Behemoth hydrant script:

 

scn MQ01BehemothWeaponSCRIPT

 

ref Target

 

BEGIN ScriptEffectStart

set Target to GetSelf

if target != player

MQ01BehemothREF.pushActorAway Target 10

endif

END

 

They both determine who got hit, and what to do with them. But while keeping such a result,

I would also like to make the script depend on the attackers vaules, more specifically AttackDamage.

 

I've got it set to begin at ScriptEffectStart like in the examples and use GetSelf to determine the injured actor's values.

It is easy to put GetAttackDamage in there, but wouldn't that just use the injured actor's attack damage?

I'm trying to link this to the attackers AttackDamage but so far I haven't come up with any result at all on that end.

 

Any ideas?

Link to comment
Share on other sites

In both of those scripts, the "attacker" is explicitly defined. For the victory rifle, the knockback effect it assumes the player caused it (player.pushactoraway myself 5), and for the fire hydrant, it assumes the behemoth caused it (MQ01BehemothREF.pushactoraway target 10). So if you wanted to, you could just call it on the player or mq01behemothref.

 

Another thing you may want to consider is that getattackdamage is for finding the damage of weapons, but I think it also works for creatures. Not sure if it works for the player, because NPCs don't have an innate attack damage value like creatures do. In that case I guess you'd use getactorvalue to find the player's strength or whatever stat you want.

Link to comment
Share on other sites

I may have left out a central detail, what I'm trying to accomplish is having the attacker value dynamic within the script.

So if the player attacks an NPC the script will identify/reference the attacker as "Player" and

if it is an enclave soldier attacking the player it will say "Enclave soldier".

 

Something like this, if I put it in very rough terms (using the behemoth script as example) :

 

 

scn MQ01BehemothWeaponSCRIPT

 

ref Target

ref Attacker

 

BEGIN ScriptEffectStart

set Target to GetSelf

set Attacker to (um, what)

Attacker.pushActorAway Target 10

endif

END

 

So that this script will run regardless of who uses the weapon on who.

Now, the behemoth script isn't what I'm trying to mod specifically, it's just really similar

to what I have in mind.

 

 

But thanks for the info on creatures, gotta take a closer look on that.

Link to comment
Share on other sites

Unfortunately I don't think that functionality is in FOSE. They might add it in the future, cause OBSE has functions that you can use to find the caster of a spell effects.

 

There might be some workarounds that are feasible for you. For example, you could have the script scan the cell for references (getfirstref/getnextref), check if the reference is near the target (getdistance), check if it's targeting the target (getcombattarget), check if it's facing the target (getheadingangle), check if it's playing an appropriate attack animation (isanimplaying), etc.

Link to comment
Share on other sites

Interesting, I'll have to look into that too. Another alternative in my case is if there simply is a way for the script to

tell how much damage an attack does and intercept it before it is applied to the actor, sort of like a resistance.

In effect, what I'm trying to accomplish is having an actors ArmorRating act on received damage by reducing it

by a set number instead of a percentage.

 

I think I've got the basic framework set, but I came to a halt when trying to get the script to actually

reduce damage by a set number. A cheap and bulky workaround would be to heal the actor by the "blocked" amount,

but thats really weird and doesn't help much if the actors health is below the "blocked" ammount already.

 

Trying to determine the attacker felt like the most useful way to go, as you could get other info from him aswell,

like damage type/resistance. But Any way of reducing damage by a set number would be great.

 

I'm off to bed, thanks for your suggestions so far.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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