Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Hitobjects (https://forums.graalonline.com/forums/showthread.php?t=78694)

Codein 02-13-2008 01:47 PM

Hitobjects
 
I'm currently trying to script a laser beam, in the style of Shoop Da Whoop.

However, hitobjects only hits the player directly in front of me, rather than along the line of reference (the showpoly). I've tried fiddling with the range and the number of times it calls hitobjects() (9.5/8), to no avail.

PHP Code:

//#CLIENTSIDE
function onWeaponFired() {
  
//setani("kirble-dama-shoopdawhoop", NULL);
  
  //sleep(3);

  
for (9.5/4=< 9.5+= (9.5/8)) {
    
    
temp.posi_x player.1.5 vecx(player.dir) * i;
    
temp.posi_y player.vecy(player.dir) * i;
    
    
showpoly(1234, {
                    
player.1.5 vecx(player.dir),
                    
player.vecy(player.dir),
                    
temp.posi_x,
                    
temp.posi_y
                    
}
             );
             
    
hitobjects(0.5temp.posi_xtemp.posi_y);
  }


Does anybody have any ideas on how I'd fix this?

cbk1994 02-13-2008 01:57 PM

PLEASE don't use hitobjects -- remnant from GS1 for compatibility.

I would do something like this:

PHP Code:

function boomDaLaser()
{
  for ( 
temp.players )
  {
    if ( 
temp.a.x in player.xplayer.vecxplayer.dir ) * 10 | && temp.a.y in player.yplayer.vecyplayer.dir ) * 10 | )
    {
      
temp.BOOMLOL.addtemp.a.account );
    }
   
triggerserver"gui"name"PIMPINLOL"temp.BOOMLOL );
  }


Obviously that isn't perfected, but it would be easy to adjust the x & y's so it works well.

EDIT:
As an alternative to triggering the server, you could just send a triggeraction at their location. Would probably be better idea, you'd have to tinker with it. For npcs, do the same thing and just do like temp.BOOMSHAKALAKA[0].trigger( "PWNED", player.account ); or something.

Codein 02-13-2008 02:08 PM

I was working from the basis that I have bare minimum NC access on UN. I'd do something like that. Infact, in any other way, I'd use triggeraction but tbh, I haven't got the access to said "System" NPCs. I doubt Malinko would ever give me such privileges.

coreys 02-13-2008 04:20 PM

Quote:

Originally Posted by Codein (Post 1374872)
I was working from the basis that I have bare minimum NC access on UN. I'd do something like that. Infact, in any other way, I'd use triggeraction but tbh, I haven't got the access to said "System" NPCs. I doubt Malinko would ever give me such privileges.

This can be done all in one script...

Codein 02-13-2008 05:33 PM

Quote:

Originally Posted by coreys (Post 1374902)
This can be done all in one script...

As in everyone has the weapon then? This is an event prize or whatever. I need something in the clientside actions weapon, like so:

PHP Code:

function onActionLaser(params) {
  if (
params[0] = "shoop"hurt(1);


I'd rather contain it all in one weapon, due to my restrictions.

zokemon 02-13-2008 05:38 PM

Yeah, I've always wanted a triggeraction2() function that has an array of cords rather then an x and a y. This array would be the "points" on the shape-area that you want to trigger.

Codein 02-13-2008 05:42 PM

Quote:

Originally Posted by zokemon (Post 1374910)
Yeah, I've always wanted a triggeraction2() function that has an array of cords rather then an x and a y. This array would be the "points" on the shape-area that you want to trigger.

That'd be fantastic :D

Also, does anyone have any idea on how I'd make this laser beam do some damage on a long range whilst containing it in one script?

The_Kez 02-13-2008 08:33 PM

Quote:

Originally Posted by Codein (Post 1374911)
That'd be fantastic :D

Also, does anyone have any idea on how I'd make this laser beam do some damage on a long range whilst containing it in one script?

If UN has any sort of damage dealing trigger on it's clientside in the mainsystem already, you could ask for the name of it and use the one that's already built in; you shouldn't necessarily need high level access for something like that.

For organization's sake when I script something like this that requires triggerclients I use the system scripts. It can be done all in one NPC (i.e hitobjects() as you suggested above) but as far as I can tell it's just not as practical.

Chompy 02-13-2008 11:13 PM

Lol @ above posts, anyways.. You could make it a shoot() tho, and make the gani that will be fired using particles, and then set lifetime to some high value and "continueafterdestroy" to true (So it will fade the effect out when hitting a player/wall instead of just disappearing). Then ask someone to put your "onActionProjectile()" code somewhere so other players can be triggered through that shoot() projectile..

just a thought tho

Codein 02-13-2008 11:38 PM

It's not a continuous beam though? It's a set length beam :/ It's quite short aswell. 9.5 tiles in length.

coreys 02-14-2008 03:58 AM

If you know how to directly edit HP, you could do that, instead of a hurt function.

Codein 02-14-2008 12:29 PM

Quote:

Originally Posted by coreys (Post 1374995)
If you know how to directly edit HP, you could do that, instead of a hurt function.

I know how to. It's fixed now. Thanks for all the help.

I ended up using triggeraction anyway.


All times are GMT +2. The time now is 02:49 AM.

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