Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-19-2011, 04:28 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Something as simple as a Bomb

Well, getting down to the nitty gritty now and I'm trying to completely recreate the bomb. I have run into a few snags and need some input/guidance. So all clientside I can get this to work flawlessly for the current player. But it looks horrible and choppy for other players and other players cant pick up the bomb after the current player has dropped it. So, I've tried interpolation with it and that has fixed the choppiness of it mostly. (except in cases of extreme lag) My issue is the whole throwing and landing part. I can through it serverside and it looks choppy but how could I go about making it smooth for all at the same time. The bomb is basically an NPC using a gani. Should I change this method or what?
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #2  
Old 01-19-2011, 04:30 AM
Knux Knux is offline
WEREDUCK
Knux's Avatar
Join Date: Aug 2007
Posts: 241
Knux will become famous soon enough
I don't think the bomb NPC is just using a gani sir :O
__________________

Supporter of G2K1 revision. Even though it never will be what it was..
Reply With Quote
  #3  
Old 01-19-2011, 04:33 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Quote:
Originally Posted by Knux View Post
I don't think the bomb NPC is just using a gani sir :O
Well theres code behind it. I mean for displaying it, it uses a gani. Gani lasts for five seconds and then thats when I do my custom explosion as well.
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #4  
Old 01-19-2011, 04:39 AM
Knux Knux is offline
WEREDUCK
Knux's Avatar
Join Date: Aug 2007
Posts: 241
Knux will become famous soon enough
Yes but it's setting a gani like pickup or whatever the gani is. The actual bomb itself is placed with placeexplosion, or whatever isn't it? I dunno I haven't scripted since GS1 and don't remember any of it
__________________

Supporter of G2K1 revision. Even though it never will be what it was..
Reply With Quote
  #5  
Old 01-19-2011, 04:44 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
I'm not using putbomb or any of that, I'm doing it from scratch.
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #6  
Old 01-19-2011, 04:57 AM
Knux Knux is offline
WEREDUCK
Knux's Avatar
Join Date: Aug 2007
Posts: 241
Knux will become famous soon enough
Quote:
Originally Posted by MrOmega View Post
I'm not using putbomb or any of that, I'm doing it from scratch.
I understand that. But isn't bomb like predefined or whatever?
__________________

Supporter of G2K1 revision. Even though it never will be what it was..
Reply With Quote
  #7  
Old 01-19-2011, 06:05 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Quote:
Originally Posted by Knux View Post
I understand that. But isn't bomb like predefined or whatever?
Yes but I don't want the predefined one. I'm going for better functionality and customization.

@Lance - how would I read what step that gani is at and how would I make it continue from that step in the shoot, as well as if the bomb needs to explode while in mid air?
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #8  
Old 01-19-2011, 07:12 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Quote:
Originally Posted by MrOmega View Post
@Lance - how would I read what step that gani is at
npc.anistep, if I recall correctly.

Quote:
and how would I make it continue from that step in the shoot,
By passing the step as a shoot parameter (see setshootparams).

Quote:
as well as if the bomb needs to explode while in mid air?
You'd have to see what options are available for accessing projectiles-in-motion. I've never dabbled with that personally so I'm not sure what the limitations are or just how inelegant it might be.
Reply With Quote
  #9  
Old 01-19-2011, 01:12 PM
Knux Knux is offline
WEREDUCK
Knux's Avatar
Join Date: Aug 2007
Posts: 241
Knux will become famous soon enough
Quote:
Originally Posted by MrOmega View Post
Yes but I don't want the predefined one. I'm going for better functionality and customization.

@Lance - how would I read what step that gani is at and how would I make it continue from that step in the shoot, as well as if the bomb needs to explode while in mid air?
Are you going to make a bomb for scratch, or get a walk-thru on here?
__________________

Supporter of G2K1 revision. Even though it never will be what it was..
Reply With Quote
  #10  
Old 01-19-2011, 04:45 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Use a projectile (shoot command) to throw it. Have the projectile handling code place a bomb NPC of your design (with putnpc2) at the destination.
Reply With Quote
  #11  
Old 01-19-2011, 06:45 AM
MrAnonymous_P2P MrAnonymous_P2P is offline
Retired Oldbie
MrAnonymous_P2P's Avatar
Join Date: Oct 2006
Location: Cambodia
Posts: 722
MrAnonymous_P2P is an unknown quantity at this point
I believe if you put the lime in the coconut, then mix it all up?


That might work.
Reply With Quote
  #12  
Old 01-19-2011, 08:07 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
You could POSSIBLY hack a method. Give the bomb projectile a power and zangle based how the time left when thrown. Make a bomb with a short fuse land faster than a bomb with a longer fuse. Then do the Z method yourself(since you'd be giving the bomb a projection based on fuse, and not the actual throw).
Reply With Quote
  #13  
Old 01-19-2011, 05:41 PM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Ok so I got it working on the basics, now I want to make it look better. Smoother rather. Any thoughts of how to achieve this?

Here's what I got.

In my Weapon I have this

PHP Code:
public function Equip()
{

  return;

}

public function 
unEquip()
{

  return;

}

//#CLIENTSIDE

function onCreated()
{

  
this.description "<b><u>Small Bombs</u></b>\nDecent pack of power for a small bomb. Good for blasting enemies or holes in walls.";

}

function 
GraalControl.onKeyDown()
{

  if ( 
clientr.currentCharacter.weapon0] == name && params0] == 68 && client.carry == NULL)
  {
    
    
client.freeze true;
    
player.attr2] = "legends_sbombs-i.png";
    
setani"legends_lay"NULL);
    
sleep0.3);
    
player.attr2] = "";
    
temp.frontX player.dir == 1? ( player.1.5): player.dir == 3? ( player.2.5): ( player.0.5);
    
temp.frontY player.dir == 0? ( player.1.25): player.dir == 2? ( player.2.5): ( player.1.25);
    
triggerServer"gui""-system.core""dropObj"temp.frontXtemp.frontY"small_bombs"1true"Small Bombs");   
    
sleep0.1);
    
client.freeze false;

  }

in -system.core it puts an npc at the specified locations joined to what I have.

In class I have this.

PHP Code:
function onCreated()
{

  
setshape13232);
  
setCharAni"legends_smallBomb"NULL);
  
scheduleEvent5"onDestroy");

}

function 
onDestroy()
{

  if ( 
this.attr2] != "")
    
findPlayerthis.attr2]).client.carry NULL;

  
with putNPC2this.1.5this.1.5""))
    { 
this.join"explosion");}
    
  
this.destroy();

}

function 
onActionPulled()
{

  
temp.pl findPlayerparams0]);
  
temp.pl.client.carry "sObj";
  
temp.pl.client.freeze true;
  
temp.pl.setani"legends_lift"NULL);
  
sleep0.35);
  
temp.pl.client.freeze false;
  
this.attr1] = "carried";
  
this.attr2] = temp.pl.account;
  
setTimer0.3);
  
}

function 
onTimeout()
{

  if ( 
this.attr1] == "carried")
  {
  
    
temp.pl findPlayerthis.attr2]);
    
    
this.temp.pl.0.5;
    
this.temp.pl.1;
  
  }
  
  if ( 
this.landed)
  {
  
    
this.this.nx;
    
this.this.ny;
    
show();
    
this.landed false;
  
  }
  
  
setTimer0.1);

}

function 
onActionPlaced()
{

  
setTimer0);
  
temp.pl findPlayerparams0]);
  
temp.nx temp.pl.dir == 1? ( temp.pl.1.5): temp.pl.dir == 3? ( temp.pl.2.5): ( temp.pl.0.5);
  
temp.ny temp.pl.dir == 0? ( temp.pl.1.25): temp.pl.dir == 2? ( temp.pl.2.5): ( temp.pl.1.25);  
  
temp.pl.client.freeze true;
  
temp.pl.setani"legends_lay"NULL);
  
sleep0.3);
  
temp.pl.client.carry =
  
temp.pl.client.freeze false;
  
this.attr1] = this.attr2] = "";
  
this.temp.nx;
  
this.temp.ny;

}

function 
onActionThrown()
{

  
setTimer0);
  
temp.pl findPlayerparams0]);
  
this.nx temp.pl.dir == 1? ( temp.pl.5.5): temp.pl.dir == 3? ( temp.pl.6.5): ( temp.pl.0.5);
  
this.ny temp.pl.dir == 0? ( temp.pl.5.25): temp.pl.dir == 2? ( temp.pl.6.5): ( temp.pl.1.25);  
  
temp.pl.client.freeze true;
  
temp.pl.setani"legends_grab"NULL);
  
temp.angle getanglevecxtemp.pl.dir), vecytemp.pl.dir));
  
hide();
  
this.attr1] = this.attr2] = "";        
  
temp.pl.client.carry false;
  
setshootparams"Small Bomb"this.nametemp.pl.accounttimevar2);
  
shoottemp.pl.xtemp.pl.ytemp.pl.1temp.angle01"legends_smallBomb"NULL);
  
onTimeout();     
 
}

//#CLIENTSIDE

function onCreated()
{

  
setshape13232);
  
dontBlock();
  
onTimeout();

}

function 
GraalControl.onKeyDown()
{

  if ( 
this.attr1] == "carried")
  {
  
    if ( 
params0] == 68)
      
triggerActionthis.xthis.y"Placed"player.account);

    else if (
params0] == 65)
      
triggerActionthis.xthis.y"Thrown"player.account);

  }
}

function 
onTimeout()
{

  if ( 
this.attr1] == "carried")
  {

    
drawOverPlayer();
    
    if ( 
this.attr2] == player.account)
    {
    
      
this.player.0.5;
      
this.player.1;
  
    }
  }
  
  else
    
this.layer 1;
  
  
setTimer0.05);


Finally in the NPC-Control I have the onActionSProjectile to catch all projectiles.

PHP Code:
function onActionSProjectile()
{

  switch ( 
params2])
  {
  
    case 
"Small Bomb":
    
      
temp.pl findPlayerparams4]);
      
temp.n  findNPCparams3]);
      
temp.pl.client.freeze false;
      
temp.n.landed true;

    break;
  
  }

How could I improve this?
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #14  
Old 01-19-2011, 05:52 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
@ using keycodes instead of keydown(i).
__________________
Quote:
Reply With Quote
  #15  
Old 01-19-2011, 06:05 PM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Quote:
Originally Posted by fowlplay4 View Post
@ using keycodes instead of keydown(i).
Would that send the triggeraction any faster? :/
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
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 11:40 AM.


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