Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-09-2009, 08:39 PM
GULTHEX GULTHEX is offline
Registered User
Join Date: Jul 2008
Posts: 148
GULTHEX can only hope to improve
Angry i need help with stefans hp sys

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.
Reply With Quote
 


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 07:56 AM.


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