Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-04-2012, 04:42 PM
clarke119 clarke119 is offline
Registered User
Join Date: May 2010
Posts: 23
clarke119 is on a distinguished road
Chance Event Trouble

Hey guys, Having trouble making my chance event.

On the different boxes ie. 1, 2 , 3, 4, 5, 6, 7, 8 I have this code:

NPC Code:
function onCreated()
{
this.setShape(1, 240, 205);
}
function onPlayerTouchsMe()
{
clientr.box=1;
}



And I'm using this for kick:

NPC Code:
function onPlayerChats()
{
if (player.guild == "Events Team" || player.guild == "Events Admin" || player.queryRight("events")) {
if (player.chat.starts("/kick")) { // chat starts with /kick
temp.num = player.chat.substring(6).trim(); // find the number the ET said

for (temp.pl : players) { // loop through each player
if (pl.client.chance == num) { // it's the number the ET called
pl.setlevel2("lost-osl1.nw",30.5,10.8); // warp that player (note "pl."setLevel2)
}
}
}
}
}



Having lots of trouble, such as on kick it texts everyone on level to kick location etc..

Thanks in advance,
__________________
Reply With Quote
  #2  
Old 02-04-2012, 06:09 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
You're setting clientr.box in the chance box but checking client.chance in the script.
__________________
Quote:
Reply With Quote
  #3  
Old 02-05-2012, 11:58 PM
clarke119 clarke119 is offline
Registered User
Join Date: May 2010
Posts: 23
clarke119 is on a distinguished road
Quote:
Originally Posted by fowlplay4 View Post
You're setting clientr.box in the chance box but checking client.chance in the script.
I've fixed that thanks (silly error), but now the trouble is no matter what box im kicking the person not on event tag is get kicked no matter what box he's in:

For example "/kick1" and he's in 2 hes still getting kicked, I think its because of its kicking who evers not on ettag?
__________________
Reply With Quote
  #4  
Old 02-06-2012, 12:12 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Make sure the player isn't an ET before warping him away.

if (pl.guild != "Events Team") {

You should also add a number check if (num > 0) as well because:

Judging by your (I'm under the impression you didn't write it) script: /kick2 is 0 /kick 2 is 2.

Also please use PHP tags instead of CODE.
__________________
Quote:
Reply With Quote
  #5  
Old 02-06-2012, 12:25 AM
clarke119 clarke119 is offline
Registered User
Join Date: May 2010
Posts: 23
clarke119 is on a distinguished road
Quote:
Originally Posted by fowlplay4 View Post
Make sure the player isn't an ET before warping him away.

if (pl.guild != "Events Team") {

You should also add a number check if (num > 0) as well because:

Judging by your (I'm under the impression you didn't write it) script: /kick2 is 0 /kick 2 is 2.

Also please use PHP tags instead of CODE.
So could you write out your version please? and I put /kick2 because of the substring
__________________
Reply With Quote
  #6  
Old 02-06-2012, 12:35 AM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
I don't see why the box the player is on, should be stored in a player flag.. Can't that value just exist in a level npc or something?

PHP Code:
if (pl.client.chance == num) { 
Should be

PHP Code:
if (pl.clientr.chance == num) { 
Plus FP4's post, should solve your problem. But make sure it doesn't kick EM's either..
Reply With Quote
  #7  
Old 02-06-2012, 12:46 AM
clarke119 clarke119 is offline
Registered User
Join Date: May 2010
Posts: 23
clarke119 is on a distinguished road
I fixed it by end the et tag at kick, seems to work. but thanks guys!
__________________
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 08:43 PM.


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