Thread: D Spear special

Results 1 to 6 of 6
  1. #1 D Spear special 
    Registered Member
    ncarug02's Avatar
    Join Date
    May 2008
    Age
    30
    Posts
    893
    Thanks given
    6
    Thanks received
    4
    Rep Power
    92
    i have a question

    how can i make a player or a npc back away one square no matter what direction they are facing ive been wondering about this for awhile and also i need to know how to do it for a number of other things

    thanks



    ~Nick
    Reply With Quote  
     

  2. #2  
    Fuckin PRO

    Tyler's Avatar
    Join Date
    Jan 2008
    Age
    33
    Posts
    6,017
    Thanks given
    46
    Thanks received
    507
    Rep Power
    3330
    Can use WalkTo

    Code:
        public void WalkTo(int i, int j)
        {
            newWalkCmdSteps = 0;
            if(++newWalkCmdSteps > 50)
                newWalkCmdSteps = 0;
            int k = absX + i;
            k -= mapRegionX * 8;
            newWalkCmdX[0] = newWalkCmdY[0] = tmpNWCX[0] = tmpNWCY[0] = 0;
            int l = absY + j;
            l -= mapRegionY * 8;
    	isRunning2 = false;
    	isRunning = false;
            for(this.i = 0; this.i < newWalkCmdSteps; this.i++)
            {
                newWalkCmdX[this.i] += k;
                newWalkCmdY[this.i] += l;
            }
    	lastWalk = System.currentTimeMillis();
    	walkDelay = 20000;
            poimiY = l;
            poimiX = k;
        }
    Like

    WalkTo(0, 1);

    Or what ever direction, you could probably make it random it do their direction if you tried.
    Reply With Quote  
     

  3. #3  
    Donator

    Sir Lethal's Avatar
    Join Date
    Mar 2008
    Posts
    2,286
    Thanks given
    9
    Thanks received
    74
    Rep Power
    426
    Quote Originally Posted by pro k0er View Post
    Can use WalkTo

    Code:
        public void WalkTo(int i, int j)
        {
            newWalkCmdSteps = 0;
            if(++newWalkCmdSteps > 50)
                newWalkCmdSteps = 0;
            int k = absX + i;
            k -= mapRegionX * 8;
            newWalkCmdX[0] = newWalkCmdY[0] = tmpNWCX[0] = tmpNWCY[0] = 0;
            int l = absY + j;
            l -= mapRegionY * 8;
        isRunning2 = false;
        isRunning = false;
            for(this.i = 0; this.i < newWalkCmdSteps; this.i++)
            {
                newWalkCmdX[this.i] += k;
                newWalkCmdY[this.i] += l;
            }
        lastWalk = System.currentTimeMillis();
        walkDelay = 20000;
            poimiY = l;
            poimiX = k;
        }
    Like

    WalkTo(0, 1);

    Or what ever direction, you could probably make it random it do their direction if you tried.
    Thanks needed them as well .
    Reply With Quote  
     

  4. #4  
    Registered Member
    ncarug02's Avatar
    Join Date
    May 2008
    Age
    30
    Posts
    893
    Thanks given
    6
    Thanks received
    4
    Rep Power
    92
    Quote Originally Posted by Dark. View Post
    Thanks needed them as well .
    I tried that and it didn't work...
    Also I need it for npcs



    ~Nick
    Reply With Quote  
     

  5. #5  
    Previously Hyperion


    Join Date
    Jan 2009
    Posts
    1,254
    Thanks given
    3
    Thanks received
    18
    Rep Power
    138
    Quote Originally Posted by ncarug02 View Post
    I tried that and it didn't work...
    Also I need it for npcs
    tbh walkto is your best bet...short of making a new method for it. You could use walkto if you had some way to record player direction so it knew which way to push him.
    Reply With Quote  
     

  6. #6  
    Registered Member
    D3d Wildy's Avatar
    Join Date
    Aug 2007
    Posts
    578
    Thanks given
    24
    Thanks received
    6
    Rep Power
    180
    --Npcs
    server.npcHandler.npcs[i].absX += 1;
    server.npcHandler.npcs[i].absY += 1;
    --Players
    plr.WalkTo(1, 1);

    i think
    Proud to be apart of such an amazing RSPS community.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •