Event Functions
I made some basic event functions, for use in many different events. I'll explain each one below.
Keep in mind:
all means every player in the level
name is the player by name. This uses my findName method. You can see it
here. It basically allows you to ":kick cbk" to kick cbk1994 or ":kick Chris Vi" to kick me.
For every one of these listed without a code example, you simply need:
PHP Code:
join( "name of class" );
event_kick
This allows you to kick a player from the event. You change the position where they go to in the database NPC. You can say ":kick" and click the player, say ":kick name", or say ":kick all".
event_gather
This allows you to gather a player. It can be used to summon a player from another level (e.g. ":gather cbk") or to gather players in a level (":gather" and click, or ":gather all").
event_sort
This allows you to sort the players in the event into different groups, and possibly warp them to the correct place. The first command is ":sort #". If no number is included, it uses two by default. Default team names are declared in the database NPC. The preferable way to use this is to set up a local list of teams (and where to warp them to). It looks like this:
PHP Code:
join( "event_sort" );
function onCreated()
{
this.localTeams = {
{ "left", "vsp_chris-test.nw", 10, 10 },
{ "right", "vsp_chris-test.nw", 20, 10 },
{ "down", "vsp_chris-test.nw", 15, 20 }
};
}
You can just have the team name in, and it will not warp.
event_warp
This warps all the players in a level (including staff) into a different level. For example, if you want to go from the arena to the lobby, say ":warp". The code looks like this:
PHP Code:
join( "event_warp" );
function onCreated()
{
this.location = { "vsp_chris-test.nw", 50, 60 };
}
event_cleartags
This is pretty self-explanatory. Say ":cleartags" to remove the guild of all players in the level (not including staff).
event_focus
Put this in an NPC at the location you want to focus at. Then, just say ":focus" to toggle focus on/off.
event_heal
This allows you to heal the players in the level. You can use ":heal name", ":heal all", or say ":heal" and click someone. The healing variables can be changed in the database NPC.
event_leave
Add this to a level to add a "leave" command. This basically just sends players to the kick location (changed in the database NPC).
Setting Up the Database NPC
The database NPC must be named "EventSystem". If you want, you can change every instance of this in the scripts and then rename it, but I don't recommend that.
Paste in the code from the attached script. The part you need to change looks like this:
PHP Code:
function onCreated()
{
this.staffGuilds = { // List of guilds which can use the commands
"Events Team",
"Player Relations"
};
this.kickLocation = { "vsp_main.gmap", 30, 30 }; // Location the players is kicked to, or leaves to
this.standardTeams = { // The standard set of teams, I recommend at least 3 standard teams.
{ "Red Team" },
{ "Orange Team" },
{ "Yellow Team" },
{ "Green Team" },
{ "Blue Team" },
{ "Indigo Team" },
{ "Violet Team" },
{ "Black Team" }
};
this.healVars = { "clientr.hp_cur", "clientr.hp_max" }; // current health, maximum health. These can be changed to "hearts", "maxhearts", "clientr.hp", etc.
}
Look at the comments in that script, and it should be explained well enough. If you have questions, please ask me!
I've attached the scripts in an archive, and the database NPC as a text file.