Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   i need help with stefans hp sys (https://forums.graalonline.com/forums/showthread.php?t=83580)

GULTHEX 01-09-2009 08:39 PM

i need help with stefans hp sys
 
!pissed! !pissed! !pissed! !pissed! !pissed! !pissed! :cry:when i use the sword type weapon it dont do anything so what should i do and heres the codes


weapon
NPC Code:
//#CLIENTSIDE
if (weaponfired){
setani dg_katana_attack,;
freezeplayer 0.25;
triggeraction 0,0,serverattack,;
}
join hpfunctions



hp functions
NPC Code:

function attackplayers() {
pid = playerid;
pindexes = getnearestplayers(this.attackx,this.attacky,player id!=pid);
dist = 0;
for (i=0; i<arraylen(pindexes); i++) {
with (players[pindexes[i]]) {
dx = playerx + 1.5 - this.attackx;
dy = playery + 2 - this.attacky;
dist = (dx*dx + dy*dy)^0.5;
if (dist<=2)
hurtplayer();
}
if (dist>2)
break;
}
}
function hurtplayer() {
newhp = strtofloat(#s(clientr.hp)) - this.attackpower;
if (newhp<=0) {
newhp = 3;
setani dead,;
} else {
setani hurt,;
}
setstring clientr.hp,#v(newhp);




and the action server attack i named the class attack

NPC Code:

if (actionserverattack) {
// A sword-type weapon
// Check for players
this.attackx = playerx + 1.5 + vecx(playerdir)*2;
this.attacky = playery + 2 + vecy(playerdir)*2;
this.attackpower = 1;
attackplayers();
attacknpcs();
}
join hpfunctions;





please tell me why when i hit people with the katana it dont do anything please.

Pelikano 01-10-2009 05:01 PM

I think your triggeraction is wrong and should look somethign like:

"triggeraction player.x + 1.5 + vecx(player.dir)*2,player.y + 2 + vecy(player.dir)*2,serverattack,;"

Codein 01-10-2009 10:50 PM

Quote:

Originally Posted by Pelikano (Post 1455941)
I think your triggeraction is wrong and should look somethign like:

"triggeraction player.x + 1.5 + vecx(player.dir)*2,player.y + 2 + vecy(player.dir)*2,serverattack,;"

Mixing GS2 with GS1 is just as bad as using just GS1 >_>

DustyPorViva 01-10-2009 11:36 PM

Where is he mixing it?

xXziroXx 01-10-2009 11:42 PM

Quote:

Originally Posted by DustyPorViva (Post 1456039)
Where is he mixing it?

triggeraction(player.x + 1.5 + vecx(player.dir)*2,player.y + 2 + vecy(player.dir)*2,"serverattack", "");


See bolded and underlined parts.

DustyPorViva 01-10-2009 11:49 PM

Quote:

Originally Posted by xXziroXx (Post 1456042)
triggeraction(player.x + 1.5 + vecx(player.dir)*2,player.y + 2 + vecy(player.dir)*2,"serverattack", "");


See bolded and underlined parts.

I don't see that in his post?

Crow 01-11-2009 12:25 AM

Quote:

Originally Posted by DustyPorViva (Post 1456045)
I don't see that in his post?

He is using player.x and player.y though. GS1 is playerx and playery.

DustyPorViva 01-11-2009 12:26 AM

Aha, there we go.

[email protected] 01-11-2009 11:40 AM

ok


serverattack- this is in the control -NPC. So, in the Control-NPC put this in

this.join("attack");

As you named your class attack? I advise you re-name the class to something like control_attack just to organize it.

xXziroXx 01-11-2009 02:50 PM

Quote:

Originally Posted by DustyPorViva (Post 1456045)
I don't see that in his post?

Exactly, you don't see it, because it's not there. What I bolded/underlined is supposed to be GS2 since the rest of his command was GS2.

Pelikano 01-11-2009 08:04 PM

Oops.

Well, he was scripting it all in GS1, so I tried to help in GS1 :P

GULTHEX 03-06-2009 01:22 AM

closed

xXziroXx 03-06-2009 01:33 PM

Quote:

Originally Posted by GULTHEX (Post 1471707)
closed

Why did you bump a two months old thread just to point out that it's been dealt with? I'm not even sure that's what you tried to point out...

And threads don't just get closed like that. If someone else have the same issue/question in the future, they should just bump the old thread.

salesman 03-06-2009 08:49 PM

Quote:

Originally Posted by xXziroXx (Post 1471820)
Why did you bump a two months old thread just to point out that it's been dealt with? I'm not even sure that's what you tried to point out...

And threads don't just get closed like that. If someone else have the same issue/question in the future, they should just bump the old thread.

how are you posting in this "closed" thread?!?!


All times are GMT +2. The time now is 09:40 PM.

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