• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Tfs 0.3.6][8.60] Monster or Npc that doesn't attack players with StorgeValue.

Noah91

New Member
Joined
Mar 27, 2010
Messages
11
Reaction score
0
I'm looking for a function/script that let my monsters do not target players with StorgeValue.
I want to make a monster/npc that doesn't attack players with StorgeValue, something like invisible(utana vid).

I was trying with function OnAttack, but it works only on players.

function on StatChange works, but not exactly what i want, the monsters dont attack players but target them.:(

Please heelp!

Greetings, Noah.
 
I won't edit source(if it is possible).

Ofc i registered onAttack, and it does't make any change, for players works fine.
 
posible but eats tons of resources
why do you think so?
Code:
void Creature::onAttacking(uint32_t interval)
{
	if(!attackedCreature)
		return;

[B][COLOR="red"]	CreatureEventList attackEvents = getCreatureEvents(CREATURE_EVENT_ATTACK);
	for(CreatureEventList::iterator it = attackEvents.begin(); it != attackEvents.end(); ++it)
	{
		if(!(*it)->executeAttack(this, attackedCreature) && attackedCreature)
			setAttackedCreature(NULL);
	}[/COLOR][/B]

	if(!attackedCreature)
		return;

	onAttacked();
	attackedCreature->onAttacked();
	if(g_game.isSightClear(getPosition(), attackedCreature->getPosition(), true))
		doAttacking(interval);
}
that's pretty fast, besides it'll only be executed every 500 ms together with the normal onThink for all creatures. you really think it's going to make a difference?
sure, editing the searchtarget function would be faster but not as easy to add for everyone
and needs a lot of code to work as it should
what are you talking about? it's just a storage check
 
They don't know what they're talking about, I assume a post count is more important to most people than helping.
 
add this in the monster file
Code:
	<script>
		<event name="[I]event name from creaturescripts.xml[/I]"/>
	</script>
 
I used function onAttack(cid, target)
The monster stopped attack but still follow me :/

function onTarget(cid,target) - doesn't work.
 
Last edited:
I tried doMonsterChangeTarget and it makes no change, the monsters follow me.





It looks like the monster lost his target but if i move the monster follow me xd

Any Idea?
 
Last edited:
I answered to not editing source...
c++ is just so simple as removing player w/o storage from targets list and making player not receive aoe damage(and probably that monster shouldnt get dmg from player)
but lua way is huge workaround wasting a lot of time etc

next time try to understand discussion before correcting me ok?
 
Back
Top