Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #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
  #2  
Old 09-17-2008, 03:07 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Seems interesting, did take a fast look and it seems good, but you should of explained us how to make an event with an example =o

I don't like your findname functon/method though ;o
__________________
Reply With Quote
  #3  
Old 09-17-2008, 08:00 PM
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
Quote:
Originally Posted by Chompy View Post
Seems interesting, did take a fast look and it seems good, but you should of explained us how to make an event with an example =o

I don't like your findname functon/method though ;o
It doesn't actually allow you to host an event, just some basic things to use in the event.

What's wrong with the findName?
__________________
Reply With Quote
  #4  
Old 09-17-2008, 08:07 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by cbk1994 View Post
It doesn't actually allow you to host an event, just some basic things to use in the event.
Ah, so kinda like pre-made functions to make making events easier for people.. I see =) I hope you'll add more functions later sometime


Quote:
What's wrong with the findName?
2 loops when they could of been combined =o
__________________
Reply With Quote
  #5  
Old 09-17-2008, 08:10 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by Chompy View Post
I hope you'll add more functions later sometime
Like which
Why
Reply With Quote
  #6  
Old 09-17-2008, 09:42 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Loriel View Post
Like which
Why
I don't know? Objects that can be placed that trigger on touch or objects that trigger when you touch them with a said variable set on the player?

And why? Why not?

Quote:
Originally Posted by Loriel View Post
This is not how you spell "should have".
Uhm? What do you mean?
__________________
Reply With Quote
  #7  
Old 09-17-2008, 08:09 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by Chompy View Post
Seems interesting, did take a fast look and it seems good, but you should of explained us how to make an event with an example =o

I don't like your findname functon/method though ;o
This is not how you spell "should have".
Reply With Quote
  #8  
Old 05-25-2010, 01:50 PM
Samposse Samposse is offline
Chopa Shopa !
Samposse's Avatar
Join Date: Nov 2008
Location: Norway
Posts: 87
Samposse is an unknown quantity at this point
Send a message via AIM to Samposse Send a message via MSN to Samposse
Great Scripts, they all works perfectly, good job.
__________________
Delitto :3

A
SERVER
UNDER
CONSTRUCTION !

feel free to ask me about delitto
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:51 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.