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

Compiling Make summon walk on protectionzone

Ecstacy

Mothafuckaaa
Joined
Dec 26, 2008
Messages
3,836
Reaction score
108
Location
The Netherlands
Hey,

I'm totally new to C++ so I need some help.

I want that player summons are able to walk on PZ tiles, but regular monsters aren't.

I have tried to change
Code:
if(hasFlag(TILESTATE_PROTECTIONZONE))
				return RET_NOTPOSSIBLE;

to
Code:
if(hasFlag(TILESTATE_PROTECTIONZONE))
				return [B]RET_NOERROR[/B];

But that makes monsters also able to walk on PZ tiles.

tile.cpp part
Code:
if(const Monster* monster = creature->getMonster())
		{
			[B]if(hasFlag(TILESTATE_PROTECTIONZONE))
				return RET_NOTPOSSIBLE;[/B]

			if(floorChange() || positionChange())
				return RET_NOTPOSSIBLE;

			if(monster->canPushCreatures() && !monster->isSummon())
			{
				if(creatures)
				{
					Creature* tmp = NULL;
					for(uint32_t i = 0; i < creatures->size(); ++i)
					{
						tmp = creatures->at(i);
						if(creature->canWalkthrough(tmp))
							continue;

						if(!tmp->getMonster() || !tmp->isPushable() ||
							(tmp->getMonster()->isSummon() &&
							tmp->getMonster()->isPlayerSummon()))
							return RET_NOTPOSSIBLE;
					}
				}
			}

Thanks in advance,
unknown666
 
Where do I have to add that?

Code:
if(monster->getMaster())
		{
          if(hasFlag(TILESTATE_PROTECTIONZONE))
           return RET_NOERROR;
           }

doesn't work, and if I just paste it after the protectionzone thingy, it doesn't work either.
 
Code:
if(const Monster* monster = creature->getMonster())
		{
			if(monster->getMaster())
				return RET_NOERROR;

			if(hasFlag(TILESTATE_PROTECTIONZONE))
				return RET_NOTPOSSIBLE;

			if(floorChange() || positionChange())
				return RET_NOTPOSSIBLE;

			if(monster->canPushCreatures() && !monster->isSummon())
			{
				if(creatures)
				{
					Creature* tmp = NULL;
					for(uint32_t i = 0; i < creatures->size(); ++i)
					{
						tmp = creatures->at(i);
						if(creature->canWalkthrough(tmp))
							continue;

						if(!tmp->getMonster() || !tmp->isPushable() ||
							(tmp->getMonster()->isSummon() &&
							tmp->getMonster()->isPlayerSummon()))
							return RET_NOTPOSSIBLE;
					}
				}
			}

I may be wrong, not sure.
 
you can try this :S
Code:
if(const Monster* monster = creature->getMonster())
		{
			if(monster->getMaster())
				[B][COLOR="Red"]for(ItemVector::const_iterator it = items->begin(); it != items->end(); ++it)
				{
					thisItem = (*it);
						const ItemType& iType = Item::items[thisItem->getID()];
						if(thisItem->isBlocking(creature) && (!iType.moveable || (thisItem->isLoadedFromMap() &&
							(thisItem->getUniqueId() || (thisItem->getActionId()
							&& thisItem->getContainer())))))
							return RET_NOTPOSSIBLE;[/COLOR][/B]
				}
				return RET_NOERROR;

			if(hasFlag(TILESTATE_PROTECTIONZONE))
				return RET_NOTPOSSIBLE;

			if(floorChange() || positionChange())
				return RET_NOTPOSSIBLE;

			if(monster->canPushCreatures() && !monster->isSummon())
			{
				if(creatures)
				{
					Creature* tmp = NULL;
					for(uint32_t i = 0; i < creatures->size(); ++i)
					{
						tmp = creatures->at(i);
						if(creature->canWalkthrough(tmp))
							continue;

						if(!tmp->getMonster() || !tmp->isPushable() ||
							(tmp->getMonster()->isSummon() &&
							tmp->getMonster()->isPlayerSummon()))
							return RET_NOTPOSSIBLE;
					}
				}
			}
 
Oops hehe, found the error.

Code:
if(!ground)
	return RET_NOERROR;

should be

Code:
if(!ground)
	return RET_NOTPOSSIBLE;

:|

Thanks again Existance(Xeon is faster to type :p)

Code:
You must spread some Reputation around before giving it to Existance again
 
i would like to also use this but idk where to put it, could someone help me out and tell me where to edit this into?
 
theres a problem on this code, when you are out of pz and you put your summon in, he can still attack monsters out pz.. like, if you are atacking a creature next to depot and your summon are inside it, he will inflict damage.. :S
 
Back
Top