GetAttacked

Post » Sat May 28, 2011 2:47 am

I've looked through the functions a couple of times and I found this

http://geck.gamesas.com/index.php/GetAttacked


I was hoping for something that captured the player or an NPC having taken damage or a hit as a moment in time kind of thing, but didn't see such a thing. Has anybody used GetAttacked? There just isn't much in the wiki about it and the definition of "attacked," leaves a little bit to be desired IMO, but there you go. I'm not exactly sure when the attack would be defined to have begun? After detection, at some level of detection, when shooting (or whacking or whatever) and missing, when successfully connecting with the target? Is attack a term like detection and I should know it and noobishly have missed that?

Or, better yet, is there something that does address the player and/or an NPC taking damage or a hit and I've just overlooked it?

Thanks,

:) llama
User avatar
El Goose
 
Posts: 3368
Joined: Sun Dec 02, 2007 12:02 am

Post » Sat May 28, 2011 4:03 am

I've looked through the functions a couple of times and I found this

http://geck.gamesas.com/index.php/GetAttacked


I was hoping for something that captured the player or an NPC having taken damage or a hit as a moment in time kind of thing, but didn't see such a thing. Has anybody used GetAttacked? There just isn't much in the wiki about it and the definition of "attacked," leaves a little bit to be desired IMO, but there you go. I'm not exactly sure when the attack would be defined to have begun? After detection, at some level of detection, when shooting (or whacking or whatever) and missing, when successfully connecting with the target? Is attack a term like detection and I should know it and noobishly have missed that?

Or, better yet, is there something that does address the player and/or an NPC taking damage or a hit and I've just overlooked it?

Thanks,

:) llama


You could monitor health in a quest script and set the delay to .5 seconds or less, depending on what you want to do. Something simple like this to get started:


			if ((MyNPCRef.GetHealthPercentage < .30) || (Player.GetHealthPercentage < .25))				set iWeAreHurtBad to 1			else				set iWeAreHurtBad to 0			endif


I'm not sure about the GetAttacked function as I haven't used it.
User avatar
Honey Suckle
 
Posts: 3425
Joined: Wed Sep 27, 2006 4:22 pm

Post » Sat May 28, 2011 3:51 pm

I've looked through the functions a couple of times and I found this

http://geck.gamesas.com/index.php/GetAttacked


I was hoping for something that captured the player or an NPC having taken damage or a hit as a moment in time kind of thing, but didn't see such a thing. Has anybody used GetAttacked? There just isn't much in the wiki about it and the definition of "attacked," leaves a little bit to be desired IMO, but there you go. I'm not exactly sure when the attack would be defined to have begun? After detection, at some level of detection, when shooting (or whacking or whatever) and missing, when successfully connecting with the target? Is attack a term like detection and I should know it and noobishly have missed that?

Or, better yet, is there something that does address the player and/or an NPC taking damage or a hit and I've just overlooked it?

Thanks,

:) llama


Based on the description, it sounds like it would return true if the actor is in combat and has been attacked since combat was initiated. It would return false if the actor is not in combat, or if the actor initiated combat and has not yet been attacked. However, it could just mean that the actor is in combat, regardless of having taken damage from another actor.
User avatar
JESSE
 
Posts: 3404
Joined: Mon Jul 16, 2007 4:55 am

Post » Sat May 28, 2011 2:43 pm

This probably won't shed any light on anything but might be of interest, it's from the Oblivion CS Wiki.

* Differs from IsInCombat in that it is treated retroactively, in that once attacked, an actor will continue to return 1 until they have yielded or left combat.
* When called on the player, will return 1 from any point shortly after the tutorial starts, or as soon as the player is targeted by anything.
* Unlike IsInCombat, this will return 1 if an actor is attacked, but that attack does not trigger combat, such as the case might be with friendly hits, but may prove unreliable.
* Usage is a bit arcane and not well understood, more testing is needed.

User avatar
jessica Villacis
 
Posts: 3385
Joined: Tue Jan 23, 2007 2:03 pm

Post » Sat May 28, 2011 2:13 am

This probably won't shed any light on anything but might be of interest, it's from the Oblivion CS Wiki.


No, that has something useful in it I think. I should have thought to go over to the CS wiki. I just blanked.


* When called on the player, will return 1 from any point shortly after the tutorial starts, or as soon as the player is targeted by anything.


If this is true, as soon as targeted by anything, that gives me an answer to when it is happening.


Thanks so much. I feel like such a dope. I feel more comfortable going and trying it out now. At least I'll have an idea of what I'm watching for.


@RickerHK - Thanks. I'm not sure which way I'll end up going to solve my problem. I'm just starting to play with it.
User avatar
Robert Devlin
 
Posts: 3521
Joined: Mon Jul 23, 2007 2:19 pm

Post » Sat May 28, 2011 4:56 am

Based on the description, it sounds like it would return true if the actor is in combat and has been attacked since combat was initiated. It would return false if the actor is not in combat, or if the actor initiated combat and has not yet been attacked. However, it could just mean that the actor is in combat, regardless of having taken damage from another actor.


:laugh: Exactly. It's crystal clear, isn't it?
User avatar
naome duncan
 
Posts: 3459
Joined: Tue Feb 06, 2007 12:36 am

Post » Sat May 28, 2011 3:29 am

Interesting... What sticks out for me is the word "retroactively". I can imagine a scenario where the player is supposed to meet a fairly important NPC, but one not worthy or unable to be set essential. If this NPC is in the next valley over, but still within the loaded 3D area, and say the players over here posing a dead body for whatever totally wrong reason, something like a roaming creature could wander along and terminate that NPC before the player ever gets there. GetAttacked seems like it could be useful as a condition to keep boosting the NPCs health until after they've met or whatever, but it does sould like an old function, somewhat outdated maybe.
User avatar
latrina
 
Posts: 3440
Joined: Mon Aug 20, 2007 4:31 pm

Post » Sat May 28, 2011 3:29 am

No, that has something useful in it I think. I should have thought to go over to the CS wiki. I just blanked.

If this is true, as soon as targeted by anything, that gives me an answer to when it is happening.

Thanks so much. I feel like such a dope. I feel more comfortable going and trying it out now. At least I'll have an idea of what I'm watching for.


Bah! You are not a dope! You have gotten a hell of alot farther than most people do. :)

I find myself in the CS wiki a fair amount still too, especially with the more esoteric functions.

Cheers!

Miax
User avatar
Maddy Paul
 
Posts: 3430
Joined: Wed Feb 14, 2007 4:20 pm

Post » Sat May 28, 2011 10:31 am

So, guys, GetAttacked appears to be worthless hunk o'junk and didn't do anything at all as far as I could tell.

@ RickerHK I did what I wanted to do in my NPC's object script, and I did use a quest script to monitor those variables for me to do something I wasn't sure how I was going to accomplish otherwise and it was so easy. Thanks so much. I'm such a noob to scripting and the GECK that I never realized I coulda/shoula/ought to have been using quest scripts that way. The vistas you have opened to me. :celebration: Well, maybe they aren't all that grand cuz I'm still taking baby steps, but still, I'm pretty excited about that. So thanks.

@ Miax, thanks. :)
User avatar
Olga Xx
 
Posts: 3437
Joined: Tue Jul 11, 2006 8:31 pm

Post » Sat May 28, 2011 11:33 am

You have a couple options here.
There is the " Begin Onhit " block-type which will be called when the actor is hit by another actor or by anything if left without a parameter.

If you are looking for a GameMode function, the best thing I found to use is a .getHealthPercent function.
So

if VIPNPC.getHealthPercent < 1.00    VIPNPC.resetHealth


would probably work for you.
User avatar
A Lo RIkIton'ton
 
Posts: 3404
Joined: Tue Aug 21, 2007 7:22 pm


Return to Fallout 3