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 02-13-2008, 01:47 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
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?
Reply With Quote
  #2  
Old 02-13-2008, 01:57 PM
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
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.
__________________
Reply With Quote
  #3  
Old 02-13-2008, 02:08 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
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.
Reply With Quote
  #4  
Old 02-13-2008, 04:20 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Quote:
Originally Posted by Codein View Post
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...
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #5  
Old 02-13-2008, 05:33 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by coreys View Post
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.
Reply With Quote
  #6  
Old 02-13-2008, 05:38 PM
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
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.
__________________
Do it with a DON!
Reply With Quote
  #7  
Old 02-13-2008, 05:42 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by zokemon View Post
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

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?
Reply With Quote
  #8  
Old 02-13-2008, 08:33 PM
The_Kez The_Kez is offline
N-Pulse Asst. Manager
The_Kez's Avatar
Join Date: Dec 2007
Posts: 106
The_Kez is on a distinguished road
Send a message via MSN to The_Kez
Quote:
Originally Posted by Codein View Post
That'd be fantastic

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.
Reply With Quote
  #9  
Old 02-13-2008, 11:13 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
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
__________________
Reply With Quote
  #10  
Old 02-13-2008, 11:38 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
It's not a continuous beam though? It's a set length beam :/ It's quite short aswell. 9.5 tiles in length.
Reply With Quote
  #11  
Old 02-14-2008, 03:58 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
If you know how to directly edit HP, you could do that, instead of a hurt function.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #12  
Old 02-14-2008, 12:29 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by coreys View Post
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.
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 10:37 PM.


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