Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Bombs and Bows (https://forums.graalonline.com/forums/showthread.php?t=134263223)

mrnothersan 05-14-2011 08:49 PM

Bombs and Bows
 
Can anybody tell me how to add bombs and arrows weapons to my playerworld please? Like the default weapons on Classic iPhone

mrnothersan 05-14-2011 09:38 PM

.....?

fowlplay4 05-14-2011 11:59 PM

You script them.

As *Bow and/or *Bomb, and add them using addweapon to player.

Important Functions:
shootarrow(dir);
putbomb(power, x, y);

Search the forums they're probably out there already.

Tricxta 05-15-2011 12:00 AM

arent there problems with the gmap and default bows and arrows though?

fowlplay4 05-15-2011 12:02 AM

Quote:

Originally Posted by Tricxta (Post 1649747)
arent there problems with the gmap and default bows and arrows though?

On V5, V6 is fine though.

I posted them before here:
http://forums.graalonline.com/forums...36&postcount=3

MattKan 05-15-2011 01:01 AM

I think you can just add yourself Bombs and Bow...

Soala 05-15-2011 01:45 AM

Quote:

Originally Posted by MattKan (Post 1649757)
I think you can just add yourself Bombs and Bow...

You can edit your attributes, but you still need to script the weapon to use them.

cbk1994 05-15-2011 01:50 AM

Quote:

Originally Posted by Soala (Post 1649763)
You can edit your attributes, but you still need to script the weapon to use them.

I could be wrong but I think if you add yourself Bow and Bomb the default ones will work. I would rescript them anyway.

Soala 05-15-2011 02:01 AM

Quote:

Originally Posted by cbk1994 (Post 1649766)
I could be wrong but I think if you add yourself Bow and Bomb the default ones will work. I would rescript them anyway.

How do they work if the wNPC is not on the server? Are default bombs and bow used from a seperate file, like in the level editor?

cbk1994 05-15-2011 02:07 AM

Quote:

Originally Posted by Soala (Post 1649767)
How do they work if the wNPC is not on the server? Are default bombs and bow used from a seperate file, like in the level editor?

Pretty sure it's just something special in the client that makes those work. I could, of course, be wrong.

Admins 05-15-2011 02:42 AM

The default weapons are implemented with built-in scripts, if you want to write a custom one then you need to use a different weapon name.
I'm not sure if we have already posted the default scripts, but they are quite simple, here the bomb and bow:
PHP Code:

//#CLIENTSIDE
function onWeaponFired() {
  if (
player.bombs<=0)
    return;
  if (
player.dir==0putbomb(1,player.x+0.5,player.y-1);
  if (
player.dir==1putbomb(1,player.x-1.5,player.y+1);
  if (
player.dir==2putbomb(1,player.x+0.5,player.y+2.5);
  if (
player.dir==3putbomb(1,player.x+2.5,player.y+1);
  
player.bombs--;


PHP Code:

///#CLIENTSIDE
function onWeaponFired() {
  if (
player.darts<=0)
    return;
  
freezeplayer(0.3);
  
setani("shoot","wbow1.png");
  
setTimer(0.25);
}
function 
onTimeout() {
  
shootarrow(player.dir);
  
player.darts--;



mrnothersan 05-19-2011 05:53 PM

what would be the NPC code to add bombs to a player... as in if somebody said "10 bombs" it would add 10 bombs to the player?

mrnothersan 05-19-2011 06:34 PM

does nobody know or does it not exist x_x

Tigairius 05-19-2011 06:35 PM

PHP Code:

function onPlayerChats() {
  if (
player.chat == "10 bombs") {
    
player.bombs += 10;
  }


Would only work in a level. You need to try to look around yourself and figure things out before asking the forums though. :)

mrnothersan 05-19-2011 06:43 PM

Quote:

Originally Posted by Tigairius (Post 1650591)
You need to try to look around yourself and figure things out before asking the forums though. :)

i know i know :p

where would i put the PHP code...


All times are GMT +2. The time now is 11:51 AM.

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