Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   slippery ice script help (https://forums.graalonline.com/forums/showthread.php?t=82343)

MunkyPuff 10-14-2008 12:46 PM

slippery ice script help
 
Hello,

I'm trying to create a script to make ice, but im having trouble getting started.. :( I'm trying to learn it on my own but I'm wondering if someone could maybe just get me started on the right path. thanks everyone!

~Munkypuff

Deas_Voice 10-14-2008 01:56 PM

Quote:

Originally Posted by MunkyPuff (Post 1432948)
Hello,

I'm trying to create a script to make ice, but im having trouble getting started.. :( I'm trying to learn it on my own but I'm wondering if someone could maybe just get me started on the right path. thanks everyone!

~Munkypuff

Code Gallery is ment to post scripts that others can use, not ask for help.

DarkReaper0 10-14-2008 11:43 PM

Here's a starting point:
PHP Code:

//#CLIENTSIDE
function onCreated() onTimeout();

function 
onTimeout() {
  if (
keydown(0)) {
    
//Up
  
} else if (keydown(1)) {
    
//left
  
} else if (keydown(2)) {
    
//down
  
} else if (keydown(3)) {
    
//right
  
}
  
setTimer(.05);



DustyPorViva 10-15-2008 12:23 AM

An ice-skating script works best in this way: you have two velocities, X and Y. From there, you add to the X and Y velocities depending on the movement of the player. If they're moving left, subtract X velocity, if they're moving right, add to the X velocity. Do the same for up/down and the Y velocity. It's important to allow these velocities to go into the negatives as well. If the player is not moving, move both X and Y velocities toward 0(until they reach 0).

That's about the gist of it. There is also wall-detection and such.

Gambet 10-15-2008 12:56 AM

Quote:

Originally Posted by DarkReaper0 (Post 1433184)
Here's a starting point:
[Script stuff]


Should do:

PHP Code:

function onTimeOut()
{
 for (
04i++)
  {
   if (
keydown(i))
    {
      
//Do Stuff
    
}
  }
  
setTimer(0.05);



DarkReaper0 10-15-2008 02:16 AM

Gambet's code is more efficient, but if you're new to scripting you should stick to the simpler one I provided.

xXziroXx 10-15-2008 02:24 AM

Quote:

Originally Posted by DarkReaper0 (Post 1433255)
Gambet's code is more efficient, but if you're new to scripting you should stick to the simpler one I provided.

No. Might as well teach people the most efficient ways from the start, and we might see an increase of talented scripters.

DarkReaper0 10-15-2008 02:26 AM

Quote:

Originally Posted by xXziroXx (Post 1433257)
No. Might as well teach people the most efficient ways from the start, and we might see an increase of talented scripters.

Assuming he knows what a for loop even is.

xXziroXx 10-15-2008 03:53 AM

Quote:

Originally Posted by DarkReaper0 (Post 1433258)
Assuming he knows what a for loop even is.

If not, now is as good of a time as any to learn.

DustyPorViva 10-15-2008 04:29 AM

Orrrrr... he can look at both scripts and see how one translates to the other, in an easier way of understanding and learning.

Tolnaftate2004 10-15-2008 04:57 AM

The examples posted above do not do exactly the same thing, but if conciseness translated well to efficiency, then
PHP Code:

temp.= {keydown(3)-keydown(1),keydown(2)-keydown(0)} 

gives the proper velocity vector, or
PHP Code:

temp.vectornormalize({keydown(3)-keydown(1),keydown(2)-keydown(0),0}).subarray(0,2

for consistent velocity in all directions.

napo_p2p 10-15-2008 05:33 AM

Quote:

Originally Posted by xXziroXx (Post 1433257)
No. Might as well teach people the most efficient ways from the start, and we might see an increase of talented scripters.

Actually, it's probably important that he sees both ways. That way, he has the opportunity to make the connection between the two.

Kristi 10-16-2008 04:42 AM

Graal ice scripts never made sense to me. You don't gain speed walking across ice in real life

xXziroXx 10-16-2008 02:19 PM

Quote:

Originally Posted by Kristi (Post 1433685)
Graal ice scripts never made sense to me. You don't gain speed walking across ice in real life

Zelda: A Link to the Past started fishy ice scripts, blame them. >_<

Kristi 10-16-2008 02:50 PM

Quote:

Originally Posted by xXziroXx (Post 1433741)
Zelda: A Link to the Past started fishy ice scripts, blame them. >_<

Graal doesnt reflect LTTP scripts, the lttp scripts actually make sense.

xXziroXx 10-16-2008 02:55 PM

Quote:

Originally Posted by Kristi (Post 1433746)
Graal doesnt reflect LTTP scripts, the lttp scripts actually make sense.

Come to think about it, I haven't seen a Graal ice script for years - I can't even remember what's so special about them.

Kristi 10-16-2008 02:59 PM

Quote:

Originally Posted by xXziroXx (Post 1433748)
Come to think about it, I haven't seen a Graal ice script for years - I can't even remember what's so special about them.

They progressively add to the speed by a constant velocity as you hold the arrow down (usually), or some variation of that.

I once programmed ice that made sense (to me), where walking normally has absolute friction. If you start on the ice, it is hard to get your speed up because you're walking on ice. It is also hard to stop on ice (it uses friction equations). If you start on land and step on ice, you start with the walking velocity and slow down as you slide across the ice (more friction).

Friction rules. Exercise in mind...

DarkReaper0 10-18-2008 04:02 PM

Or you could make everyone extremely irritable and just make it so you trip,fall, and slide uncontrollably on your back every few seconds.

At least thats how my ice adventures are :(

MunkyPuff 10-18-2008 11:10 PM

Sorry it took me so long to reply. Thank you all for your help. I did want something like Kristi is describing. I agree that it makes no sense that you would increase speed on ice. (unless you had ice skates) well maybe I'll do both. one with iceskates and one without :D I will let you know when I've completed my script so you guys can tell me if I'm an idiot or not :P BTW I'm a She ;)

thanks again!

Unkownsoldier 10-18-2008 11:31 PM

I hate ice scripts its annoying.

DustyPorViva 10-21-2008 06:25 AM

I was going to post about how LttP did have Link increase speed, but I realize now you're talking about those Graal ice scripts that make the player start flying across the screen(or at least I think that's what you're talking about). I haven't seen one of those in a long time, though.

0:48 in and you'll see how link gains speed gradually(but still fairly fast) when he starts his walk. Ice on LttP was actually dreadful, and one of the experiences I hated. Especially trying to work your way into doorways and the stairs.

Kristi 10-21-2008 07:08 PM

Quote:

Originally Posted by DustyPorViva (Post 1435105)
I was going to post about how LttP did have Link increase speed, but I realize now you're talking about those Graal ice scripts that make the player start flying across the screen(or at least I think that's what you're talking about). I haven't seen one of those in a long time, though.

0:48 in and you'll see how link gains speed gradually(but still fairly fast) when he starts his walk. Ice on LttP was actually dreadful, and one of the experiences I hated. Especially trying to work your way into doorways and the stairs.

That's a misleading way to explain what is happening though. It is his normal rate of acceleration minus the effects of friction added to his current velocity (which doesn't stop unlike a normal walk)

Granted that isn't truly accurate but it does illustrate something more accurate then graal ice

DarkReaper0 10-21-2008 11:41 PM

I still say a script that makes you fall over if you run to fast would be the most accurate.


All times are GMT +2. The time now is 02:32 PM.

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