Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Event Functions (https://forums.graalonline.com/forums/showthread.php?t=81872)

cbk1994 09-17-2008 05:16 AM

Event Functions
 
2 Attachment(s)
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.

Chompy 09-17-2008 03:07 PM

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

cbk1994 09-17-2008 08:00 PM

Quote:

Originally Posted by Chompy (Post 1424189)
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? :(

Chompy 09-17-2008 08:07 PM

Quote:

Originally Posted by cbk1994 (Post 1424239)
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

Loriel 09-17-2008 08:09 PM

Quote:

Originally Posted by Chompy (Post 1424189)
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".

Loriel 09-17-2008 08:10 PM

Quote:

Originally Posted by Chompy (Post 1424241)
I hope you'll add more functions later sometime

Like which
Why

Chompy 09-17-2008 09:42 PM

Quote:

Originally Posted by Loriel (Post 1424243)
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? :p

Quote:

Originally Posted by Loriel (Post 1424242)
This is not how you spell "should have".

Uhm? What do you mean?

cbk1994 09-17-2008 09:52 PM

Quote:

Originally Posted by Chompy (Post 1424273)
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?

Some things are better to leave up to the scripters .. but I guess something like that I could make.
Quote:

Uhm? What do you mean?
"Should of" should be "should have", but it's not that big of a deal.

Chompy 09-17-2008 10:19 PM

Quote:

Originally Posted by cbk1994 (Post 1424274)
"Should of" should be "should have", but it's not that big of a deal.

Ah, thank you for pointing out :)

Samposse 05-25-2010 01:50 PM

Great Scripts, they all works perfectly, good job. :)


All times are GMT +2. The time now is 06:22 PM.

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