Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   ganicheck&teamhelp (https://forums.graalonline.com/forums/showthread.php?t=83857)

Schetti 01-24-2009 12:34 PM

ganicheck&teamhelp
 
I've got a anyoning problem.
I wanna have a script like this:
if (player.ani == "swim.gani") {hide;}

I've tryed a LOT to fix this but nothing worked,
someone can help me?


I've also got a problem with making a team, like
if (playertouchsme) {player.guild == "Blue Team"}

ive got NO idea so I just wrote this

someone can help?

Codein 01-24-2009 01:32 PM

Quote:

Originally Posted by Schetti (Post 1459559)
I've got a anyoning problem.
I wanna have a script like this:
if (player.ani == "swim.gani") {hide;}

I've tryed a LOT to fix this but nothing worked,
someone can help me?


I've also got a problem with making a team, like
if (playertouchsme) {player.guild == "Blue Team"}

ive got NO idea so I just wrote this

someone can help?

Firstly, you don't include the .gani suffix.

Secondly, you're mixing GS1 with GS2. A big no no.

Thirdly, I think setting player.guild is serverside only, in my experience. Plus, == is a comparison operator. You probably want to do player.guild = "Blue Team"

I could help you better if you detailed your exact problem and posted the full code.

Schetti 01-24-2009 02:12 PM

where I mixed GS1 and 2?
player.guild "Blue Team" NO :(
I could help you better if you detailed your exact problem and posted the full code.
thats all I got... I never got teached by someone how to write those LOOONG scripts
I actually didnt get teached by anyone

Codein 01-24-2009 02:17 PM

Quote:

Originally Posted by Schetti (Post 1459586)
where I mixed GS1 and 2?
player.guild "Blue Team" NO :(
I could help you better if you detailed your exact problem and posted the full code.
thats all I got... I never got teached by someone how to write those LOOONG scripts
I actually didnt get teached by anyone

Yes. if (playertouchsme) is a GS1 event. The GS2 equivilent would be function onPlayerTouchsMe()

cyan3 01-24-2009 05:23 PM

Quote:

Originally Posted by Schetti (Post 1459586)
where I mixed GS1 and 2?
player.guild "Blue Team" NO :(

This is how it would work attached to an NPC.

PHP Code:

// NPC made by Felix Lionheart
if (created) {
  
showcharacter;
  
setcharprop #3,khead12.png;
  
setcharprop #n,Dude;
  
setcharprop #8,kmabody106.png;
  
setcharprop #P4,bshield23.png;
  
setcharprop #P(1),khairs33.png;
  
setcharprop #P(3),bsword28.png;
  
setcharprop #P(5),klegs33.png;
  
setcharprop #P(6),kmarms117.png;
  
setcharprop #P7,gk_cloak7.gif;
  
dir 2;
  
setcharani human2_sword_idle,;
  
ap 100;

function 
onPlayerTouchsMe() {
  
player.guild "Blue Team";
 }


Quote:

Originally Posted by Schetti (Post 1459586)
thats all I got... I never got teached by someone how to write those LOOONG scripts
I actually didnt get teached by anyone

I myself didn't get taught scripting by anyone. I researched the graal bible and other scripts to find the functions ect.

Tigairius 01-24-2009 06:19 PM

Quote:

Originally Posted by cyan3 (Post 1459609)
This is how it would work attached to an NPC.

PHP Code:

// NPC made by Felix Lionheart
if (created) {
  
showcharacter;
  
setcharprop #3,khead12.png;
  
setcharprop #n,Dude;
  
setcharprop #8,kmabody106.png;
  
setcharprop #P4,bshield23.png;
  
setcharprop #P(1),khairs33.png;
  
setcharprop #P(3),bsword28.png;
  
setcharprop #P(5),klegs33.png;
  
setcharprop #P(6),kmarms117.png;
  
setcharprop #P7,gk_cloak7.gif;
  
dir 2;
  
setcharani human2_sword_idle,;
  
ap 100;

function 
onPlayerTouchsMe() {
  
player.guild "Blue Team";
 }




I myself didn't get taught scripting by anyone. I researched the graal bible and other scripts to find the functions ect.

Don't put functions inside of other functions, even if you are mixing GS1 with GS2 it's bad practice.

PHP Code:

// NPC made by Felix Lionheart
if (created) {
  
showcharacter;
  
setcharprop #3,khead12.png;
  
setcharprop #n,Dude;
  
setcharprop #8,kmabody106.png;
  
setcharprop #P4,bshield23.png;
  
setcharprop #P(1),khairs33.png;
  
setcharprop #P(3),bsword28.png;
  
setcharprop #P(5),klegs33.png;
  
setcharprop #P(6),kmarms117.png;
  
setcharprop #P7,gk_cloak7.gif;
  
dir 2;
  
setcharani human2_sword_idle,;
  
ap 100;
}

function 
onPlayerTouchsMe() {
  
player.guild "Blue Team";



cyan3 01-24-2009 06:53 PM

Quote:

Originally Posted by Tigairius (Post 1459632)
Don't put functions inside of other functions, even if you are mixing GS1 with GS2 it's bad practice.

Oh, I didn't notice that they were mixed.

Schetti 01-24-2009 06:57 PM

COOL! ^^^thanks, now ill try to make all my scripts like this.
nows just the other problem with water
but THANKS ANYWAY u helped me a lot

xXziroXx 01-24-2009 07:12 PM

PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
setImg("block.png");
  
setTimer(.05);
}

function 
onTimeOut()
{
  if (
player.ani == "swim"hide;
  
  if (
visiblesetTimer(.05);


:confused:

Schetti 01-24-2009 07:41 PM

Huy!
Thanks!

Schetti 01-24-2009 08:22 PM

umm...
a last question
is there a list where I can find many
function on...
commands listed?

xXziroXx 01-24-2009 08:40 PM

Quote:

Originally Posted by Schetti (Post 1459667)
umm...
a last question
is there a list where I can find many
function on...
commands listed?

You can just check functions from your GraalEditor in GS1 and convert them to GS2 yourself.

if (playerenters) { ... } > function onPlayerEnters() { ... }
if (timeout) { ... } > function onTimeOut() { ... }
if (created) { ... } > function onCreated() { ... }

Etcetera.

Schetti 01-24-2009 08:48 PM

if (carriesvase) { ... } > function onCarriesVase?
if (carriessign) { ... } > function onCarriessign?
?

Codein 01-24-2009 08:49 PM

Quote:

Originally Posted by Schetti (Post 1459683)
if (carriesvase) { ... } > function onCarriesVase?
if (carriessign) { ... } > function onCarriessign?
?

They're flags and not events, I believe, so it's perfectly fine to use if (carriessign). I'm not sure though.

Schetti 01-24-2009 08:52 PM

kk :)
thanks

Schetti 01-24-2009 09:11 PM

//#CLIENTSIDE
function onCreated()
{
setImg("block.png");
setTimer(.05);
}

function onTimeOut()
{
if (player.ani == "swim") hide;

if (visible) setTimer(.05);
}



lol, now its broken

xXziroXx 01-24-2009 10:24 PM

Define broken.

Schetti 01-24-2009 10:31 PM

not working anymore
as I added this script into a NPC and touched water, he hided
I dont know what I did, but as I tryed again, nothing

Deas_Voice 01-25-2009 01:05 AM

Quote:

Originally Posted by Chompy (Post 1459733)
The flag visible isn't true, so it won't carry on with the timeout.

PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
setImg("block.png");
  
setTimer(.05);
}

function 
onTimeOut()
{
  if (
player.ani == "swim") {
    
hide();
  } else 
show();
  if (
visiblesetTimer(.05);


use else ^^

Schetti 01-25-2009 08:16 AM

YAA
thanks!

xXziroXx 01-25-2009 03:23 PM

Quote:

Originally Posted by Deas_Voice (Post 1459741)
PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
setImg("block.png");
  
setTimer(.05);
}

function 
onTimeOut()
{
  if (
player.ani == "swim") {
    
hide();
  } else 
show();
  if (
visiblesetTimer(.05);


use else ^^

It makes no sense to check if visible equals true in your script.

Deas_Voice 01-25-2009 04:14 PM

Quote:

Originally Posted by xXziroXx (Post 1459865)
It makes no sense to check if visible equals true in your script.

yah i know, i just added else show();
btw it's your script ;)

xXziroXx 01-25-2009 05:34 PM

Quote:

Originally Posted by Deas_Voice (Post 1459870)
yah i know, i just added else show();
btw it's your script ;)

No it's not, the second you added that else show() it became YOUR script, since I would never script something that poorly. I don't think you were/are even aware of that else show() will never be triggered since if (visible) setTimer(.05) prevents that check to ever be triggered after it hides.

Schetti 01-25-2009 05:38 PM

that hide/show doesnt matter
I am going to change it into setlevel2 ...
its planned for potrace.

Chompy 01-25-2009 09:26 PM

Quote:

Originally Posted by Schetti (Post 1459888)
that hide/show doesnt matter
I am going to change it into setlevel2 ...
its planned for potrace.

setlevel2() won't work clientside.


All times are GMT +2. The time now is 06:37 AM.

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