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 08-27-2007, 06:59 AM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
grab

Whats the function for grabbing the npc?

ive tryed making my own but its in-acurate x.x
__________________
**FLIP OUT**
Reply With Quote
  #2  
Old 08-27-2007, 07:03 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
Umm, when the NPC is grabbed?
I don't think there is one.
Reply With Quote
  #3  
Old 08-27-2007, 07:29 AM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
Quote:
Originally Posted by DustyPorViva View Post
Umm, when the NPC is grabbed?
I don't think there is one.
i could have swarn...

then how might u go about doing that?
__________________
**FLIP OUT**
Reply With Quote
  #4  
Old 08-27-2007, 07:33 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
There is onActionpushed/pulled, but no grabbed.
You do so by simply performing a triggeraction on keydown(6).
PHP Code:
function onKeypressed() {
  if (
keydown(6)) triggeraction(player.x+1.5+vecx(player.dir)*2,player.y+2.5+vecy(player.dir)*2,"grabbed",parameters...);

Then, in the NPC, you do something like:
PHP Code:
function onActiongrabbed() {
this.chat="Oh no, some pervert is grabbing me!";

Reply With Quote
  #5  
Old 08-27-2007, 07:40 AM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
Quote:
Originally Posted by DustyPorViva View Post
There is onActionpushed/pulled, but no grabbed.
You do so by simply performing a triggeraction on keydown(6).
PHP Code:
function onKeypressed() {
  if (
keydown(6)) triggeraction(player.x+1.5+vecx(player.dir)*2,player.y+2.5+vecy(player.dir)*2,"grabbed",parameters...);

Then, in the NPC, you do something like:
PHP Code:
function onActiongrabbed() {
this.chat="Oh no, some pervert is grabbing me!";

:O thank you D
__________________
**FLIP OUT**
Reply With Quote
  #6  
Old 08-27-2007, 06:35 PM
ToNy_W ToNy_W is offline
Registered User
Join Date: Aug 2003
Location: Quebec
Posts: 130
ToNy_W is on a distinguished road
Send a message via AIM to ToNy_W
If you keep your finger on the key for a second it'll start spamming the action though o.O
I've always wondered how bad it can be to spam triggeraction like that, i know it can be done on some servers since they use the onKeyPressed event, but wouldn't it eventualy start lagging if 5 players decided to grab a wall at the same time for a couple minutes?
Reply With Quote
  #7  
Old 08-27-2007, 07:28 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
Quote:
Originally Posted by ToNy_W View Post
If you keep your finger on the key for a second it'll start spamming the action though o.O
I've always wondered how bad it can be to spam triggeraction like that, i know it can be done on some servers since they use the onKeyPressed event, but wouldn't it eventualy start lagging if 5 players decided to grab a wall at the same time for a couple minutes?
Depends..

If the 5 players grabbed some fancy objects that did all crap like loading files, requestiing urls and **** it could lag if there was enough players..

But there is always lag, you just don't notice it
__________________
Reply With Quote
  #8  
Old 08-27-2007, 09:26 PM
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
Well that's easy to stop:
PHP Code:
function onKeypressed() {
  if (
keydown(6))  {
    if (
temp.keydown==false) {
      
triggeraction(player.x+1.5+vecx(player.dir)*2,player.y+2.5+vecy(player.dir)*2,"grabbed",parameters...);
      
temp.keydown=true;
    }
  } else 
temp.keydown=false;

Reply With Quote
  #9  
Old 08-27-2007, 09:49 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
Quote:
Originally Posted by DustyPorViva View Post
Well that's easy to stop:
PHP Code:
function onKeypressed() {
  if (
keydown(6))  {
    if (
temp.keydown==false) {
      
triggeraction(player.x+1.5+vecx(player.dir)*2,player.y+2.5+vecy(player.dir)*2,"grabbed",parameters...);
      
temp.keydown=true;
    }
  } else 
temp.keydown=false;

That wouldn't be needed, since that event woulød only be triggered when the player presses a key
(PS: this. instead of temp.)
__________________
Reply With Quote
  #10  
Old 08-27-2007, 10:11 PM
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
Well, the problem is onKeypressed will repeat while the button is held down(much like holding a key down like thissssssssss), so it won't only be called once. That script makes it so it will only work when the key is first pressed, and won't work until it's released.
Reply With Quote
  #11  
Old 08-27-2007, 10:25 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
Quote:
Originally Posted by DustyPorViva View Post
Well, the problem is onKeypressed will repeat while the button is held down(much like holding a key down like thissssssssss), so it won't only be called once. That script makes it so it will only work when the key is first pressed, and won't work until it's released.
hmm, I see what you mean, but now I see that they should be this.
as if when you hold down the key, it will trigger the event on new, and on new etc.. all the time, thus in clearing the temp. variables
__________________
Reply With Quote
  #12  
Old 08-27-2007, 10:29 PM
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
Ya, that'll need to be changed to this. instead of temp.
Reply With Quote
  #13  
Old 08-28-2007, 12:22 AM
ToNy_W ToNy_W is offline
Registered User
Join Date: Aug 2003
Location: Quebec
Posts: 130
ToNy_W is on a distinguished road
Send a message via AIM to ToNy_W
the easiest solution is still to add the grab detection inside your custom movement system's timeout >=o!
I never liked working with the onKeypressed event for graal... Doesn't really make sense to me that the event is triggered over and over again as long as the key is held down x-x
Reply With Quote
  #14  
Old 08-28-2007, 12:26 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
Well first, that requires them to have a custom movement, this assumes they don't.
Second, Graal has no control over the repeated sending of onKeypressed. This is something with keyboards, as long as the key is held down, it'll repeatedly send the key bring pressed. Graal simply grabs that information, it can't stop it from repeating the key.
Reply With Quote
  #15  
Old 08-28-2007, 10:57 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 DustyPorViva View Post
Well first, that requires them to have a custom movement, this assumes they don't.
Second, Graal has no control over the repeated sending of onKeypressed. This is something with keyboards, as long as the key is held down, it'll repeatedly send the key bring pressed. Graal simply grabs that information, it can't stop it from repeating the key.
It can detect this through when the key is held and when not held though. But this was made like so such that it worked like a word processing program (hold a letter down). It certainly has many uses and I'm glad it's there.
__________________
Do it with a DON!
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 12:40 PM.


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