Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-28-2006, 09:24 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Turning no playerkilling off

How can you turn off noplayerkilling in a level on clientside, so it's only for a few players. It's for a spar, but I'm having trouble with making it so only 2 people can enter, and disabling the nopk zone. I know other servers do it, but I can't figure it out.
Basically I need a script to turn off the no pk (without serverwarp)
and an idea for making a script that allows only 2 people in a spar
Reply With Quote
  #2  
Old 07-28-2006, 09:45 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
How about:

PHP Code:
//#CLIENTSIDE
function onCreated() setTimer(.05);

function 
onTimeOut()
{
  if (
player.x in |startxendx| && player.y in |startyendy|) noplayerkilling();
  
setTimer(.05);

Should work. Uhm, replace startx/endx & starty/endy with actually locations though.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #3  
Old 07-28-2006, 09:55 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
That only turns on no pk when you walk out of the spar area. It doesn't turn off no pk when you walk into the spar area though
Reply With Quote
  #4  
Old 07-29-2006, 10:56 AM
Skrobo2 Skrobo2 is offline
In the real world ogod.
Skrobo2's Avatar
Join Date: Dec 2005
Location: Refugio, Texas
Posts: 435
Skrobo2 is on a distinguished road
You shouldn't even use noplayerkilling();. You should use disableweapons(); then enableweapons();. You'll probably want to use disablepause(); and disableselectweapons(); as well. Spars are a pain, so I won't bother to explain more about how you might do the door for the entrance and such.
__________________


Quote:
Originally Posted by Darlene159 View Post
I would rather have dead forums.
Reply With Quote
  #5  
Old 07-30-2006, 07:21 PM
calani calani is offline
Scriptess
calani's Avatar
Join Date: Aug 2003
Location: asmgarden.gmap
Posts: 606
calani is on a distinguished road
Send a message via AIM to calani
hehe spars are fun.
especially custom spars like darkspar, lightspar, etc
__________________
Reply With Quote
  #6  
Old 07-30-2006, 08:58 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
You can't make part of a level a killing zone and the other a non-player killing zone, but, you can do this:


PHP Code:
//#CLIENTSIDE
function onCreated()
{
 
setTimer0.05 );
}

function 
onTimeOut()
{
  if  ( 
player.x in |start[x]range,end[x]range| && player.y in |start[y]range,end[y]range| ) {
   
enableweapons();
  } else {
   
disableweapons();
   
//INSERT LINE HERE TO MAKE YOUR PLAYER HEARTS ALWAYS EQUAL YOUR MAX PLAYER HEARTS. NOT EVERY SERVER USES THE CUSTOM HEART SYSTEM, SO I'LL LEAVE THIS LINE EMPTY FOR YOU TO ADD TO FIT TO YOUR SERVER.
  
}
  
setTimer0.05 );


EDIT to Skyld's post right below mines: I would expect the person to have common sense. On Maloria, I'd do something like

PHP Code:
if (created)
  
setshape 1,32,32;

if (
actionheal) {
  
setstring clientr.hp,#s(clientr.hpmax);
  
set client.updateheart;
}
//#CLIENTSIDE
if ( created )
  
timeout=0.05;

if ( 
timeout ) {
  if ( 
playerx in |startxendx| && playery in |starty,endy| ) {
    unset 
client.disable;
    
enableweapons;
  } else {
    
set client.disable;
    
disableweapons;
   if ( 
strtofloat#s(clientr.hp) ) < strtofloat( #s(clientr.hpmax) ) ) {
    
triggeraction x+0.5,y+0.5,heal,;
    }
  }
  
timeout=0.05;


Last edited by Gambet; 07-30-2006 at 10:10 PM..
Reply With Quote
  #7  
Old 07-30-2006, 10:01 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Gambet
You can't make part of a level a killing zone and the other a non-player killing zone, but, you can do this:
For some reason, resetting the hearts in a loop seems like overkill.
__________________
Skyld
Reply With Quote
  #8  
Old 07-31-2006, 03:18 AM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Quote:
Originally Posted by Gambet
PHP Code:
if (created)
  
setshape 1,32,32;

if (
actionheal) {
  
setstring clientr.hp,#s(clientr.hpmax);
  
set client.updateheart;
}
//#CLIENTSIDE
if ( created )
  
timeout=0.05;

if ( 
timeout ) {
  if ( 
playerx in |startxendx| && playery in |starty,endy| ) {
    unset 
client.disable;
    
enableweapons;
  } else {
    
set client.disable;
    
disableweapons;
   if ( 
strtofloat#s(clientr.hp) ) < strtofloat( #s(clientr.hpmax) ) ) {
    
triggeraction x+0.5,y+0.5,heal,;
    }
  }
  
timeout=0.05;

So you are triggering to the server to heal the player every 0.05 seconds. THATS WHERE MALS LAG COMES FROM :O

Now i wonder where eras comes from.. hmm

Here, just made this in a second - should work:

PHP Code:
function onPlayerTouchsMe() {
  
playersc 0;
  for (
i=0i<players.size(); i++) {
    
with (players[i]) {
      if (
player.x in |2030| && player.y in |2030|) { // You may want to change the position checks
        
playersc++;
      }
    }
  }
  if (
playersc >= 2) {
    
player.chat "There is currently two players in the spar!";
  } else {
    
player.chat "Sure, come on in";
  }

Maybe something like that?
Reply With Quote
  #9  
Old 07-31-2006, 04:59 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by KuJi
So you are triggering to the server to heal the player every 0.05 seconds. THATS WHERE MALS LAG COMES FROM :O

No, it triggers only if you get hurt while outside of the box, can't you read code? You should really read entire code before making such accusations. I would never make a public npc trigger in a loop without any conditions to tell it when to trigger.
Reply With Quote
  #10  
Old 07-31-2006, 12:22 PM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Quote:
Originally Posted by Gambet
No, it triggers only if you get hurt while outside of the box, can't you read code? You should really read entire code before making such accusations. I would never make a public npc trigger in a loop without any conditions to tell it when to trigger.
My bad.. sorry about that. I just looked through your code and I couldn't see the yellow ;(
Reply With Quote
  #11  
Old 07-31-2006, 07:38 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
That thing for the door doesn't work?
Reply With Quote
  #12  
Old 08-01-2006, 04:12 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Gambet
No, it triggers only if you get hurt while outside of the box, can't you read code? You should really read entire code before making such accusations. I would never make a public npc trigger in a loop without any conditions to tell it when to trigger.
I smell abuse.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
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 11:58 PM.


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