Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Tech Support (https://forums.graalonline.com/forums/forumdisplay.php?f=7)
-   -   Bombs on Gmap (https://forums.graalonline.com/forums/showthread.php?t=134266027)

Stowen 03-18-2012 07:11 PM

Bombs on Gmap
 
How do I get bombs to show up on the gmap? For some reason my bombs aren't showing up on the gmap!:(

fowlplay4 03-18-2012 08:05 PM

post your script. the fix is often putbomb(1, x % 64, y % 64).

Mark Sir Link 03-19-2012 01:40 AM

Quote:

Originally Posted by fowlplay4 (Post 1689138)
post your script. the fix is often putbomb(1, x % 64, y % 64).

I think the behaviors are different on v5 and v6, where one is expecting GMAP x/y and the other expects level x/y

r3ckless 03-19-2012 03:42 PM

This is what I have, I just implemented what you gave me:

NPC Code:
//#CLIENTSIDE
function onWeaponFired()
{
if (player.dir=0){ putbomb(1, x+0.5 % 64, y-1 % 64); }
if (player.dir=1){ putbomb(1, x-1.5 % 64, y+1 % 64); }
if (player.dir=2){ putbomb(1, x+0.5 % 64, y+2.5 % 64); }
if (player.dir=3){ putbomb(1, x+2.5 % 64, y+1 % 64); }
player.bombs - 1;
}


Mark Sir Link 03-19-2012 05:49 PM

you should

A.) check the player has enough bombs before placing it
B.) reference the object to whose x/y you're referring (player.x, player.y);
C.) add else statements between each if so 4 evals aren't made every time.

Tolnaftate2004 03-19-2012 06:24 PM

Quote:

Originally Posted by Mark Sir Link (Post 1689273)
you should

A.) check the player has enough bombs before placing it
B.) reference the object to whose x/y you're referring (player.x, player.y);
C.) add else statements between each if so 4 evals aren't made every time.

D.) player.bombs -= 1;
You may or may --^
not be able to see the bold here.

callimuc 03-19-2012 06:26 PM

Quote:

Originally Posted by r3ckless (Post 1689268)
This is what I have, I just implemented what you gave me:

NPC Code:
//#CLIENTSIDE
function onWeaponFired()
{
if (player.dir=0){ putbomb(1, x+0.5 % 64, y-1 % 64); }
if (player.dir=1){ putbomb(1, x-1.5 % 64, y+1 % 64); }
if (player.dir=2){ putbomb(1, x+0.5 % 64, y+2.5 % 64); }
if (player.dir=3){ putbomb(1, x+2.5 % 64, y+1 % 64); }
player.bombs - 1;
}


IŽd do it like this (also what Mark explained)
PHP Code:

//#CLIENTSIDE
function onWeaponFired() {
  if (
player.bombs 0) {
    if (
player.dir == 0putbomb(1player.0.5 64player.64);
    if (
player.dir == 1putbomb(1player.1.5 64player.64);
    if (
player.dir == 2putbomb(1player.0.5 64player.2.5 64);
    if (
player.dir == 3putbomb(1player.2.5 64player.64);
    
player.bombs -= 1;
  }


but instead of having the check of every single direction of the player, IŽd suggest you to get familiar with vecx() and vecy(). Here is a great explanation made by Tigairius
http://forums.graalonline.com/forums...highlight=vecx

r3ckless 03-19-2012 07:33 PM

yeah i fogot to add player. but I added that right after, and it works good. thank you guys.

I also added the bomb check to make sure player has bombs.

r3ckless 03-19-2012 07:36 PM

And I still can't understand the vecx and vecy for some reason x.x

r3ckless 03-19-2012 07:41 PM

So now I have this and it still doesn't place the bomb on the gmap:

PHP Code:

//#CLIENTSIDE
function onWeaponFired() {
  if (
player.bombs 0) {
    if (
player.dir == 0){ putbomb(1player.0.5 64player.64); }
    if (
player.dir == 1){ putbomb(1player.1.5 64player.64); }
    if (
player.dir == 2){ putbomb(1player.0.5 64player.2.5 64); }
    if (
player.dir == 3){ putbomb(1player.2.5 64player.64); }
    
player.bombs -= 1;
  }



Mark Sir Link 03-19-2012 07:47 PM

idk what version of Graal you're using but like I said there was a weird behavior between v5 and v6 where one expects a level x y, and the other expects a gmap x y

Emera 03-19-2012 07:50 PM

PHP Code:

//#CLIENTSIDE

function onWeaponFired() {
  
player.ani "Grab";
  
temp.bombposx player.vecx(player.dir);
  
temp.bombposy player.vecy(player.dir);
  
  
putbomb(1,temp.bombposx,temp.bombposy);


This works for me on GMAPs and normal levels. The triggeraction doesn't place the bomb perfectly, but I'm sure you can tweak about with it. I'm sure you can add bomb checks and such in by yourself too.

Tricxta 03-19-2012 10:33 PM

Quote:

Originally Posted by r3ckless (Post 1689278)
And I still can't understand the vecx and vecy for some reason x.x

vecx(player.dir),vecy(player.dir) will basically mimc the direction in which your player is standing. Of course it's much more useful then that.

thing of the results from vecx and vecy as points on a cartesian graph


value| vecx | vecy | corresponding direction
0 | 0 | -1 | up
1 | -1 | 0 | left
2 | 0 | 1 | down
3 | 1 | 0 | right

soz I had neat columns and the forums took them away :(

Emera 03-19-2012 10:54 PM

Just for you trix
http://uploads.graalcenter.org/upload/neatcollums.PNG

r3ckless 03-20-2012 05:07 PM

ah thanks guys. :)
yeah i can tweak it to my needs. Thanks Emera


All times are GMT +2. The time now is 06:19 PM.

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