Jump to content
  • 0

Npc appears and push player out


Question

Posted

Im doing a npc event how appears in prontera where people sit and talk.

My problem is: if someone sit in the exact square of this npc.

I need the npc appears and push a litle the players.

I tryed with magnum break skill, i tried with npc walking with ontouch warp off.

I really dont know what to do now XD.

6 answers to this question

Recommended Posts

  • 0
Posted

On doc/script_commands.txt:

*pushpc <direction>,<cells>;

This command will push the currently attached player to given direction by given
amount of square cells. Direction is the same as used when declaring NPCs, and
can be specified by using one of the DIR_* constants (db/const.txt).

The knock-back is not restricted by items or map flags, only obstacles are taken
into account. If there is not enough space to perform the push (e.g. due to a
wall), the character is pushed only up to the obstacle.

    // pushes the character 5 cells in 3 o'clock direction from its
    // current position.
    pushpc DIR_EAST, 5;
  • 0
Posted

 

On doc/script_commands.txt:

*pushpc <direction>,<cells>;

This command will push the currently attached player to given direction by given
amount of square cells. Direction is the same as used when declaring NPCs, and
can be specified by using one of the DIR_* constants (db/const.txt).

The knock-back is not restricted by items or map flags, only obstacles are taken
into account. If there is not enough space to perform the push (e.g. due to a
wall), the character is pushed only up to the obstacle.

    // pushes the character 5 cells in 3 o'clock direction from its
    // current position.
    pushpc DIR_EAST, 5;

 

But how the npc use this?

I try alot with touch:

but not works when the player is already on the area. The player need to exit first, then enter again to use ontouch: 

  • 0
Posted

On doc/script_commands.txt:

*getareausers("<map name>",<x1>,<y1>,<x2>,<y2>)

This function will return the count of connected characters which are located 
within the specified area - an x1/y1-x2/y2 square on the specified map.

This is useful for maps that are split into many buildings, such as all the 
"*_in" maps, due to all the shops and houses.

You can use that function to check if there's players, then, configure various points of spawn for your NPC, so, the players can be out of the OnTouch area, then, the NPC can walk and knock the players.

  • 0
Posted (edited)
 
 

Ontouch is super weird, sometimes works. I figure out i need more range for ontouch, i used 3x3.

With 5,5 never fails. But just works 1 time.

prontera,156,89,4 script fencima 80,5,5,{
end;

OnTouch:
pushpc rand(0,8), 5;
end;
}
Edited by badneko

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...