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 10-24-2011, 03:57 PM
iBeatz iBeatz is offline
Kavan
iBeatz's Avatar
Join Date: Dec 2010
Location: Northern Ireland, UK
Posts: 154
iBeatz will become famous soon enough
Send a message via Yahoo to iBeatz
move() blockcheck?

What exactly is this parameter and how is it used?
__________________

Intelligence without ambition is like a bird without wings.

Reply With Quote
  #2  
Old 10-24-2011, 04:32 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
This is something from a project Dusty made once.

PHP Code:
function onCreated() {
  
showcharacter();
  
this.dir = (int(random(0,2))*2)+1;
  
this.attr[1] = "ce_chicken-white.png";
  
setCharani("ce_chicken_idle",null);
  
setTimer(random(.25,2));
}

function 
onTimeout() {
  
temp.dx random(-3,3);
  
temp.dy random(-3,3);
  
temp.dist = (dx^2+dy^2)^.5;
  
temp.checkwall 0;
  for (
temp.i=0;i<dist;i+=.5) {
    
//if (onwall2(this.x+.5+((dx/dist)*.5)+(dx*i),this.y+1+((dy/dist)*.5)+(dy*i),2,2)) {
    
if (onwall2(this.x+1+(dx/dist)+(dx*i),this.y+1+(dy/dist)+(dy*i),1,1) || onwater(this.x+1.5+(dx/dist)+(dx*i),this.y+1.5+(dy/dist)+(dy*i))) {
      
checkwall 1;
      break;
    }
  }
  if (
checkwall == 1) {
    
setTimer(.1);
    return;
  }

  
setCharani("ce_chicken_walk",null);
  if (
dx 0this.dir 3;
  else 
this.dir 1;
  
move(dx,dy,dist/3,8);
}


function 
onMovementfinished() {
  
setCharani("ce_chicken_idle",null);
  
setTimer(random(.1,2));


Semms like there is no parameter for that. Just using onwall2().
__________________
MEEP!
Reply With Quote
  #3  
Old 10-24-2011, 05:12 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
It's built-in wall checking for an object when move is called.

You use it like this:

move(dx, dy, time, 4);

If you want blockcheck and eventwhendone (onMovementFinished) you do:

move(dx, dy, time, 4 + 8);

Personally I have had no pleasant experiences with it at least on the serverside and can't really recommend it then again I haven't used it in ages.
__________________
Quote:
Reply With Quote
  #4  
Old 10-24-2011, 07:34 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
I believe that once it hits a wall, it will set the NPC back to the position it had before the move() call; so it's quite useless.
__________________
Reply With Quote
  #5  
Old 10-24-2011, 08:17 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
Quote:
Originally Posted by callimuc View Post
This is something from a project Dusty made once.

Semms like there is no parameter for that. Just using onwall2().
There is a parameter for it, but it's not very reliable.

My method simply scans for the nearest wall, and makes sure the move() does not exceed that space.
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:46 PM.


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