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 06-04-2007, 10:06 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
getx gety?

Hello, I have a movement system going "Serverside" I'm using move() and all is fine. But of course it moves the NPC but not the actual x y coor of the NPC. IS there way so it moves the x y coor?

I found a work around using
PHP Code:
this.+= temp.newx
which the movement can go -5 to 5 in all 4 dir I have thise set to temp.rx
PHP Code:
temp.rx int(randome(-5,5)); 
so to get temp.newx I use
PHP Code:
temp.newx this.temp.rx
but if something blocks the way the NPC stays but when I add the this.x and all it moves the NPC to the location that is block. Any Idea's on how to fix. Can I detect the current x y when the move() is blocked?

-Much Thanks
Mr. Ωmega
__________________
Deep into the Darkness peering...
Reply With Quote
  #2  
Old 06-06-2007, 04:27 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
*bump*
__________________
Deep into the Darkness peering...
Reply With Quote
  #3  
Old 06-06-2007, 08:43 PM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Well first of all, random is spelt wrong.
Reply With Quote
  #4  
Old 06-06-2007, 09:15 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
On Kingdoms we move monsters with move() but check for blocking tiles manually before calling move(). You can use the parameters to let move() stop at walls.
Reply With Quote
  #5  
Old 06-06-2007, 09:47 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
it's spelt fine in the script, Stefan, I do have the block checks in there but I have to have the this.x += temp.newx or else the baddy just keeps moving from the original positions, __-__ just figured the problem i had temp.x instead of temp.newx in the tiletype check haha, thanks guys :P

EDIT : grr... well it doesnt walk if the newx and newy are blocking but if the player walks in front and stops the baddy it still screws up. Here's a part of the script

PHP Code:
function onTimeOut() {
  
temp.rx   int(random(-55));
  
temp.ry   int(random(-55));
  
temp.rs   random(05);
  
temp.rt   random(07);
  
temp.newx this.temp.rx;
  
temp.newy this.temp.ry;

if (
tiletypetemp.newxtemp.newy] != 22 && tiletypetemp.newxtemp.newy] != 11) {
    
move(temp.rxtemp.rytemp.rs16);
    
setcharani"nir_baddy_walk"this.baddy.nickthis.baddy.hpthis.baddy.fullhpthis.baddy.aggressor);
  }

  else 
    
setTimer(temp.rt);

  
sleep(temp.rs);
  
setcharani"nir_baddy_idle"this.baddy.nickthis.baddy.hpthis.baddy.fullhpthis.baddy.aggressor);
 
  
this.+= temp.rx;
  
this.+= temp.ry;

  
setTimer(temp.rt);

__________________
Deep into the Darkness peering...
Reply With Quote
  #6  
Old 06-07-2007, 10:40 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
*smack*
__________________
Deep into the Darkness peering...
Reply With Quote
  #7  
Old 06-09-2007, 08:49 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
*bump*
__________________
Deep into the Darkness peering...
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 07:42 AM.


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