Originally Posted by Abraxas*
I want certain NPCs react on Allies getting hit by enemies. OnDamage checks if the script owner receives damage; I don't know how to tell B (Ally of A) that A got damaged. If A creates a character event for B OnDamage, B does not know that A set the event. How can I tell B this information?


Well I tried using CharacterHasBeenHitBy in a few contexts and couldn't get it to do anything.

As for your problem, Can't you define the Ally in the INIT section as an extern?

So

Code
INIT

EXTERN CHARACTER:%FRIEND = null
CHARACTER:__Me  


BEHAVIOUR


REACTION YellAboutFriend, 0
	USAGE ALL 
	ACTIONS
	DisplayText(__Me,"FriendHurtCry",5)
	SetPriority("YellAboutFriend",0) 
	
	
REACTION Damaged, 0
	USAGE ALL 
	ACTIONS 
	CharacterEvent(__Me,"Damaged")
	SetPriority("Damaged",0)

EVENTS
EVENT FriendHurt
	ON
		OnCharacterEvent(%FRIEND,"Damaged")
	ACTIONS 
		SetPriority(YellAboutFriend,1100)

EVENT TakeDamage
	ON
		OnVitalityChanged(_)
		//OnDamage(_,_,_,_)
	ACTIONS
		SetPriority(Damaged,1200)


I used Vitality changed for a shortcut, I assume you can plug in on damage if you'd rather since I think with Vitality change they would perform the action when they heal too.

One thing I noticed though is that the reactions are a bit slow. Meaning the characters don't display the text very fast. I think Osiris would actually be faster.

Last edited by SniperHF; 22/05/16 12:48 AM.