Jump to content

Friendly until attacked


Recommended Posts

If you use ZScript, you can give the monster a +FRIENDLY flag, and override its TakeSpecialDamage:

 

override int TakeSpecialDamage(Actor inflictor, Actor source, int damage, Name damagetype)
{
	if (damage > 0 && source && source.player)
	{
		bFriendly = false;
		target = source;
		lastenemy = null;
	}

	return damage;
}

 

This should make that the monster is initially friendly (attacks enemies) and if it takes damage from a player, it will be no longer friendly.

(code untested as usual)

Edited by jaeden

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...