Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-15-2009, 05:55 AM
thatdwarf thatdwarf is offline
Former UN Dev Admin
Join Date: Nov 2005
Posts: 42
thatdwarf is on a distinguished road
Movement on gmap

Hey everybody,

I have an NPC who's sole purpose is to move a player on a GMAP from y-coordinate 300 to y-coordinate 50. Straight line, nothing fancy

The problem is when I get to y-coordinate 191 and around 64, the player stops moving

Why is this? And any suggestions on fixing this?

The NPC is a DB NPC, here is the main excerpt:

PHP Code:
//#CLIENTSIDE
function onPlayerTouchsMe() {
  
setani("skilift","");
  
disabledefmovement();
  
onTimeout();
}

function 
onTimeout() {
  
player.dir 0;
  
player.y--;
  
setTimer(0.05);

Obviously there is a check in the actual uploaded script for when the script gets to the destination, I am just posting the main part of the movement. I just need help with the


Thanks in advance
Reply With Quote
  #2  
Old 12-15-2009, 05:58 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
The script will stop being active when the player is 3 (?) levels away. Your best bet is to put it in a weapon and have your level NPCs trigger that weapon clientside.
__________________
Reply With Quote
  #3  
Old 12-15-2009, 06:04 AM
thatdwarf thatdwarf is offline
Former UN Dev Admin
Join Date: Nov 2005
Posts: 42
thatdwarf is on a distinguished road
Wouldnt that method be extremely messy?

Maybe I'm not seeing the correct method for going about doing that, but that sounds very messy
Reply With Quote
  #4  
Old 12-15-2009, 06:07 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 cbk1994 View Post
The script will stop being active when the player is 3 (?) levels away. Your best bet is to put it in a weapon and have your level NPCs trigger that weapon clientside.
You got it right. When you're on a gmap it loads your current level and all adjacent.

So something like this:

[ ][ ][ ]
[ ][p][ ]
[ ][ ][ ]


So if you're on a gmap, all the boxes marked with x are 'out of range', and thus scripts and player data are no longer sent:

[x][ ][ ][ ][x]
[x][ ][p][ ][x]
[x][ ][ ][ ][x]
[x][x][x][x][x]
[x][x][x][x][x]
Reply With Quote
  #5  
Old 12-15-2009, 06:08 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by thatdwarf View Post
Wouldnt that method be extremely messy?

Maybe I'm not seeing the correct method for going about doing that, but that sounds very messy
It's actually cleaner since it keeps all your code in one place and lets you trigger it, if you do it right.

PHP Code:
//#CLIENTSIDE
function onPlayerTouchsMe() {
  (@ 
"-SkiLift").trigger("startLift");

PHP Code:
//#CLIENTSIDE
function onStartLift() {
  
setTimer(1); // etc

__________________
Reply With Quote
  #6  
Old 12-15-2009, 06:12 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
You could probably make a general function and put it in a system NPC, or a class. Most servers will have a WNPC or class dedicated specifically for general functions, like math functions, that can be used between a multitude of NPCs. Add this in a global WNPC or a class that's joined to the player:

PHP Code:
//#CLIENTSIDE
public function moveplayer(dx,dy) {
  
// do movement stuff here

Then if it's a WNPC, you can simply call WeaponName.moveplayer(0,-100); or if it's a player class, player.moveplayer(0,-100);
Reply With Quote
  #7  
Old 12-15-2009, 06:50 AM
thatdwarf thatdwarf is offline
Former UN Dev Admin
Join Date: Nov 2005
Posts: 42
thatdwarf is on a distinguished road
hmm

On that subject, is the move function usable on the player object? I attempted Dusty's method for the moving, but I tried using player.move() and it wouldnt work. Is this a possible movement technique?
Reply With Quote
  #8  
Old 12-15-2009, 06:57 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
Nope, sorry, move doesn't work with players(though I wouldn't object to it!). However, you should always avoid using names of available functions, whether they're intended for use with the object or not.
Reply With Quote
  #9  
Old 12-15-2009, 06:59 AM
thatdwarf thatdwarf is offline
Former UN Dev Admin
Join Date: Nov 2005
Posts: 42
thatdwarf is on a distinguished road
Alright. Thanks Dusty :] Rep for you <3
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 05:22 AM.


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