Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   function onTouchThePlayer(){ (https://forums.graalonline.com/forums/showthread.php?t=76745)

theHAWKER 09-12-2007 02:43 AM

function onTouchThePlayer(){
 
When i was making a dart that shoots across the level, when ever you where running into the dart it would hurt you
(using hurt(); )

But when you stood still and the dart hit you it would keep going with nothing triggering in the script!

So is there a way to trigger something when the NPC touches you, like being shot by a bullet??

DustyPorViva 09-12-2007 02:48 AM

No built-in way. Ways of projectiles hurting via playertouchesme is very, very outdated(Stefan used to have the Ice arrows do that in old Graal :P).
Either use projectiles(shoot) and use onActionprojectile(or the other varieties, and I recommend this method) or use a loop of the players and check if the player is in 'touching' the NPC by calculating its distance... or triggeraction.

theHAWKER 09-12-2007 02:52 AM

Quote:

Originally Posted by DustyPorViva (Post 1347246)
No built-in way. Ways of projectiles hurting via playertouchesme is very, very outdated(Stefan used to have the Ice arrows do that in old Graal :P).
Either use projectiles(shoot) and use onActionprojectile(or the other varieties, and I recommend this method) or use a loop of the players and check if the player is in 'touching' the NPC by calculating its distance... or triggeraction.

umkay, how would you use onActionprojectile in a script??

function onWeaponfired(){
shoot(projectile);
}
function onActionProjectile(){
i have no idea;
}

Googi 09-12-2007 03:22 AM

Quote:

Originally Posted by theHAWKER (Post 1347248)
umkay, how would you use onActionprojectile in a script??

First, you have to use setshootparams() before shoot() to send the damage and some way to identify the projectile.

i.e.

setshootparams("hurtfulprojectile", 3);

Then have the following code in a weapon every player carries...

PHP Code:

function onActionProjectile(){
  if (
params[0] = "hurtfulprojectile") {
    
hurt(params[1]);
  }


Plus you'll probably want other checks to make sure the player is in a PK zone and stuff.

coreys 09-12-2007 04:39 AM

wtf ever happened to playertouchsme anyways. That was never made into a function like onPlayerTouchsMe and it makes me sad D:

napo_p2p 09-12-2007 05:11 AM

Quote:

Originally Posted by coreys (Post 1347266)
wtf ever happened to playertouchsme anyways. That was never made into a function like onPlayerTouchsMe and it makes me sad D:

It's still there... I'm pretty sure onPlayerTouchsMe still works...

zokemon 09-13-2007 12:11 AM

I wish projectiles could have scripts and have classes be joined to them. (WHY ARE THEY READ-ONLY SERVERSIDE?!)

I want to be able to make projectiles that can pass through players while still hitting them :(

DustyPorViva 09-13-2007 12:14 AM

Ditto. For something with so much potential like projectiles, I wish there were more options for them.
Allowing them to go through walls while being 'classic' is one, or having them not go through walls while in the air and so on. I agree with joining classes to them... though I dunno if it's possible.

RyDaze 09-13-2007 01:15 AM

Ya that would be awesome!

Twinny 09-13-2007 01:52 AM

I've never ever used shoot() :P: I've always just made my own projectiles using putnpc2 and join() :P

Mostly since all my projectiles can have limited homing abilities and other effects.

zokemon 09-13-2007 05:32 AM

Quote:

Originally Posted by Twinny (Post 1347454)
I've never ever used shoot() :P: I've always just made my own projectiles using putnpc2 and join() :P

Mostly since all my projectiles can have limited homing abilities and other effects.

Using projectiles to do that would save from TONS of lag though.

Twinny 09-13-2007 06:41 AM

Quote:

Originally Posted by zokemon (Post 1347487)
Using projectiles to do that would save from TONS of lag though.

Would it? I thought the major part of shoot() is that it's an inbuilt function and thus more efficient that what we can script ourselves. If you were to make it join a class though, it would have to be interpreted anyways.

zokemon 09-13-2007 11:32 AM

Quote:

Originally Posted by Twinny (Post 1347493)
Would it? I thought the major part of shoot() is that it's an inbuilt function and thus more efficient that what we can script ourselves. If you were to make it join a class though, it would have to be interpreted anyways.

Not really. The class you join it to still wouldn't have to use a timeout nor would it need to check for "hits".

Googi 09-13-2007 09:28 PM

Quote:

Originally Posted by zokemon (Post 1347429)
I want to be able to make projectiles that can pass through players while still hitting them :(

So have the player "re-shoot" the projectile when hit by it?

bscharff 09-15-2007 04:45 AM

I Believe I Left The Projectile Hurt System Weapon In -System/Health or something like that on Graal Legacy...


All times are GMT +2. The time now is 04:38 PM.

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