Jump to content
  • 0

Create a 'guide' around town. script that walks player to an NPC


DR4LUC0N

Question


  • Group:  Members
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   6
  • Joined:  04/04/12
  • Last Seen:  

Hello everyone, I don't know if this would be hard, but wanted to create a script that when a new account goes into a map for the first time a message comes up and asks the player if they would like a guide. Then if they do, it makes them walk from the spot of @go 0 to the next npc in the guide who will then talk to them upon arrival, then again ask if they want to continue the guide and if they do the script makes the player walk to the next NPC, kind of like how in Pokemon games the games walks around with you in pallet Town and tells you about the town and he talks after moving. But the script moves the p[layer without them having any control. Also if the player wants to redo the guide he talks to the NPC and it'll allow the player to restart the guide. If the player goes through the guide they will be rewarded  with an item, but if they already have been rewarded they don't get them again.

I'm honestly not sure the extent of scripting, so I don't know if this is a doable thing. I would greatly appreciate any help on this. ❤️ 

Edited by DR4LUC0N
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

use this

*unitwalk <GID>,<x>,<y>{,"<event label>"};
*unitwalkto <GID>,<Target GID>{,"<event label>"};

This command will tell a <GID> to walk to a position, defined either as a set of
coordinates or another object. The command returns a 1 for success and 0 upon failure.

If coordinates are passed, the <GID> will walk to the given x,y coordinates on the
unit's current map. While there is no way to move across an entire map with 1 command
use, this could be used in a loop to move long distances.

If an object ID is passed, the initial <GID> will walk to the <Target GID> (similar to
walking to attack). This is based on the distance from <GID> to <Target ID>. This command
uses a hard walk check, so it will calculate a walk path with obstacles. Sending a bad
target ID will result in an error.

An optional Event Label can be passed as well which will execute when the <GID> has reached
the given coordinates or <Target GID>.

Examples:

// Makes player walk to the coordinates (150,150).
	unitwalk getcharid(3),150,150;

// Performs a conditional check with the command and reports success or failure to the player.
	if (unitwalk(getcharid(3),150,150))
		dispbottom "Walking you there...";
	else
		dispbottom "That's too far away, man.";

// Makes player walk to another character named "WalkToMe".
	unitwalkto getcharid(3),getcharid(3,"WalkToMe");

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   6
  • Joined:  04/04/12
  • Last Seen:  

Thanks @Emistry, sorry for the late reply.

I actually found this out yesterday haha. Been trying to experiment with it. I think I got my idea basically done, but there's a few things about what I'm trying to do, and my limited knowledge with scripting. So I'd like to ask, basically my current script I have it so the previous npc keeps a mes window up on the players screen using sleep until the next npc talks over it. Is there a way to have the player not be able to click off the unit walk? Like how when a mes window is on the screen they can't click on anything. 

Here's the basic example of my script.

prontera,153,175,5    script    test    757,1,1,{
Ontouch:
    atcommand "@speed 50";
    mes "blah blah blah?";
    close2;
    mes "";
    unitwalk getcharid(3),153,165; //Start moving on guide.
    sleep 1000000000;
    end;
    }

prontera,154,165,5    script    connecting npc    -1,1,1,{

OnTouch:
    unitwalk getcharid(3),1153,155;
    }



prontera,153,154,5    script    ending test npc    757,1,1,{
Ontouch:
    atcommand "@speed 100";
    mes "blah2 blah2 blah2";
    close2;
    end;
    }

Now if you fill in the blanks you'll see how the script functions, is there a way to stop the player from clicking on npc or during Unitwalk without the mes window staying up on their screen? Pcblock move stops them from moving in general, even by force of script. I am using other pcblock to stop commands and sit/stand And I am not knowledgeable enough with source edit to change this. Or is my solution to my problem sufficient? Thanks for any insight you can give

 

Edited by Mael
Use codebox
Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

you can use this to block the action/movement of player

*setpcblock <type>,<state>{,<account ID>};

'setpcblock' command prevents/allows the player from doing the given <type> of action according
to the <state> during the player session (note: @reloadscript removes all <type> except PCBLOCK_IMMUNE).
The <type> values are bit-masks, multiples of <type> can be added to change the player action.

The action is blocked when the <state> is true, while false allows the action again.

'getpcblock' command return the bit-mask value of the currently
enabled block flags.

Available <type>:
	PCBLOCK_MOVE				Prevent the player from moving.
	PCBLOCK_ATTACK				Prevent the player from attacking.
	PCBLOCK_SKILL				Prevent the player from using skills/itemskills.
	PCBLOCK_USEITEM				Prevent the player from using usable items.
	PCBLOCK_CHAT				Prevent the player from sending global/guild/party/whisper messages.
	PCBLOCK_IMMUNE				Prevent the player from being hit by monsters.
	PCBLOCK_SITSTAND			Prevent the player from sitting/standing.
	PCBLOCK_COMMANDS			Prevent the player from using atcommands/charcommands.
	PCBLOCK_NPCCLICK			Prevent the player from clicking/touching any NPC/shop/warp.
	PCBLOCK_EMOTION				Prevent the player from using emotions.
	PCBLOCK_NPC				Simulate NPC interaction. Useful for NPC with no mes window. Sum of PCBLOCK_MOVE|PCBLOCK_SKILL|PCBLOCK_USEITEM|PCBLOCK_COMMANDS|PCBLOCK_NPCCLICK.
	PCBLOCK_ALL				Sum of all the flags.
// Make the attached player invulnerable to monster (same as @monsterignore)
	setpcblock PCBLOCK_IMMUNE, true;

// Prevents the attached player from attacking and using skills
	setpcblock PCBLOCK_ATTACK|PCBLOCK_SKILL, true;

// Re-enables attack, skills and item use
	setpcblock PCBLOCK_ATTACK|PCBLOCK_SKILL|PCBLOCK_USEITEM, false;

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   6
  • Joined:  04/04/12
  • Last Seen:  

On 5/13/2021 at 3:25 PM, Emistry said:

you can use this to block the action/movement of player


*setpcblock <type>,<state>{,<account ID>};

'setpcblock' command prevents/allows the player from doing the given <type> of action according
to the <state> during the player session (note: @reloadscript removes all <type> except PCBLOCK_IMMUNE).
The <type> values are bit-masks, multiples of <type> can be added to change the player action.

The action is blocked when the <state> is true, while false allows the action again.

'getpcblock' command return the bit-mask value of the currently
enabled block flags.

Available <type>:
	PCBLOCK_MOVE				Prevent the player from moving.
	PCBLOCK_ATTACK				Prevent the player from attacking.
	PCBLOCK_SKILL				Prevent the player from using skills/itemskills.
	PCBLOCK_USEITEM				Prevent the player from using usable items.
	PCBLOCK_CHAT				Prevent the player from sending global/guild/party/whisper messages.
	PCBLOCK_IMMUNE				Prevent the player from being hit by monsters.
	PCBLOCK_SITSTAND			Prevent the player from sitting/standing.
	PCBLOCK_COMMANDS			Prevent the player from using atcommands/charcommands.
	PCBLOCK_NPCCLICK			Prevent the player from clicking/touching any NPC/shop/warp.
	PCBLOCK_EMOTION				Prevent the player from using emotions.
	PCBLOCK_NPC				Simulate NPC interaction. Useful for NPC with no mes window. Sum of PCBLOCK_MOVE|PCBLOCK_SKILL|PCBLOCK_USEITEM|PCBLOCK_COMMANDS|PCBLOCK_NPCCLICK.
	PCBLOCK_ALL				Sum of all the flags.

// Make the attached player invulnerable to monster (same as @monsterignore)
	setpcblock PCBLOCK_IMMUNE, true;

// Prevents the attached player from attacking and using skills
	setpcblock PCBLOCK_ATTACK|PCBLOCK_SKILL, true;

// Re-enables attack, skills and item use
	setpcblock PCBLOCK_ATTACK|PCBLOCK_SKILL|PCBLOCK_USEITEM, false;

 

Sorry for the late reply, got it thanks a bunch! 

Link to comment
Share on other sites

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.

×
×
  • Create New...