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 01-16-2009, 12:44 AM
[email protected] zeektheman2@hotmail.com is offline
SirZeek
Join Date: May 2008
Posts: 37
zeektheman2@hotmail.com is on a distinguished road
Npc level changing

Is there any way to change the level of a npc to the player level?
Reply With Quote
  #2  
Old 01-16-2009, 12:47 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Could you elaborate a little bit more?
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #3  
Old 01-16-2009, 12:52 AM
[email protected] zeektheman2@hotmail.com is offline
SirZeek
Join Date: May 2008
Posts: 37
zeektheman2@hotmail.com is on a distinguished road
Oh yea sure well i have this class script as an npc inside a level. I when the player touchs him i want him to follow him outside the level to the gmap. Is that possible? also when i have a class npc following somebody on gmap after about 2 to 3 levels it just freeze know why?
Reply With Quote
  #4  
Old 01-16-2009, 12:56 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
You should use a putnpc2, level NPCs can't follow you outside of the level. You could do something like:
PHP Code:
function onCreated() {
  
putnpc2(xy"join CLASS;");

Then it should follow you just fine. Make sure inside of the class you have:
PHP Code:
function onCreated() {
  
canwarp();
  
canwarp2();

__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #5  
Old 01-16-2009, 01:04 AM
[email protected] zeektheman2@hotmail.com is offline
SirZeek
Join Date: May 2008
Posts: 37
zeektheman2@hotmail.com is on a distinguished road
Hmmm..... Its still only following me for about 2 to 3 levels then it stops.
Reply With Quote
  #6  
Old 01-16-2009, 01:14 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by [email protected] View Post
Hmmm..... Its still only following me for about 2 to 3 levels then it stops.
Could you show the script?
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #7  
Old 01-16-2009, 01:16 AM
[email protected] zeektheman2@hotmail.com is offline
SirZeek
Join Date: May 2008
Posts: 37
zeektheman2@hotmail.com is on a distinguished road
PHP Code:
function onTimeOut()
{
 
canwarp();
 
canwarp2();
 
this.attacker "Graal713758";
  
 if ( 
client.task[3] == "halfway" )
 {  
 
hideimg(200);
  if (
thiso.smovement == "walk")
  {
  
chat this.attacker;
  
this.timer 11;
   if (
this.to_check.x in |this.x-3,this.x+3| && this.to_check.y in |this.y-3,this.y+3|)
    {
      
thiso.smovement "idle";
      
setcharani("idle",NULL);
    } 
       
thiso.smovement "walk";
  
chat thiso.smovement;
        
  if ( 
this.timer 10 )
  { 
   
with findplayer this.attacker ) )
  {
   
this.newDir getdirplayer.this.x,  player.this.);
  }
 } 
 
this.to_check findnearestplayer(this.x,this.y);
   
this.dir this.newDir;
    
this.new_x this.vecx(this.dir) * this.mov_speed;
    
this.new_y this.vecy(this.dir) * this.mov_speed;
    
this.count--;
   if (
this.count 0)
    {
      
this.to_add_x this.new_x 1.5 vecx(this.dir);
      
this.to_add_y this.new_y vecy(this.dir);
     if (
onwall(this.to_add_x,this.to_add_y)) 
      {
        
this.dir = (this.dir+2)%4;
        
this.timer 0;
      } else 
     if (
onwater(this.to_add_x,this.to_add_y)) 
      {
        
setcharani("swim",NULL);
      }else
       {
         
setcharani("spawn_weapon9mm-walk","");
         
this.new_x;
         
this.new_y;
       }
    } else
     {
       
this.count int(random(10,40));
     }
  }
 
 }
    
setTimer(0.05);  

Reply With Quote
  #8  
Old 01-16-2009, 01:50 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Well you shouldn't use 0.05 timeout serverside like that, it wears on the server especially with everything you're trying to do. Use move() instead.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #9  
Old 01-16-2009, 01:54 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by Tigairius View Post
Well you shouldn't use 0.05 timeout serverside like that, it wears on the server especially with everything you're trying to do. Use move() instead.
It defaults to .1, I believe.
Reply With Quote
  #10  
Old 01-16-2009, 05:16 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Yes, I think .05 doesn't work at all serverside.

Also, first you're using:


this.attacker = "Graal713758";

And then:

with ( findplayer ( this.attacker ) )

I think you need to use "findplayerbycommunityname()"

Last edited by Pelikano; 01-16-2009 at 06:14 PM..
Reply With Quote
  #11  
Old 01-16-2009, 06:27 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Pelikano View Post
Also, first you're using:


this.attacker = "Graal713758";

And then:

with ( findplayer ( this.attacker ) )

I think you need to use "findplayerbycommunityname()"
No. "GraalXXXXXX" are account names, not community names.
Reply With Quote
  #12  
Old 01-16-2009, 06:27 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
no @ pelikano

you are using the script as an object right? [putnpc2 script, not level]
Reply With Quote
  #13  
Old 01-16-2009, 07:37 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 Crow View Post
No. "GraalXXXXXX" are account names, not community names.
fiundplayerbycommunityname() can find account names aswell It's a function that first looks for account names, then community names.
__________________
Reply With Quote
  #14  
Old 01-16-2009, 08:12 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
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
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by Chompy View Post
fiundplayerbycommunityname() can find account names aswell It's a function that first looks for account names, then community names.
Which makes me wonder why the findPlayer() function didn't get replaced with the code from findPlayerByCommunityName().
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #15  
Old 01-16-2009, 09:39 PM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
Quote:
Originally Posted by xXziroXx View Post
Which makes me wonder why the findPlayer() function didn't get replaced with the code from findPlayerByCommunityName().
because that would have been logical
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 01:34 PM.


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