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 08-08-2011, 10:21 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
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.
__________________
MEEP!
Reply With Quote
  #2  
Old 08-08-2011, 10:25 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
onwater(x, y)
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #3  
Old 08-08-2011, 10:33 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
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
__________________
MEEP!
Reply With Quote
  #4  
Old 08-09-2011, 01:55 PM
iBeatz iBeatz is offline
Kavan
iBeatz's Avatar
Join Date: Dec 2010
Location: Northern Ireland, UK
Posts: 154
iBeatz will become famous soon enough
Send a message via Yahoo to iBeatz
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.
__________________

Intelligence without ambition is like a bird without wings.


Last edited by iBeatz; 08-09-2011 at 01:57 PM.. Reason: Script error
Reply With Quote
  #5  
Old 08-09-2011, 02:35 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
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.
__________________
Reply With Quote
  #6  
Old 08-09-2011, 06:50 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
Quote:
Originally Posted by cbk1994 View Post
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
__________________
MEEP!
Reply With Quote
  #7  
Old 08-09-2011, 09:05 PM
Unkownsoldier Unkownsoldier is offline
Ignorance has no future
Join Date: Sep 2008
Posts: 1,287
Unkownsoldier is on a distinguished road
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.
__________________
Look beyond the monitor.
Reply With Quote
  #8  
Old 08-09-2011, 10:05 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
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
__________________
MEEP!
Reply With Quote
  #9  
Old 08-09-2011, 10:35 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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.
__________________
Quote:
Reply With Quote
  #10  
Old 08-09-2011, 10:56 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
Quote:
Originally Posted by fowlplay4 View Post
why not just force them off the object
What do you mean?
__________________
MEEP!
Reply With Quote
  #11  
Old 08-09-2011, 11:07 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by callimuc View Post
What do you mean?
I.e: If they're on a horse, take them off a horse when they enter the water.
__________________
Quote:
Reply With Quote
  #12  
Old 08-10-2011, 02:24 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
OHH Ic well now I thought of a Zelda/Atlantis styled thing like drowning when they are on the object
__________________
MEEP!
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 04:40 AM.


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