[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Game Scripting Problem
- From: "Vincent Penquerc'h" <vincent@...>
- Date: Mon, 4 Dec 2000 10:19:54 -0000
> ----------------------------
> Spawn("Location 1")
>
> do
> GotoLocation("Location 2")
> Wait(2)
> GotoLocation("Location 1")
> Wait(2)
> end
> ----------------------------
As an example, here is how I handle the goto commands:
When I need to go to a particular location, I call a game
routine "FindPathTo", which returns a userdata (a path).
I then call "FollowPath" for the character. This will set
the path as the 'current' path. Every game tick, if the
character has a current path, it progresses through it.
When it reaches the end of the path, the current path is
reset to nothing.
If I want to be notified whenever the character reaches its
target, I set a scope on the location where to go. A scope
is a location or a set of locations which, upon being entered
or left by a character, send a message to the scope creator.
This allows to be notified whenever arriving to destination,
but other things to: a merchant can know whenever someone
enters or leaves its store, etc, etc.
Having a pause instruction in your script will require you
to modify Lua or to have complex housekeeping in your engine.
--
Lyrian