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 05-16-2008, 11:53 PM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
Player Direction moving to the direction of dropping object

Like in Era, your player's direction moves to the direction of the object that is to be dropped. How would I do this? I've tried these:

PHP Code:
    if(DragItem.player.y)player.dir 0;
    if(
DragItem.player.x)player.dir 1;
    if(
DragItem.player.y)player.dir 2;
    if(
DragItem.player.x)player.dir 3
PHP Code:
player.getdir(DragItem.x,DragItem.y); 
PHP Code:
getdir(DragItem.x,DragItem.y); 
It'd be nice if there was a function like player.dir.pointdirection(obj);
Reply With Quote
  #2  
Old 05-16-2008, 11:58 PM
Robin Robin is offline
The secret of NIMH
Robin's Avatar
Join Date: Apr 2005
Location: Wales, UK
Posts: 515
Robin will become famous soon enough
Send a message via AIM to Robin
there is getdir, it works on dx and dy.
PHP Code:
dx dragitem.player.x;
dy dragitem.player.y;
player.dir getdir(dx,dy); 
if the player is pointing the opposite way, reverse the dragitem and player, can't remember which way it's supposed to go and I'm about to go to bed :P
__________________

Reply With Quote
  #3  
Old 05-17-2008, 12:06 AM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
I tried:

PHP Code:
temp.dx DragItem.player.x;
temp.dy DragItem.player.y;
player.dir getdir(temp.dxtemp.dy); 
It only works when the DragItem is far away from the player.

EDIT: SOLVED!!!

PHP Code:
temp.sx screenx(player.x,player.y);
temp.sy screeny(player.x,player.y);
temp.dx DragItem.temp.sx;
temp.dy DragItem.temp.sy;
player.dir getdir(temp.dxtemp.dy); 
This fixed it.

Last edited by Stryke; 05-17-2008 at 12:16 AM.. Reason: SOLVED
Reply With Quote
  #4  
Old 05-17-2008, 12:08 AM
Dan Dan is offline
Daniel
Join Date: Oct 2007
Posts: 383
Dan is an unknown quantity at this point
Send a message via MSN to Dan
Try this;
PHP Code:
temp.dx worldx(DragItem.x,0) - player.x;
temp.dy worldy(0,DragItem.y) - player.y;
player.dir getdir(temp.dxtemp.dy); 
__________________
Reply With Quote
  #5  
Old 05-17-2008, 12:13 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
If the player is dragging it, couldn't you simply use mousex/y?
Reply With Quote
  #6  
Old 05-17-2008, 12:16 AM
[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, he's wanting to change the players direction depending on where the mouse is
Reply With Quote
  #7  
Old 05-17-2008, 12:16 AM
Dan Dan is offline
Daniel
Join Date: Oct 2007
Posts: 383
Dan is an unknown quantity at this point
Send a message via MSN to Dan
Quote:
Originally Posted by DustyPorViva View Post
If the player is dragging it, couldn't you simply use mousex/y?
Good idea. Depends on if it is detecting the position of the item when clicking (like some item systems make the item icon center at mousex and mousey, and some don't).
__________________
Reply With Quote
  #8  
Old 05-17-2008, 12:20 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 [email protected] View Post
no, he's wanting to change the players direction depending on where the mouse is
Exactly.
Instead of worrying about using a GUI position and translating it to level coordinates, simply use mousex/y.
Reply With Quote
  #9  
Old 05-17-2008, 08:05 AM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
oh silly me, yes you can haha
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 09:23 PM.


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