Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-08-2008, 03:22 AM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
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.
Reply With Quote
  #2  
Old 06-08-2008, 03:43 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
You'll have to show us the script of the class "bloodfx" as well.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #3  
Old 06-08-2008, 03:50 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
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).
__________________
Do it with a DON!
Reply With Quote
  #4  
Old 06-08-2008, 03:51 AM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
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.
Reply With Quote
  #5  
Old 06-08-2008, 03:53 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by zokemon View Post
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.
__________________
Reply With Quote
  #6  
Old 06-08-2008, 03:54 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Use showimgs, why putnpcs for blood effects?
Reply With Quote
  #7  
Old 06-08-2008, 03:55 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by DustyPorViva View Post
Use showimgs, why putnpcs for blood effects?
It's a GANI.

Why not set it as a player attr?
__________________
Reply With Quote
  #8  
Old 06-08-2008, 04:05 AM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
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 ?
Reply With Quote
  #9  
Old 06-08-2008, 04:08 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by cbk1994 View Post
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.
Reply With Quote
  #10  
Old 06-08-2008, 04:12 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by Stryke View Post
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.
__________________
Do it with a DON!
Reply With Quote
  #11  
Old 06-08-2008, 04:26 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Stryke View Post
How would that work?
player.attr[ 13 ] = "mybloodgani.gani";

would probably work.

If not, showani( 1, "mybloodgani", player.x, player.y ); may.
__________________
Reply With Quote
  #12  
Old 06-08-2008, 04:46 AM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
Woah, didn't know there a showani() command. Thanks i'll try it.
It automatically deletes itself after being played, right?
Reply With Quote
  #13  
Old 06-08-2008, 04:49 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Stryke View Post
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""" ); 
__________________
Reply With Quote
  #14  
Old 06-08-2008, 05:00 AM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
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..
Reply With Quote
  #15  
Old 06-08-2008, 05:07 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Why do you use a combination of GS1 and GS2?

function onActionProjectile()

Also, replace 'length' with the time ...
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:43 PM.


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