Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   An alternative to a drag tool. (https://forums.graalonline.com/forums/showthread.php?t=134265507)

Emera 01-04-2012 06:13 PM

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.


callimuc 01-04-2012 06:23 PM

You should use booleans instead of 0/1. Nicer to read for other ;) else great thing.

ffcmike 01-04-2012 06:38 PM

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.

Unkownsoldier 01-05-2012 01:34 AM

Quote:

Originally Posted by ffcmike (Post 1680713)
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.

callimuc 01-05-2012 01:48 AM

Quote:

Originally Posted by Unkownsoldier (Post 1680761)
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.

Tigairius 01-05-2012 02:35 AM

Quote:

Originally Posted by callimuc (Post 1680766)
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 :)

Derpp 01-05-2012 05:20 AM

This is clientside, so how would it move other players?

Edit: tested, and it only moves others on your screen, not theirs.

Tigairius 01-05-2012 06:43 AM

Quote:

Originally Posted by Derpp (Post 1680796)
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.

callimuc 01-05-2012 06:47 AM

Quote:

Originally Posted by Tigairius (Post 1680804)
You can use this one.

Quote:

Originally Posted by Emera (Post 1680700)
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 ^^

Emera 01-05-2012 05:54 PM

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;



callimuc 01-05-2012 06:11 PM

I think so.

Emera 01-05-2012 06:32 PM

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.


Emera 01-07-2012 09:17 PM

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?

cbk1994 01-07-2012 10:18 PM

Quote:

Originally Posted by Emera (Post 1681168)
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.

Emera 01-08-2012 12:50 PM

Quote:

Originally Posted by cbk1994 (Post 1681171)
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


All times are GMT +2. The time now is 06:53 PM.

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