Talk:GetAttacked
Not working
I used it with if (Player.GetAttacked == 1) but even though i was in town, no attack it continued to fall through to my Messagebox result. --Taglag 21:58, 25 April 2009 (EDT)
- Please refrain from adding bylines to wiki articles. Move queries such as the above to the appropriate articles discussion page. In any case, the article states that the working of this function is dubious. You could perhaps confirm it after further testing and then update the article, when you are requested to use proper grammar and English.
- -- shadeMe TALK 20:04, 26 April 2009 (EDT)
Does work
The reason why it might not have reported any change when called on the player is because once the player was attacked by anything, the rat in the tutorial for example, it would forever return 1 since the player never technically yields, or leaves combat. However, when this function is used with an actor, the difference between getattacked and isincombat is a bit more clear. Getattacked will return 1 as soon as the actor is attacked by anything, even if being attacked does not send them into combat, such as the case might be for friendly hits. An interesting thing to note however is that a condition based on getattacked == 0 && isincombat == 1 will be triggered by any instance where the NPC enters combat due to being hostile toward an actor, or by nature of defending another actor (high disposition), and will not be triggered if the actor is attacked and is sent into combat, and will not be triggered as soon as the actor is hit or targeted by anything. In short, this function can be useful as a means of detecting who started a fight, where other functions, like crime, may not be valid. --Vagrant0 08:44, 22 July 2009 (EDT)