Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Help with actionprojectile (https://forums.graalonline.com/forums/showthread.php?t=50714)

Value 01-30-2004 06:17 AM

Help with actionprojectile
 
(BEFORE YOU READ - I searched the forums already and none explained how to make it work right or none had the problem ive been having) I need help with actionprojectile. I put it in the control-npc and it never works when the projectile hits a player or npc. I did it clientside too and put it in a system npc, but it NEVER works. Here is the part of my script (NOTE: The shoot and setshootparams work perfectly because I tested it with actionprojectile2 and it works)
NPC Code:

if (actionprojectile) {//THIS ONE DOESN'T WORK!
if (strequals(#p(2),altairarrowhit)){
this.ax = strtofloat(#p(0));
this.ay = strtofloat(#p(1));
for (this.p = 0;this.p < playerscount;this.p++) {
hitplayer this.p, 3, this.ax, this.ay;
}
}
}


NPC Code:

if (actionprojectile2) {//THIS ONE DOES! Just hits everyone in the level
if (strequals(#p(2),altairarrowhit)){
this.ax = strtofloat(#p(0));
this.ay = strtofloat(#p(1));
for (this.p = 0;this.p < playerscount;this.p++) {
hitplayer this.p, 3, this.ax, this.ay;
}
}
}



Help if you can.
~Value (Manager of Altair)

Edit: Loriel added [code]-tags.

napo_p2p 01-30-2004 07:10 AM

Re: Help with actionprojectile
 
NPC Code:

if (strequals(#p(2),altairarrowhit)){



should be

NPC Code:

if (strequals(#p(0),altairarrowhit)){



helps?

or you can just go

NPC Code:

if (actionprojectile) {
if (strequals(#p(0),altairarrowhit)) {
if (!nopkzone) {
hurt 1;
}
}
}



that'll do .5 damage. Hope it helps

VeX_RaT_Boy 01-30-2004 06:02 PM

Re: Re: Help with actionprojectile
 
Quote:

Originally posted by napo_p2p
Stuff..
Wrong.

He is doing it in the Control NPC, that then #p(0) is the landing x, and the #p(1) is the landing y.

You should have it in some kind of system weapon and in clientside...THEN it would be #p(0).

ZeLpH_MyStiK 01-30-2004 07:24 PM

Re: Re: Re: Help with actionprojectile
 
Quote:

Originally posted by VeX_RaT_Boy

Wrong.

He is doing it in the Control NPC, that then #p(0) is the landing x, and the #p(1) is the landing y.

You should have it in some kind of system weapon and in clientside...THEN it would be #p(0).

What do you mean "#p(0) is the landing x, and the #p(1) is the landing y."? Those params are set using the command setshootparams. They don't have a designated value to begin with unless you set them.

Shifter 01-30-2004 08:44 PM

Re: Re: Re: Re: Help with actionprojectile
 
Quote:

Originally posted by ZeLpH_MyStiK

What do you mean "#p(0) is the landing x, and the #p(1) is the landing y."? Those params are set using the command setshootparams. They don't have a designated value to begin with unless you set them.

I generally don't use shoot, BUT here's how it should be setting:
#p(0) = x of projectile
#p(1) = y of projectile
#p(2) = first param of projectile
and so on and so fourth. It's like how if (pm) takes #p(1) as the first param (or rcchat, think it's PM) where it's not the first param as #p(0). Just trust us on this one m8 ;) If it's online on a server let me know and I'll come check it out in about 2-3 hours when I get home and before I go to work tonight.
---Shifter

ZeLpH_MyStiK 01-30-2004 09:50 PM

Re: Re: Re: Re: Re: Help with actionprojectile
 
Quote:

Originally posted by Shifter

I generally don't use shoot, BUT here's how it should be setting:
#p(0) = x of projectile
#p(1) = y of projectile
#p(2) = first param of projectile
and so on and so fourth. It's like how if (pm) takes #p(1) as the first param (or rcchat, think it's PM) where it's not the first param as #p(0). Just trust us on this one m8 ;) If it's online on a server let me know and I'll come check it out in about 2-3 hours when I get home and before I go to work tonight.
---Shifter

O, ya learn something new everyday I guess...=)

Value 01-30-2004 10:40 PM

ALSO
 
The script I posted is clientside, not serverside. Serverside would of had the with (players[i]) stuff. Also, I already put //#CLIENTSIDE in the npc but I forgot to post it here. But it's pretty obvious it's not serverside.

BTW, my server is online and the name is Altair (not visible).

~Value (Manager of Altair)

Admins 01-31-2004 02:41 AM

Hmmm I will make a little docu about custom hitpoint system and how to handle projectile impacts in a few hours, need it for Zone and Classic anyway so I can also post it here.

A quick note: on serverside you need to do 'hitobjects', the other commands (hitplayer etc.) don't work

Admins 02-02-2004 03:31 PM

There posted, in a new sticky thread :)

KuJiGX 02-10-2004 02:30 PM

Quote:

Originally posted by Stefan
There posted, in a new sticky thread :)
Here it is:
http://forums.graal2001.com/forums/s...threadid=50809

Medabee5111 02-15-2004 03:32 AM

i'm also having a action w/e problum, only mines diffrent, it works on players (havn't tried online but not gonna et a server anyways) but it's not working on NPCs, please help.

Code:

// NPC made by Medabee5111
if (created) {
toweapons Gun Test;
hide;
}
if (weaponfired) {
freezeplayer 0.2;
players[].sprite = 33;
if(playerdir==0){
setshootparams #w,500;
shoot playerx,playery-1.5,,3.14/2,,0,adv_snowball,;
}
if(playerdir==2){
setshootparams #w,500;
shoot playerx+0.01,playery,,3.14*3/2,,0,adv_snowball,;
}
if(playerdir==1){
setshootparams #w,500;
shoot playerx-0.1,playery-0.3,,3.14,,0,adv_snowball,;
}
if(playerdir==3){
setshootparams #w,500;
shoot playerx+0.1,playery-0.3,,0,,0,adv_snowball,;
}
}
if(actionprojectile){
if(strequals(#p(0),Gun Test)){
lay heart;
}
}

//i made it do lay heart; couse i knew that it would make somthing happen if action projectile worked on the NPC

Riot 02-15-2004 03:34 AM

[list=1][*]Use code tags[*]Read Stefans document, it has a lot shorter way of doing "shoot"[/list=1]


All times are GMT +2. The time now is 01:41 AM.

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