Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Lay Items Problem (https://forums.graalonline.com/forums/showthread.php?t=134259564)

qw3rt 06-20-2010 12:09 AM

Lay Items Problem
 
Hi

I would liked to script a simple baddy but i have a problem,i'm sure its simple but i can't find a solution :cry:

PHP Code:

if (timeout && this.mode==4) {
  
random(0,100);
  if (
i<50lay bombslay bombs;
  if (
i>50lay darts

that's a part of the script its about when the baddy die i would like it lays bombs or arrows.

It works, but the problem is it lay 1 bombs icon and when i take it, it gives me 10 bombs.
Me I would like it lay ,instead of 1bombs icons and 10 bombs, 2 bombs icons and 10 bombs.

Thanks, i hope i explained it well.

xAndrewx 06-20-2010 12:20 AM

Quote:

Originally Posted by qw3rt (Post 1583030)
Hi

I would liked to script a simple baddy but i have a problem,i'm sure its simple but i can't find a solution :cry:

PHP Code:

if (timeout && this.mode==4) {
  
random(0,100);
  if (
i<50lay bombslay bombs;
  if (
i>50lay darts

that's a part of the script its about when the baddy die i would like it lays bombs or arrows.

It works, but the problem is it lay 1 bombs icon and when i take it, it gives me 10 bombs.
Me I would like it lay ,instead of 1bombs icons and 10 bombs, 2 bombs icons and 10 bombs.

Thanks, i hope i explained it well.

I hope this helps

HTML Code:

  if (i<50) {
    lay bombs;
    lay bombs;
  }

You can also lay bombs in a certain area, but you can't change the amount you receive

HTML Code:

  lay2 bombs, x, y + 2;
Will lay bombs 2 tiles down from the baddy ^^

(GS2 Converted- will only work online)
HTML Code:

lay("bombs");
lay2("bombs", this.x, this.y + 2);


Switch 06-20-2010 12:27 AM

Quote:

Originally Posted by xAndrewx (Post 1583032)
I hope this helps

HTML Code:

  if (i<50) {
    lay bombs;
    lay bombs;
  }

You can also lay bombs in a certain area, but you can't change the amount you receive

HTML Code:

  lay2 bombs, x, y + 2;
Will lay bombs 2 tiles down from the baddy ^^

(GS2 Converted- will only work online)
HTML Code:

lay("bombs");
lay2("bombs", this.x, this.y + 2);


I think he wants to make it so you pick up 5 bombs instead of 10 bombs.

xAndrewx 06-20-2010 12:31 AM

Quote:

Originally Posted by Switch (Post 1583034)
I think he wants to make it so you pick up 5 bombs instead of 10 bombs.

laybombs produces five bombs.

Switch 06-20-2010 12:45 AM

Quote:

Originally Posted by xAndrewx (Post 1583035)
laybombs produces five bombs.

Oh, I see what happened. :p

qw3rt 06-20-2010 12:50 AM

Quote:

HTML Code:

  lay2 bombs, x, y + 2;
Will lay bombs 2 tiles down from the baddy ^^

(GS2 Converted- will only work online)
HTML Code:

lay("bombs");
lay2("bombs", this.x, this.y + 2);


Yep thanks

i used like this and it works :

PHP Code:

 if (i<50)
    
lay2 bombs,x,y+2;lay2 bombs,x,y

In fact it gaves me 2 bombs icons but it messed cause the secand icons was hidden by the first one, due to the same lay position.

thanks ;)

Riot 06-20-2010 03:57 PM

Quote:

Originally Posted by qw3rt (Post 1583039)
Yep thanks

i used like this and it works :

PHP Code:

 if (i<50)
    
lay2 bombs,x,y+2;lay2 bombs,x,y

In fact it gaves me 2 bombs icons but it messed cause the secand icons was hidden by the first one, due to the same lay position.

thanks ;)

Note that this probably doesn't work like you want.

Your code currently reads like:
PHP Code:

if (50) {
    
lay2 bombs,x,y+2;
}
lay2 bombs,x,y

The second statement, lay2 bombs,x,y;, will always be executed in this situation.
If statements without brackets will only work for the next statement.

What you want is something like:
PHP Code:

if (50) {
  
lay2 bombs,x,y+2;
  
lay2 bombs,x,y;



DustyPorViva 06-20-2010 06:24 PM

Also:

PHP Code:

if (50) {
  
lay2 bombs,x-random(-2,2),y-random(-2,2);
  
lay2 bombs,x-random(-2,2),y-random(-2,2);


Will take care of the problem of everything stacking in the same place.

qw3rt 06-20-2010 07:50 PM

Quote:

Originally Posted by Riot (Post 1583147)
Note that this probably doesn't work like you want.

Your code currently reads like:
PHP Code:

if (50) {
    
lay2 bombs,x,y+2;
}
lay2 bombs,x,y

The second statement, lay2 bombs,x,y;, will always be executed in this situation.
If statements without brackets will only work for the next statement.

What you want is something like:
PHP Code:

if (50) {
  
lay2 bombs,x,y+2;
  
lay2 bombs,x,y;



it worked but yea at one moment there were always the same things laid i forgot to close the if } thanks

Quote:

Originally Posted by DustyPorViva (Post 1583177)
Also:

PHP Code:

if (50) {
  
lay2 bombs,x-random(-2,2),y-random(-2,2);
  
lay2 bombs,x-random(-2,2),y-random(-2,2);


Will take care of the problem of everything stacking in the same place.

that what i did i found it on the commands.pdf cause it was boring to manually enter the position thanks for the help.


All times are GMT +2. The time now is 11:07 PM.

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