[crossfire] User-defined plugin events and the 'give' command
crossfire at ailesse.com
crossfire at ailesse.com
Sat Dec 22 19:38:50 CST 2007
Hi,
Here is a short summary of what my latest commit is about. Note that the following is only valid for the trunk code.
1.User-defined plugin events
============================
User-defined events are events that are triggered by plugins themselves, and are not hardcoded in the server "core"
code. Useful if you want to create a new kind of event that is generated from a Python script, for example.
In CFPython, a user-defined event is triggered on an object by calling its Event() method. Event takes the following
parameters:
- activator (object): The activator of this event;
- other (object): A third object involved in the action;
- message (string): A freeform text that will be used by the target to determine what kind of event it is;
- fix (int): Tells if the target will need to be fixed automatically or not after the event execution.
Event returns an int; the event implementer is free to do whatever it wants with it.
The archetype to put into the inventory of an object to make it listen to user-defined events is event_user.
2. The "give" command
=====================
This command allows one player to give an item to an NPC. The command triggers a user-defined "give" event on the
target, supplying the object given as a parameter. Give is meant to be used for "show me the key" quests, in which
the character must show a given item to a "guardian" to be allowed to continue.
Syntax:
give <object name>
The Mad Mage has been adapted so it can react to give commands. Note that since the quest related to it is not yet
into the SVN (it will be soon, though :)), the old grumbling mage will currently accept nothing :).
That's all for now folks :).
More information about the crossfire
mailing list