Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Showing blood effects only once (https://forums.graalonline.com/forums/showthread.php?t=79985)

Stryke 06-08-2008 03:22 AM

Showing blood effects only once
 
To check if a player has been hit:

PHP Code:

//#CLIENTSIDE
function onActionProjectile()
{
  
triggerserver("weapon"this.name"BloodFX"player.1.25 random(0,0.5), player.random(0,1.5));


To make blood effects

PHP Code:

function onActionserverside()
{
  if (
params[0] == "BloodFX")
  {
    
temp.putnpc2(params[1], params[2], "");
    
temp.i.join("bloodfx");
  }


If I do this, the blood effects appear as much times as the amount of players there are on the level. How do I get around this to only show once? The blood effect is a GANI.

xXziroXx 06-08-2008 03:43 AM

You'll have to show us the script of the class "bloodfx" as well. :)

zokemon 06-08-2008 03:50 AM

I'm pretty sure onActionProjectile is triggered (when clientside) when ever a projectile hits something, not just the client player. Check up info on projectiles on the wiki as well as check out the tokens in the params variable (while in the onActionProjectile block).

Stryke 06-08-2008 03:51 AM

Sure. :)

PHP Code:

function onCreated()
{
  
drawoverplayer();
  
layer=2;
  
setshape(1,1,1);
  
this.show();
  
sleep(2);
  
this.destroy();
}

//#CLIENTSIDE
function onCreated()
{
  
drawoverplayer();
  
layer=2;
  
this.int int(random(0,3)+1);
  
setcharani("bulletfx",NULL,NULL,NULL,9,5,4,NULL);
  
setshape(1,1,1);


The 3 first parameters are the bullet effects when it hits a wall.
The next 3 are the blood effects.. The 7th param is the sound effect.

All the params = index of sprite/sound.

cbk1994 06-08-2008 03:53 AM

Quote:

Originally Posted by zokemon (Post 1395358)
I'm pretty sure onActionProjectile is triggered (when clientside) when ever a projectile hits something, not just the client player. Check up info on projectiles on the wiki as well as check out the tokens in the params variable (while in the onActionProjectile block).

That's onActionProjectile2() I believe.

DustyPorViva 06-08-2008 03:54 AM

Use showimgs, why putnpcs for blood effects?

cbk1994 06-08-2008 03:55 AM

Quote:

Originally Posted by DustyPorViva (Post 1395361)
Use showimgs, why putnpcs for blood effects?

It's a GANI.

Why not set it as a player attr?

Stryke 06-08-2008 04:05 AM

if(actionprojectile2) is the one that triggers when it hits anything. Not just the player. That's why I am using a testplayer() to see if it the player or not.

@cbk1994: How would that work?

PHP Code:

new GuiShowImgCtrl("BloodFX") {
  
player.x;
  
player.y;
  
width 8;
  
height 8;
  
ani "bloodfx";
  
this.attr[5] = 9;
  
this.attr[6] = 5;
  
this.attr[7] = 4;


You mean something like this will work ?

DustyPorViva 06-08-2008 04:08 AM

Quote:

Originally Posted by cbk1994 (Post 1395362)
It's a GANI.

Why not set it as a player attr?

I guess, after going over it I can tell he's doing something very similar to Era's... I guess that would work. At first I was assuming he was going to be leaving blood on the level.

zokemon 06-08-2008 04:12 AM

Quote:

Originally Posted by Stryke (Post 1395364)
if(actionprojectile2) is the one that triggers when it hits anything. Not just the player. That's why I am using a testplayer() to see if it the player or not.

@cbk1994: How would that work?

PHP Code:

new GuiShowImgCtrl("BloodFX") {
  
player.x;
  
player.y;
  
width 8;
  
height 8;
  
ani "bloodfx";
  
this.attr[5] = 9;
  
this.attr[6] = 5;
  
this.attr[7] = 4;


You mean something like this will work ?

No, you would need an actual TShowImg on the level board.

cbk1994 06-08-2008 04:26 AM

Quote:

Originally Posted by Stryke (Post 1395364)
How would that work?

player.attr[ 13 ] = "mybloodgani.gani";

would probably work.

If not, showani( 1, "mybloodgani", player.x, player.y ); may.

Stryke 06-08-2008 04:46 AM

Woah, didn't know there a showani() command. Thanks i'll try it.
It automatically deletes itself after being played, right?

cbk1994 06-08-2008 04:49 AM

Quote:

Originally Posted by Stryke (Post 1395374)
Woah, didn't know there a showani() command. Thanks i'll try it.
It automatically deletes itself after being played, right?

I don't think so.

Might want to do this:

PHP Code:

function showBlood()
{
  
showani( [...] );
  
scheduleventlength"GaniEnded""" );
}
function 
onGaniEnded()
{
  
hideimg);


EDIT:

Here are the showani params.

showani( index, x, y, direction, animation, params );

So something like

PHP Code:

showani1player.xplayer.y2"mybloodani""" ); 


Stryke 06-08-2008 05:00 AM

The scheduleevent doesn seem to work it keeps playing over and over again...

PHP Code:

if(actionprojectile2)
{
  
temp.pl GetPlayerIndex(#p(0), #p(1)); 
  
if(temp.pl 0)
  {
    
this.int int(random(0,3)+1);
    
showani(1,#p(0),#p(1),2,"bulletfx",1,2,3,NULL,NULL,NULL,"ricochet" @ this.int @ ".wav");
    
scheduleventlength "GaniEnded""" );
  } else {
  }
}
function 
onGaniEnded()
{
  
hideimgs);


NVM IT WAS SPELT WRONG LOL
THANKS MAN +rep osht cant..

cbk1994 06-08-2008 05:07 AM

Why do you use a combination of GS1 and GS2?

function onActionProjectile()

Also, replace 'length' with the time ...


All times are GMT +2. The time now is 04:40 PM.

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