Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Blocking Water (https://forums.graalonline.com/forums/showthread.php?t=134264143)

callimuc 08-08-2011 10:21 PM

Blocking Water
 
Hey there I just got a quick question.

How can I get a script detecting the water as a wall (like on the horse script) so I canīt swim?
I already took a quick look at the scripthelp (typed in water) but couldnīt really find anything.

xXziroXx 08-08-2011 10:25 PM

onwater(x, y)

callimuc 08-08-2011 10:33 PM

Ik but how can I make it that the player canīt go on it like with a horse? With horses the water is treated like walls. Thats what I want to get that the water in treated like a wall for other "fun" stuff to use

iBeatz 08-09-2011 01:55 PM

You could use a timeout to check if water is ahead of the player by using vecx and vecy:

PHP Code:

if( onWater( (player.x+1) + (vecx(player.dir)*3) ) ||
    
onWater( (player.y+1.5) + (vecy(player.dir)*3) ) ){ 

And then maybe cancelling out the movement with a backwards movement generated by the timeout:

PHP Code:

player.-= vecx(player.dir);
player.-= vecy(player.dir); 

I don't know what the player's walking speed will be, so you might have to find out how much backward movement you'll need to bring the player to a stop.
This is how I would have done it if I didn't have my own custom movement system.

cbk1994 08-09-2011 02:35 PM

I think the only way you'll be able to achieve this and have it look nice is to use a custom movement system. You could do it with blocking NPCs or so, but that would be a huge pain.

callimuc 08-09-2011 06:50 PM

Quote:

Originally Posted by cbk1994 (Post 1662656)
I think the only way you'll be able to achieve this and have it look nice is to use a custom movement system. You could do it with blocking NPCs or so, but that would be a huge pain.

Jea today I also got the idea while thinking what ziro could have mentioned with the onwater() so ill try making it like the onwall() check ;)

Unkownsoldier 08-09-2011 09:05 PM

It would be tedious, but you could just always take a picture of the level. Isolate the water only in an image, make the background transparent. Then just put the image of the water on top of the actual levels water and make it block like a normal image. Yet that's a sort of last resort.

callimuc 08-09-2011 10:05 PM

A solution which will be too much work ;) than Iīd prefer more making the water as blocking tiles in the tileset but thats not what I want ;P

fowlplay4 08-09-2011 10:35 PM

If they go on the water, why not just force them off the object that can't go in the water.

Otherwise your best solution is to develop a custom movement system for it.

callimuc 08-09-2011 10:56 PM

Quote:

Originally Posted by fowlplay4 (Post 1662746)
why not just force them off the object

What do you mean?

fowlplay4 08-09-2011 11:07 PM

Quote:

Originally Posted by callimuc (Post 1662750)
What do you mean?

I.e: If they're on a horse, take them off a horse when they enter the water.

callimuc 08-10-2011 02:24 AM

OHH Ic well now I thought of a Zelda/Atlantis styled thing like drowning when they are on the object;)


All times are GMT +2. The time now is 03:41 PM.

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