• 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!

Passive Monsters + Experience per Attack !

lenon00

New Member
Joined
Feb 5, 2010
Messages
21
Reaction score
0
Anyone knows about theses?

Passive Monsters :
They only'll attack a player, when a player attack it.

Experience per Attack :
Doesn't need much explanation, i've heard this is possible,
but I could not find :( ,


Please , Help me Mans, i'll Rep+U.
Thank You !
 
Doesn't need much explanation? I don't get it..

Passive monsters will need a source edit to change their behavior
 
Well yeah as Summ said about the passive one, it needs some minor source change. The experience one can be made with function

function onAttack(cid, target)

but you have to edit every monster to be 0 exp or so :p
 
Loal but what happens if monster is not hostile and onAttack script will get the flag `passive` from xml or lua table (without source edit) and then set target on player? Learn to think kiddos : P
 
I've posted you the solution that might work. Got no time to test it though, I'll see, maybe gonna do it tomorrow.
 
Stop monster from attacking players (hostile flag), then make a script using onAttack and doMonsterSetTarget function that will make monster target player. That's all. I don't have time to make such a script yet, sorry, but I had given you a complete solution that might work.

@edit
After some tests it seems that not hostile monster won't attack player even if target is set by the script. Let's try doChallengeCreature.

@edit2
in bool Monster::selectTarget(Creature* creature) there is:
Code:
if(([B][U][SIZE="5"]isHostile()[/SIZE][/U][/B] || isSummon()) && setAttackedCreature(creature) && !isSummon())
		Dispatcher::getInstance().addTask(createTask(
			boost::bind(&Game::checkCreatureAttack, &g_game, getID())));

so the only solution is to create new flag in monsters like "staticHostility" and the check would be like
Code:
(isHostile() [B][U][SIZE="5"]|| (need_check_if_player_attacked_target && isStaticHostile())[/SIZE][/U][/B] || isSummon()).......
#note I have no idea how to check if player is attacking the selected creature : f

so we have to add:
Code:
if(readXMLString(tmpNode, "staticHostile", strValue))
						mType->isStaticHostile = booleanString(strValue);
to monsters.cpp (within flag checks)

as well as:
Code:
bool isStaticHostile() const {return mType->isStaticHostile;}
to the class Monster

and of course default value in class MonsterType and to void MonsterType::reset
(void Player::eek:nAttackedCreatureDrain and bool Monster::canUseAttack(const Position& pos, const Creature* target) const may need changes too)

@edit3
Well, I have to give up now. Gonna check it out later : D
 
Last edited:
Back
Top