EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=621)
-   -   Scripted waypoints with the scripting engine. (https://www.eqemulator.org/forums/showthread.php?t=1591)

Malevolent 04-30-2002 12:07 PM

Scripted waypoints with the scripting engine.
 
Previously, I used a database to do this. This time, I've used the scripting engine. The performance is about the same, so far as I can tell.

You can try it out in the lab, just zone to butcherblock.

Let me attach the script file I'm using before going into the code.

This attached quest file will move the sirens bane in a kind of elipse around the shore in butcherblock.

Malevolent 04-30-2002 12:09 PM

I had a problem with the triggers all going off at the same time. I fixed this by just assigning some really large random number.
In NPC.CPP, specifically in the constructor:

Code:

        SetWayPointStep(0);
        waypoint_timer = new Timer(30000+rand()%20000);
        waypoint_timer->Start();

In NPC.CPP, specifically in process:

Code:

        /*********************************************
        Waypoints
        *********************************************/       


        if (ismovinghome==false && !IsEngaged()){
                if (waypoint_timer->Check()){                       
                        if (this->GetWayPointStep() < 6){
                               
                                if (!this->IsCorpse() && !this->IsClient())
                                this->CheckQuests(zone->GetShortName(), "WAYPOINT_CHECK", this->GetNPCTypeID());
                               
                        } else
                        {
                                this->SetWayPointStep(0);
                        }

                        waypoint_timer->Start(50000+rand()%25000);

                }               

        }


Malevolent 04-30-2002 12:10 PM

In npc.h, add these parts to the public members of the NPC class.

Code:

        /******************************************************
        WayPoints
        ******************************************************/
       
        void SetWayPointStep(uint32 step){ Step=step;}
        uint32 GetWayPointStep(){return Step;}
        uint32 Step;
       
        /******************************************************
        Mob quest engine
        ******************************************************/
        void CheckQuests(char* zonename, char * message, int32 npc_id, int32 item_id = 0, bool IsDoorScript = false);
        bool IsEnd(char* string);
        bool IsCommented(char* string);
        char * rmnl(char* nstring);       
        char * strreplace(char* searchstring, char* searchquery, char* replacement);

And add this to the private member:
Code:

        Timer*  waypoint_timer;

Malevolent 04-30-2002 12:11 PM

Use this hacked and dirt wesquests.cpp:

Malevolent 04-30-2002 12:17 PM

Oh, and in npc.h in public: I have
Code:

void    SetIsMovingHome(bool ToF) { ismovinghome=ToF;}
bool    GetIsMovingHome() { return ismovinghome;}

And I moved
float org_x, org_y, org_z, org_heading; up from protected to public.


All times are GMT -4. The time now is 09:05 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.