Menu

#7 Pets and Hirelings following through Gates/Teleports

open
nobody
5
2003-08-02
2003-08-02
Anonymous
No

Simple but fairly elegant Solution to the problem:

This gets put in teleport.cpp...
In two sections:
void teleporters(CHARACTER s)

void objTeleporters(int s)
.... (type=60)

Here is my Modified Version,
(the second goes in the type==60 [MoonGate Type)]

void teleporters(CHARACTER s)
{
P_CHAR pc_s = MAKE_CHARREF_LR(s);
<<<<<<<<<<<SNIP>>>>>>>>>>>>
teleport(s);
//Mythic Debug
//Lets Fix Tamed Following the Character
//If a PC goes through a Dungeon Entrance/Exit
[teleporters()]
// See if they have any Tamed following
// If so.. Move the Tamed through the Entrance/Exit
Right Behind em...

P_CHAR pc_b=NULL;
if( !pc_s->npc && pc_s->summoned>0 )
{
int a=0,b=0;
int serhash=pc_s->serial%HASHMAX;
for(a=0;a<cownsp[serhash].max;a++)
//Put all their Pets/Hirlings right next to em
{
b=cownsp[serhash].pointer[a];
if (b!=-1) //-1's that indicate non existance !!!
{
pc_b=MAKE_CHARREF_LOGGED(b,err);
if (!err )
{
if (pc_b->npc && pc_s->Owns(pc_b))
{
mapRegions->RemoveItem(b+CharacterOffset);
pc_b->x=iter_tele_locations->second.destination.x;
pc_b->y=iter_tele_locations->second.destination.y;
pc_b->dispz=pc_b->z=iter_tele_locations->second.destination.z;
mapRegions->AddItem(b+CharacterOffset);
teleport(b);
}
}
}
}
}
return;
}
}
iter_tele_locations++;
}
}

The only Difference in objecttele...()
iis we only do this instead of mapRegions->

                                          if\( chardist\(DEREF\_P\_CHAR\(pc\_s\),b\) < 15 \)

{
pc_b->MoveTo(pmi->morex,pmi->morey,pmi->morez);
teleport(b);
}
==================================

That works very well. I have some major modifications
to the old 12.x Source and can not Merge/Update to the
new code anymore. I just thought this would be an
improvement over the hassles of tamed/hirelings and
getting them through the Dungeons. I've tested this
with the base world with some modifications where Your
World File has Teleporter Logs placed and Located
through the Teleport.scp Script.... I've tested most
locations with no hassles at all. (Oh and Tamed stay no
closer then 3 Hexes which is why I did a distance check
-- AI and Follow target changes)

Mind you, I have majorly modified this code, including
a whole new Multiple AI Types with a Modified P_AI
search routine for targets and 128 Spells instead of
64, (Wizard and Cleric Classes-- of the 6 Classes) in
the current Verison I call WolfMod 2.5a .

So ignore the pc_s->summoned, I limit Players to a Max
[3] controlled Creatures Summoned/Charmed/Tamed. I had
to add a Counter to track em and I use it for the Word
of Faith and Sanctuary spells as well. (Players don't
have a SummonTimer running, so I put it to use for
Sanctuary -- No sense creating anymore extra memory
needs if I don't have to ... *ugh*).

ps> You will notice most of this is just cut and paste
from the Two Versions [12.x - latest], as I was
glancing through how you all were updating LoS checks
-- (I fixed the issue with Cave Walls -- Just did a
map.height check during the map.id test for mountains
-- worked like a champ [at least so far -- needs more
testing] ).

Enjoy...
Mythic of Everon Worlds
(programmer/developer/admin/network tech -- basically
the whole 9 nine yards)

Discussion

  • Nobody/Anonymous

    Logged In: NO

    Oh you will need to do another 2 checks before teleporting
    the Creature:

    ->npcWander==1 (Meaning they are following an ftarg [owner])
    (and)
    chardist(pet,owner)<15

    This is needed in both functions in case they leave a pet
    behind (with stop / stay command)
    OR they just run off and leave it fighting (Can't give em
    everything after all).

    Mythic

     
  • Nobody/Anonymous

    Logged In: NO

    One other little note before I stop posting here.
    Think Extraneous calls and Functions..
    Think Tempeffectsoff() / ...on()
    Think of access to Variables --
    Look at your access to Dex -- effDex(), realDex(), setDex()
    Look at Str/Int/Def

    Now if you setup protected access functions almost exactly
    the same for those other three Variables, You will no longer
    need to call the above two functions before Saving The World
    File...

    Thus cut down on Lengthy Calls..
    Cut down on Other calls as well...
    Avoid screwed up Stats with TempEffects()...

    It took me very little time to convert All the code to
    access, (less then a day actually), these all now through
    protected functions... Works like a champ! Add to that I
    have New tempeffects now (New potions/spells) which use
    tempeffects...

    Mythic

     

Log in to post a comment.