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

C++ Magic wall & Spells

MaR0

Banned User
Joined
Apr 16, 2018
Messages
272
Solutions
3
Reaction score
29
Hello Otlanders, i was wondering how to edit the magic wall field in source files to make the spells pass through from it like this gif and only hur spells like exevo tera hur, dunno where to do it in sources also when you try to hit two consecutive steps it blocks like this gif picture need a little help please using TFS [0.3.7].
Cheers,
Thanks.
 
Solution
C++:
ReturnValue Combat::canDoCombat(const Creature* caster, const Tile* tile, bool isAggressive, bool/* createItem*/)
{
    if(tile->hasProperty(BLOCKPROJECTILE) && !tile->getFieldItem()){
        return RET_NOTENOUGHROOM;
    }
   
    if (tile->floorChange()) {
        return RET_NOTENOUGHROOM;
    }

    if (tile->getTeleportItem()) {
        return RET_NOTENOUGHROOM;
    }

    if(caster)
    {
        bool success = true;
        CreatureEventList combatAreaEvents = const_cast<Creature*>(caster)->getCreatureEvents(CREATURE_EVENT_COMBAT_AREA);
        for(CreatureEventList::iterator it = combatAreaEvents.begin(); it != combatAreaEvents.end(); ++it)
        {
            if(!(*it)->executeCombatArea(const_cast<Creature*>(caster)...
Hello,

Combat.cpp
ReturnValue Combat::canDoCombat(Creature* caster, Tile* tile, bool aggressive)

change it from: if (tile->hasProperty(CONST_PROP_BLOCKPROJECTILE){

to:
ReturnValue Combat::canDoCombat(Creature* caster, Tile* tile, bool aggressive)
{
//use spell on magic wall
if (tile->hasProperty(CONST_PROP_BLOCKPROJECTILE) && !tile->getFieldItem()) {
return RETURNVALUE_NOTENOUGHROOM;
}
 
Hello,

Combat.cpp
ReturnValue Combat::canDoCombat(Creature* caster, Tile* tile, bool aggressive)

change it from: if (tile->hasProperty(CONST_PROP_BLOCKPROJECTILE){

to:
ReturnValue Combat::canDoCombat(Creature* caster, Tile* tile, bool aggressive)
{
//use spell on magic wall
if (tile->hasProperty(CONST_PROP_BLOCKPROJECTILE) && !tile->getFieldItem()) {
return RETURNVALUE_NOTENOUGHROOM;
}
Hello thanks for your reply!, this code that exist on my sources could you edit it ? because there's something is missing i think i got much errors
C++:
ReturnValue Combat::canDoCombat(const Creature* caster, const Tile* tile, bool isAggressive, bool/* createItem*/)
{
    if(tile->hasProperty(BLOCKPROJECTILE) || tile->floorChange() || tile->getTeleportItem())
        return RET_NOTENOUGHROOM;

    if(caster)
    {
        bool success = true;
        CreatureEventList combatAreaEvents = const_cast<Creature*>(caster)->getCreatureEvents(CREATURE_EVENT_COMBAT_AREA);
        for(CreatureEventList::iterator it = combatAreaEvents.begin(); it != combatAreaEvents.end(); ++it)
        {
            if(!(*it)->executeCombatArea(const_cast<Creature*>(caster), const_cast<Tile*>(tile), isAggressive) && success)
                success = false;
        }

        if(!success)
            return RET_NOTPOSSIBLE;

        if(caster->getPosition().z < tile->getPosition().z)
            return RET_FIRSTGODOWNSTAIRS;

        if(caster->getPosition().z > tile->getPosition().z)
            return RET_FIRSTGOUPSTAIRS;

        if(!isAggressive)
            return RET_NOERROR;

        const Player* player = caster->getPlayer();
        if(player && player->hasFlag(PlayerFlag_IgnoreProtectionZone))
            return RET_NOERROR;
    }

    return isAggressive && tile->hasFlag(TILESTATE_PROTECTIONZONE) ?
        RET_ACTIONNOTPERMITTEDINPROTECTIONZONE : RET_NOERROR;
}
 
C++:
ReturnValue Combat::canDoCombat(const Creature* caster, const Tile* tile, bool isAggressive, bool/* createItem*/)
{
    if(tile->hasProperty(BLOCKPROJECTILE) && !tile->getFieldItem()){
        return RET_NOTENOUGHROOM;
    }
   
    if (tile->floorChange()) {
        return RET_NOTENOUGHROOM;
    }

    if (tile->getTeleportItem()) {
        return RET_NOTENOUGHROOM;
    }

    if(caster)
    {
        bool success = true;
        CreatureEventList combatAreaEvents = const_cast<Creature*>(caster)->getCreatureEvents(CREATURE_EVENT_COMBAT_AREA);
        for(CreatureEventList::iterator it = combatAreaEvents.begin(); it != combatAreaEvents.end(); ++it)
        {
            if(!(*it)->executeCombatArea(const_cast<Creature*>(caster), const_cast<Tile*>(tile), isAggressive) && success)
                success = false;
        }

        if(!success)
            return RET_NOTPOSSIBLE;

        if(caster->getPosition().z < tile->getPosition().z)
            return RET_FIRSTGODOWNSTAIRS;

        if(caster->getPosition().z > tile->getPosition().z)
            return RET_FIRSTGOUPSTAIRS;

        if(!isAggressive)
            return RET_NOERROR;

        const Player* player = caster->getPlayer();
        if(player && player->hasFlag(PlayerFlag_IgnoreProtectionZone))
            return RET_NOERROR;
    }

    return isAggressive && tile->hasFlag(TILESTATE_PROTECTIONZONE) ?
        RET_ACTIONNOTPERMITTEDINPROTECTIONZONE : RET_NOERROR;
}
 
Solution
C++:
ReturnValue Combat::canDoCombat(const Creature* caster, const Tile* tile, bool isAggressive, bool/* createItem*/)
{
    if(tile->hasProperty(BLOCKPROJECTILE) && !tile->getFieldItem()){
        return RET_NOTENOUGHROOM;
    }
  
    if (tile->floorChange()) {
        return RET_NOTENOUGHROOM;
    }

    if (tile->getTeleportItem()) {
        return RET_NOTENOUGHROOM;
    }

    if(caster)
    {
        bool success = true;
        CreatureEventList combatAreaEvents = const_cast<Creature*>(caster)->getCreatureEvents(CREATURE_EVENT_COMBAT_AREA);
        for(CreatureEventList::iterator it = combatAreaEvents.begin(); it != combatAreaEvents.end(); ++it)
        {
            if(!(*it)->executeCombatArea(const_cast<Creature*>(caster), const_cast<Tile*>(tile), isAggressive) && success)
                success = false;
        }

        if(!success)
            return RET_NOTPOSSIBLE;

        if(caster->getPosition().z < tile->getPosition().z)
            return RET_FIRSTGODOWNSTAIRS;

        if(caster->getPosition().z > tile->getPosition().z)
            return RET_FIRSTGOUPSTAIRS;

        if(!isAggressive)
            return RET_NOERROR;

        const Player* player = caster->getPlayer();
        if(player && player->hasFlag(PlayerFlag_IgnoreProtectionZone))
            return RET_NOERROR;
    }

    return isAggressive && tile->hasFlag(TILESTATE_PROTECTIONZONE) ?
        RET_ACTIONNOTPERMITTEDINPROTECTIONZONE : RET_NOERROR;
}
errors on compiling :/
Code:
1>..\combat.cpp(222): error C2065: 'RETURNVALUE_NOTENOUGHROOM': undeclared identifier
1>..\combat.cpp(226): error C2065: 'RETURNVALUE_NOTENOUGHROOM': undeclared identifier
 
errors on compiling :/
Code:
1>..\combat.cpp(222): error C2065: 'RETURNVALUE_NOTENOUGHROOM': undeclared identifier
1>..\combat.cpp(226): error C2065: 'RETURNVALUE_NOTENOUGHROOM': undeclared identifier
i will explain some point as my tfs is 0.3.7
change
Code:
RETURNVALUE_NOTENOUGHROOM
to
Code:
RET_NOTENOUGHROOM
thanks in advance @anyeor much appreciate
 
Back
Top