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 01-04-2012, 06:13 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
An alternative to a drag tool.

I couldn't post the PHP code since incapsula kept blocking me >:(
The other day I was mucking around with Callimuc, Crow and Theo on Atlantis and Crow gave me a wonderful idea from using one of his staff tools. He had a mouse warp that could warp other players to a position in a level rather than having a fancy drag tool that, lets face it, just screams "Abuse me!". I decided to code my own since I thought it was a great alternative to a drag tool that could do the same job twice as quick and didn't need all the fancy tweaking to make a smooth drag effect. It seems like a useful tool so I thought I might post it. Criticism is welcome ^_^

Basically, it allows you to warp other players (and yourself) around the level. It doesn't need anything fancy and simply warps them to where you click your mouse. To turn the selection tool on/off hit the SHIFT key. When it's on click on a player to select one and click on the part of the screen you wish to warp them. I then deselects the player after warping since I don't see any reason why you would want to continuously warp a player around the level.

The extra GUI code is a simple little window to show if a player has been selected or not. It's not vital you have this and chat alerts work just as well.

__________________

Last edited by Emera; 01-04-2012 at 06:27 PM.. Reason: Using booleans :3
Reply With Quote
  #2  
Old 01-04-2012, 06:23 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
You should use booleans instead of 0/1. Nicer to read for other else great thing.
__________________
MEEP!
Reply With Quote
  #3  
Old 01-04-2012, 06:38 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
It's good that you've posted an example for others who might be in need to use, but immediate coordinate click summoning was the norm before this whole dragging thing came about.
Reply With Quote
  #4  
Old 01-05-2012, 01:34 AM
Unkownsoldier Unkownsoldier is offline
Ignorance has no future
Join Date: Sep 2008
Posts: 1,287
Unkownsoldier is on a distinguished road
Quote:
Originally Posted by ffcmike View Post
It's good that you've posted an example for others who might be in need to use, but immediate coordinate click summoning was the norm before this whole dragging thing came about.
Agreed. People should always do research when they think of an idea to see if it has been done before. If it has, it just saves you the time.
__________________
Look beyond the monitor.
Reply With Quote
  #5  
Old 01-05-2012, 01:48 AM
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
Quote:
Originally Posted by Unkownsoldier View Post
Agreed. People should always do research when they think of an idea to see if it has been done before. If it has, it just saves you the time.
It´s still better if you script that stuff your own. Only than you can see if you really understand it. Just like in school. Just looking at something wont guarantee you that you really understood it. Trying to do it yourself will.
__________________
MEEP!
Reply With Quote
  #6  
Old 01-05-2012, 02:35 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by callimuc View Post
It´s still better if you script that stuff your own. Only than you can see if you really understand it. Just like in school. Just looking at something wont guarantee you that you really understood it. Trying to do it yourself will.
I definitely agree with you there. Might be a good idea to double check and see if other solutions have been posted before posting yours though
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #7  
Old 01-05-2012, 05:20 AM
Derpp Derpp is offline
You just lost the game.
Derpp's Avatar
Join Date: Mar 2011
Location: Australia (Queensland)
Posts: 7
Derpp is on a distinguished road
This is clientside, so how would it move other players?

Edit: tested, and it only moves others on your screen, not theirs.
Reply With Quote
  #8  
Old 01-05-2012, 06:43 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Derpp View Post
This is clientside, so how would it move other players?

Edit: tested, and it only moves others on your screen, not theirs.
You can use this one.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #9  
Old 01-05-2012, 06:47 AM
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
Quote:
Originally Posted by Tigairius View Post
You can use this one.
Quote:
Originally Posted by Emera View Post
He had a mouse warp that could warp other players to a position in a level rather than having a fancy drag tool that, lets face it, just screams "Abuse me!". I decided to code my own since I thought it was a great alternative to a drag tool that could do the same job twice as quick and didn't need all the fancy tweaking to make a smooth drag effect.
Different kind of dragging
__________________
MEEP!
Reply With Quote
  #10  
Old 01-05-2012, 05:54 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
I have seen that if I change another players x and y with the tool and they move quickly after, they snap back to that position. Would changing the position on the serverside fix that?
PHP Code:
with(findplayer(params)) {
  
player.params;
  
player.params;

__________________
Reply With Quote
  #11  
Old 01-05-2012, 06:11 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
I think so.
__________________
MEEP!
Reply With Quote
  #12  
Old 01-05-2012, 06:32 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Great, did some tweaking and the code does what it's supposed to do now. It's finding the player and changing their x and y on the serverside. Here's the new code.

__________________
Reply With Quote
  #13  
Old 01-07-2012, 09:17 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Updated it a little bit. Added a new feature. If a player is already selected by another player, they can't warp then until the other player deselects them. It's to stop a player double warped really.

Also, what's with all the deletions with a reason?
__________________
Reply With Quote
  #14  
Old 01-07-2012, 10:18 PM
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 Emera View Post
Updated it a little bit. Added a new feature. If a player is already selected by another player, they can't warp then until the other player deselects them. It's to stop a player double warped really.
It's not going to work. You can't access or change another player's client. variables clientside. Also, try to be consistent with using the temp. prefix.

Also, there's no reason to store the account of the player you've selected in a client. var. Store is as an attribute of the weapon (this.). It's also a bit silly to run a loop and then wait for it to get to the selected player before warping them.
__________________
Reply With Quote
  #15  
Old 01-08-2012, 12:50 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by cbk1994 View Post
It's not going to work. You can't access or change another player's client. variables clientside. Also, try to be consistent with using the temp. prefix.

Also, there's no reason to store the account of the player you've selected in a client. var. Store is as an attribute of the weapon (this.). It's also a bit silly to run a loop and then wait for it to get to the selected player before warping them.
I'm going to tweak it up based on what you said.
You said that it won't work? It's been working OK so far? What do you mean :P
__________________
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 12:02 PM.


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