Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-31-2007, 04:20 PM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
Thumbs down this.wont work...

I am making a agent who walks across the level then i want it to look like another agent walks across when the first is done, so i used this script:

PHP Code:
if (this.63){
this.-= 60;

yet it wont work, anyone want to help me out?
__________________
**FLIP OUT**
Reply With Quote
  #2  
Old 05-31-2007, 04:28 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Well, you need to check it when the npc is moving... Here's how!
HTML Code:
function onMove()
{
  this.x++;
  if (this.x > 63)
  {
    this.x = 0;
  }
  schedulevent(0.05, "Move, "");
}
__________________
Reply With Quote
  #3  
Old 05-31-2007, 04:31 PM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
Quote:
Originally Posted by xAndrewx View Post
Well, you need to check it when the npc is moving... Here's how!
HTML Code:
function onMove()
{
  this.x++;
  if (this.x > 63)
  {
    this.x = 0;
  }
  schedulevent(0.05, "Move, "");
}
he still just walks into the wall
this is my whole script:
PHP Code:
// Graal2002 NPC by Stefan Knorr
if (created) {x+=.5;
  
// Initialize the attributes
  
showcharacter;
  
setcharprop #3,head9.png;
  
setcharprop #C0,white;
  
setcharprop #C1,black;
  
setcharprop #C2,black;
  
setcharprop #C3,black;
  
setcharprop #C4,black;
  
setcharprop #n,Agent;
  
setcharprop #2,no-shield.gif;
  
shieldpower 1;
  
dir 0;
}
if (
playertouchsme) {
message FBI only!;
player.26;
player.41;
player.chat "Busted.";
sleep 1.5;
message ;
}
if (
created || movementfinished) {
setcharani walk,;
radangle random(1*3.14);
dx cos(radangle);
dy = -sin(radangle);
move dx*5,dy*5,.5,4+8+16;
}
if (
this.63){
this.-= 60;
}
function 
onMove()
{
  
this.x++;
  if (
this.63)
  {
    
this.0;
  }
  
schedulevent(0.05"Move""");

__________________
**FLIP OUT**
Reply With Quote
  #4  
Old 05-31-2007, 04:34 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
Haven't tried it, but showcharacter NPCs are about 2 tiles wide and x/y are from the top-left corner. So it's probably 2 tiles further along x than you think.

Try if (this.x > 61){ }
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #5  
Old 05-31-2007, 04:36 PM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
Quote:
Originally Posted by JkWhoSaysNi View Post
Haven't tried it, but showcharacter NPCs are about 2 tiles wide and x/y are from the top-left corner. So it's probably 2 tiles further along x than you think.

Try if (this.x > 61){ }
It sends him back but he stops moving
__________________
**FLIP OUT**
Reply With Quote
  #6  
Old 05-31-2007, 04:38 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
PHP Code:
function onCreated() 

  
this.showcharacter(); 
  
this.headImg "head9.png"
  
temp.colorNames = { {{0}, "white"}, {{1234}, "black"} }; 
  for (
temp.currentTypetemp.colorNames
  { 
    for (
temp.currentIndextemp.currentType[0]) 
    { 
      
this.colors[temp.currentIndex] = temp.currentType[1]; 
    } 
  } 
  
this.nick "Agent"
  
this.shieldImg "no-shield.png"
  
this.bodyImg "body3.png";
  
  
this.ani "walk"
  
this.dir 3;
  
  
this.onMovement();  //Call it 

  
function 
onPlayerTouchsMe() 

  
this.chat "FBI only!"
  
setlevel2(this.level.name2641); 
  
player.chat "Busted"
  
this.removeChat 3


function 
onMovement() 

  if (
playerscount <= 0
  { 
    return 
false
  } 
  if (
this.removeChat 0
  { 
    
this.removeChat -= 0.05
    if (
this.removeChat <= 0
    { 
      
this.chat ""
    } 
  } 
  
this.x++; 
  if (
this.63
  { 
    
this.0
  } 
  
scheduleevent(0.05"Movement"""); 

__________________
Reply With Quote
  #7  
Old 05-31-2007, 04:42 PM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
Quote:
Originally Posted by xAndrewx View Post
PHP Code:
function onCreated()
{
  
this.showcharacter();
  
this.headImg "head9.png";
  
temp.colorNames = { {{0}, "white"}, {1234}, "black"} };
  for (
temp.currentTypetemp.colorNames)
  {
    for (
temp.currentIndextemp.currentType[0])
    {
      
this.colors[temp.currentIndex] = temp.currentType[1];
    }
  }
  
this.nick "Agent";
  
this.shieldimg "no-shield.png";
  
this.ani "walk";

  
this.onMove();  //Call it
}
function 
onPlayerTouchsMe()
{
  
this.chat "FBI only!";
  
setlevel2(this.name2641);
  
player.chat "Busted";
  
this.removeChat 3;
}
function 
onMove()
{
  if (
playerscount <= 0)
  {
    return 
false;
  }
  if (
this.removeChat 0)
  {
    
this.removeChat -= 0.05;
    if (
this.removeChat <= 0)
    {
      
this.chat "";
    }
  }
  
this.x++;
  if (
this.63)
  {
    
this.0;
  }
  
schedulevent(0.05"Move""");

xD nice conversion, but it dosen't work lol
__________________
**FLIP OUT**
Reply With Quote
  #8  
Old 05-31-2007, 04:45 PM
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
I guess redo the move after he's warped to the otherside of the level?
Reply With Quote
  #9  
Old 05-31-2007, 04:48 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Fixed, just missed out a bracket and didn't spell scheduleevent correctly!
__________________
Reply With Quote
  #10  
Old 05-31-2007, 05:38 PM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
What's stopping you people from just using move()? And setting a temp ran for x and keeping him at the same y?
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #11  
Old 05-31-2007, 05:47 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
what?
__________________
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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:08 AM.


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