Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Somersaults (dodge) (https://forums.graalonline.com/forums/showthread.php?t=134267633)

Trakan 12-23-2012 11:07 PM

Somersaults (dodge)
 
Hey! I have a little request, i'm really bad with gs2 (better with gs1) and my script is not good:
(No scripters for my project for now :/)

It's a fast-maked script, no worries x)
PHP Code:

if(key == e) {
 if(
playerdir == 3){
setani gh_gani_roulade,;
playerx += 0.1;
(
10times for 1second)
freezeplayer .5;
}
if (
playerdir == 1){
setani gh_gani_roulade,;
playerx -= 0.1;
(
10times for 1second)
freezeplayer .5;
}
if (
playerdir == 0){
setani gh_gani_roulade,;
playery -= 0.1;
(
10times for 1second)
freezeplayer .5;
}
if (
playerdir == 2){
setani gh_gani_roulade,;
playery += 0.1;
(
10times for 1second)
freezeplayer .5;
}


If anyone can re-do it better with gs2 :/
My gani is 0.35 seconds, it's better to have player += 0.2/0.1, 4times?

Trakan 12-24-2012 10:45 AM

I remaked my script but anyone can gs2 it?

PHP Code:

if(weaponfired) {
  if(
playerdir == 3){
    
setani gh_gani_roulade,;
    
playerx += 0.6;
    
sleep .1;
    
playerx += 0.6;
    
sleep .1;
    
playerx += 0.6;
    
sleep .1;
    
playerx += 0.6;
    
freezeplayer .5;
  }
  if (
playerdir == 1){
    
setani gh_gani_roulade,;
    
playerx -= 0.6;
    
sleep .1;
    
playerx -= 0.6;
    
sleep .1;
    
playerx -= 0.6;
    
sleep .1;
    
playerx -= 0.6;
    
freezeplayer .5;
  }
  if (
playerdir == 0){
    
setani gh_gani_roulade,;
    
playery -= 0.6;
    
sleep .1;
    
playery -= 0.6;
    
sleep .1;
    
playery -= 0.6;
    
sleep .1;
    
playery -= 0.6;
    
freezeplayer .5;
  }
  if (
playerdir == 2){
    
setani gh_gani_roulade,;
    
playery += 0.6;
    
sleep .1;
    
playery += 0.6;
    
sleep .1;
    
playery += 0.6;
    
sleep .1;
    
playery += 0.6;
    
freezeplayer .5;
  }



scriptless 12-24-2012 11:08 AM

Quote:

Originally Posted by Trakan (Post 1710414)
I remaked my script but anyone can gs2 it?

PHP Code:

if(weaponfired) {
  if(
playerdir == 3){
    
setani gh_gani_roulade,;
    
playerx += 0.6;
    
sleep .1;
    
playerx += 0.6;
    
sleep .1;
    
playerx += 0.6;
    
sleep .1;
    
playerx += 0.6;
    
freezeplayer .5;
  }
  if (
playerdir == 1){
    
setani gh_gani_roulade,;
    
playerx -= 0.6;
    
sleep .1;
    
playerx -= 0.6;
    
sleep .1;
    
playerx -= 0.6;
    
sleep .1;
    
playerx -= 0.6;
    
freezeplayer .5;
  }
  if (
playerdir == 0){
    
setani gh_gani_roulade,;
    
playery -= 0.6;
    
sleep .1;
    
playery -= 0.6;
    
sleep .1;
    
playery -= 0.6;
    
sleep .1;
    
playery -= 0.6;
    
freezeplayer .5;
  }
  if (
playerdir == 2){
    
setani gh_gani_roulade,;
    
playery += 0.6;
    
sleep .1;
    
playery += 0.6;
    
sleep .1;
    
playery += 0.6;
    
sleep .1;
    
playery += 0.6;
    
freezeplayer .5;
  }



Change
PHP Code:

if (weaponfired) { 

to

PHP Code:

function onWeaponFired() { 

Then change anything with

PHP Code:

playerx
playery
playerdir 

to

PHP Code:

player.x
player
.y
player
.dir 

Then with
PHP Code:

setani
freezeplayer
sleep 

us

PHP Code:

setani()
freezeplayer()
sleep() 

That's pretty much all you gotta do to convert it from GS1 to GS2.

Gunderak 12-24-2012 12:22 PM

First off, welcome?
Secondly, GS1 won't get you far.
When I first started with Graal development I tried learning GS1 (stupidly) from the offline editor.
Try looking at this recent post by scriptless.
Go with GS2.

scriptless 12-24-2012 12:27 PM

Quote:

Originally Posted by Gunderak (Post 1710422)
First off, welcome?
Secondly, GS1 won't get you far.
When I first started with Graal development I tried learning GS1 (stupidly) from the offline editor.
Try looking at this recent post by scriptless.
Go with GS2.

Back in 2002 when I started, all we had was GS1.. It worked, but I do like GS2 far better. I think it has opened new possibilities.

Trakan 12-24-2012 01:31 PM

Quote:

Originally Posted by scriptless (Post 1710417)
Change
PHP Code:

if (weaponfired) { 

to

PHP Code:

function onWeaponFired() { 

Then change anything with

PHP Code:

playerx
playery
playerdir 

to

PHP Code:

player.x
player
.y
player
.dir 

Then with
PHP Code:

setani
freezeplayer
sleep 

us

PHP Code:

setani()
freezeplayer()
sleep() 

That's pretty much all you gotta do to convert it from GS1 to GS2.

Thanks :), but, this
player.x += 0.1;
sleep .1;
player.x += 0.1;
sleep .1;
player.x += 0.1;
sleep .1;
player.x += 0.1;
it's really ugly
Any way to change that?

Quote:

Originally Posted by Gunderak (Post 1710422)
First off, welcome?
Secondly, GS1 won't get you far.
When I first started with Graal development I tried learning GS1 (stupidly) from the offline editor.

First off, i've said "Hey!" just look.
Secondly, i was on GraalReborn because it's free, so it's gs1 only.
Next, i don't have the time now for learn gs2 and that's not my work on my principal work on my project.

And finally, did you have a way to block player from going in blocking tiles, because with this script players can go anywhere they want

Gunderak 12-24-2012 03:17 PM

I think this ends now.
Reborn is frowned upon.
Good day to you.

Trakan 12-24-2012 04:27 PM

Quote:

Originally Posted by Gunderak (Post 1710428)
Reborn is frowned upon.

That's why i stopped and moved to GraalOnline

scriptless 12-24-2012 04:49 PM

PHP Code:

sleep(.1); 

Quote:

Next, i don't have the time now for learn gs2 and that's not my work on my principal work on my project.
Then we have no more desire to help you if your to busy to learn from us.

Trakan 12-24-2012 04:59 PM

Quote:

Originally Posted by scriptless (Post 1710436)
PHP Code:

sleep(.1); 

Then we have no more desire to help you if your to busy to learn from us.

This is not what I meant. I mean, I'm working on my project thoroughly and I think the images and animations are more important before learning to code.

Crow 12-24-2012 05:01 PM

Quote:

Originally Posted by Gunderak (Post 1710428)
Reborn is frowned upon.

I wonder why :noob:

scriptless 12-24-2012 05:07 PM

Quote:

Originally Posted by Trakan (Post 1710437)
This is not what I meant. I mean, I'm working on my project thoroughly and I think the images and animations are more important before learning to code.

Learning the skills you need to succeed at a project more important then the project itself. For if you never learn, you will never succeed.

Trakan 12-24-2012 05:22 PM

Quote:

Originally Posted by scriptless (Post 1710442)
Learning the skills you need to succeed at a project more important then the project itself. For if you never learn, you will never succeed.

I know the basics of scripting, I even do my job.
I just want to do the "base" before scripting. Like First armor, basic animations, first weapon.
After that, I'll take care of developement
You are not there to judge me on my way to work I think?

BboyEatsbacon 12-24-2012 05:29 PM

Quote:

Originally Posted by Trakan (Post 1710424)
Thanks :), but, this
player.x += 0.1;
sleep .1;
player.x += 0.1;
sleep .1;
player.x += 0.1;
sleep .1;
player.x += 0.1;
it's really ugly
Any way to change that?

Use a for() loop to clean up this code. Repeating code is most always a bad thing, especially in one instance after another.

ex:
PHP Code:

for (temp.0temp.4temp.++) {
    
player.+= 0.1;
    
sleep(.1);



Trakan 12-24-2012 05:32 PM

Quote:

Originally Posted by BboyEatsbacon (Post 1710452)
Use a for() loop to clean up this code. Repeating code is most always a bad thing, especially in one instance after another.

Thanks, that's what i need to know :)


All times are GMT +2. The time now is 05:42 PM.

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