Recall
Stone Tutorial
by
Ryan "WarLocke"
Brown
So,
you want to make a Recall Stone system, do you?
My
experience has shown me that these little gems are a great
frustration saver. They eliminate boring treks back to town
to sell loot in singleplayer, and (with the right setup) can
make it much easier to keep a party together in multiplayer.
If you would like to set up a recall system, read on.
The
first thing you'll need to make for a recall system is the
recall item, itself. In the Aurora Toolset, start the Item
Wizard (Wizards -> Item Wizard, or CTRL+ALT+I). The first
thing you need to do is select the type of item you wish to
use. For reference, the Recall Stone used in the Official
Campaing is a Miscellaneous Medium item. Now, name it whatever
you'd like (Recall Stone, Recall Token, Transmogrification
Cube, etc) and select the palette category you wish to file
it under. Make sure you have "Launch Item Properties"
checked, and click on Finish.
Now
we're in the Item Properties window. On the General tab, make
sure you give the item charges if you plan on making it charge-dependant.
You can also add to Additional Cost if you want the player
to have to buy this item. Make sure that you jot down or can
remember its Tag, as you will need it later.
On
the Appearance tab, choose what you would like the item to
appear as in the player's inventory. on the Properties tab,
give the item the "Cast Spell - Unique Power Self Only"
attribute (or the "Cast Spell - Unique Power" attribute
if you would like it to be used on other players). Click on
the right-pointing arrow to add it to the Assigned Properties
window, then highlight it and click on Edit Property. In the
new window, select whether it will be a single-use item (destroyed
after one use), an unlimited-use item, or limited by uses-per-day
or charges-per-use. Make sure to check the Identified box
unless you want your players to have to identify it themselves.
Finally,
type up a description of the item on the Description tab.
Viola, a Recall Stone!
Now,
how do we get it to work? We've made our recall item, but
so far it doesn't actually do anything (the "Unique Power"
and "Unique Power - Self Only" abilities send a
notice to the module that an item was activated, but nothing
else). In order to get our recall item working, we must write
a few scripts. Open up Edit->Module Properties->Events
and click the "Edit" button next to the OnActivateItem
event. Delete anything in the script editor window and type
(or paste) this script in:
void
main()
{
// This line determines which player activated the item.
object oPlayer = GetItemActivator();
// This line determines what item has been activated.
object oActivated = GetItemActivated();
// Run this snippet if the activated item's tag is "RecallItem".
if(GetTag(oActivated) == "RecallItem")
{
// Set the player's current location in a local variable.
location lLoc = GetLocation(oPlayer);
SetLocalLocation(oPlayer, "RECALL_LOC", lLoc);
// Call a second script to do the actual jump.
ExecuteScript("recallitem", oPlayer);
}
}
A
few notes:
-- On line 9, "RecallItem" needs to be replaced
with the Tag of your custom recall item.
-- on line 13, "RECALL_LOC" is a custom variable
that stores the location of the character when he or she uses
the recall item. This variable is used when the player wants
to return to the location at which they used the item (by
using the Official Campaign's Recall Portals, for example).
-- on line 15, "recallitem" needs to be replaced
with the name of the script your custom recall item will call
when it is used (which we will be creating next).
Name
this script whatever you'd like (I use "onactivateitem",
personally) and save it. Exit out of Module Properties.
Now,
you may have noticed that in the previous script, we checked
to see if the item the player activated was a recall item
(the reason being, an item cannot have a script attached directly
to it; you have to "fudge it" by attaching the script
to the module and checking for item use. This also allows
us to have several item checks in one script--if the activated
item is a recall item, do this; if it's a sword of dancing,
do this, etc), and then we told the module to execute the
"recallitem" script. Now we need to create the script
so the module can run it. Open up Tools->Script Editor,
delete what will be in the window, and type (or paste) in
this script:
void
main()
{
// This line determines which player activated the item.
object oPlayer = GetItemActivator();
// This line determines what item has been activated.
object oActivated = GetItemActivated();
{
// Double-check that the activated item was a Recall Item.
// This section is probably redundant, but I believe in
// being thorough.
if(GetTag(oActivated) == "RecallItem")
{
// The next two lines set the location to recall to,
// and jump to it.
object oObject = GetWaypointByTag("RECALL_SOURCE");
AssignCommand(oPlayer,JumpToObject(oObject));
}
}
}
Again,
you want to change "RecallItem" (in line 11) with
the Tag of your custom item. Also, in line 15, "RECALL_SOURCE"
is the Tag of the Waypoint at which you want the character
to appear when he or she uses the recall item. Save this script
(making sure you name it exactly as the name you entered on
line 15 of the OnActivateItem script, or it won't run), and
exit out of the Script Editor.
Now,
once you have given the player their recall item and placed
a Waypoint Tagged as RECALL_SOURCE, you should have a working
recall item!
Unfortunately,
right now it will only work one-way; to enable the character
to return to where he or she used the item, we will need another
script, however this script will be launched through a conversation.
Create an NPC (any will do, really--as long as it is not actively
hostile to the player). Place it in an area (probably near
the RECALL_SOURCE Waypoint) and open its Properties dialog
(RightClick->Properties). Now we should be in the Conversation
Editor. For the purposes of this tutorial, we will only need
a simple dialog. With "Root" highlighted, click
the topmost button on the left ("Add") and type
this in (minus the quotations):
"Would
you like to return to the place where you used your Recall
Item?"
This
line now becomes the NPC's initial dialog (what he or she
first says when the player talks to them). Now, we need to
add the player responses. With that line ("Would you
like...") highlight, add a "Yes" and "No"
response for the player to choose from. At this point that
conversation should look like this:
Would
you like to return to the place where you used your Recall
Item?
|-- Yes.
|-- No.
Now,
highlight the "Yes" player response and look in
the lower-righthand corner of the Conversation Editor. Select
the tab marked "Actions Taken". Now click on the
"Edit" button to the right of the "Script"
drop-down box. Delete what will be in this Script Editor window
and type (or paste) the following script in:
void
main()
{
// This line determines which character is having this conversation.
object oPlayer = GetPCSpeaker();
// This line determines where the character last used their
recall item.
location lLoc = GetLocalLocation(oPlayer, "RECALL_LOC");
// This line jumps the character to their last recall location.
AssignCommand(oPlayer, ActionJumpToLocation(lLoc));
}
Save
the script and exit the Script Editor and the NPC's Properties
dialog. That's it! You now have a working two-way recall item!
|