Make "drive to" work like "go to" for exits.

In my game one moves to different locations (exits) by car. For example, if the player types "go to forest" while in the car, they will go through the forest exit to the assigned location.

I would like the player to be able to say "drive to" in addition to "go to" to move to different exits. Is there some way that I can do this?


If you just want to add an alternate synonym for the built-in command, you could just change the pattern for the go command. The default pattern is ^go to (?<exit>.*)$|^go (?<exit>.*)$|^(?<exit>north|east|south|west|northeast|northwest|southeast|southwest|in|out|up|down|n|e|s|w|ne|nw|se|sw|o|u|d)$ (it's a bit complex to make sure it matches all the different ways you can already tell Quest to go somewhere). So if you want "drive to" to work as if the player typed "go to", you could put this in your start script:

go.pattern = "^(go|drive) to (?<exit>.*)$|^(go|drive) (?<exit>.*)$|^(?<exit>north|east|south|west|northeast|northwest|southeast|southwest|in|out|up|down|n|e|s|w|ne|nw|se|sw|o|u|d)$"

If you want to make a drive command which only works when the player has a car, or something like that, you could make a "drive to" command which just calls the basic "go" command.

For example, you could make a drive command with the pattern drive to #exit#, and give it the script:

do (go, "script", QuickParams ("exit", exit))

which will cause it to call the built-in "go" command.


Log in to post a reply.

Support

Forums