Thread: Event Functions
View Single Post
  #1  
Old 09-17-2008, 05:16 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Event Functions

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"1010 },
                      { 
"right""vsp_chris-test.nw"2010 },
                      { 
"down""vsp_chris-test.nw"1520 }
                    };

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"5060 };

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"3030 }; // 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.
Attached Files
File Type: zip event_scripts.zip (3.2 KB, 436 views)
File Type: txt event_database.txt (3.2 KB, 408 views)
__________________
Reply With Quote