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 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
  #2  
Old 01-10-2009, 05:01 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
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,;"
Reply With Quote
  #3  
Old 01-10-2009, 10:50 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by Pelikano View Post
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 >_>
Reply With Quote
  #4  
Old 01-10-2009, 11:36 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
Where is he mixing it?
Reply With Quote
  #5  
Old 01-10-2009, 11:42 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by DustyPorViva View Post
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.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #6  
Old 01-10-2009, 11:49 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
Quote:
Originally Posted by xXziroXx View Post
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?
Reply With Quote
  #7  
Old 01-11-2009, 12:25 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by DustyPorViva View Post
I don't see that in his post?
He is using player.x and player.y though. GS1 is playerx and playery.
Reply With Quote
  #8  
Old 01-11-2009, 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
Aha, there we go.
Reply With Quote
  #9  
Old 01-11-2009, 11:40 AM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
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.
Reply With Quote
  #10  
Old 01-11-2009, 02:50 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by DustyPorViva View Post
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.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #11  
Old 01-11-2009, 08:04 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Oops.

Well, he was scripting it all in GS1, so I tried to help in GS1 :P
Reply With Quote
  #12  
Old 03-06-2009, 01:22 AM
GULTHEX GULTHEX is offline
Registered User
Join Date: Jul 2008
Posts: 148
GULTHEX can only hope to improve
closed
Reply With Quote
  #13  
Old 03-06-2009, 01:33 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by GULTHEX View Post
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.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #14  
Old 03-06-2009, 08:49 PM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
Quote:
Originally Posted by xXziroXx View Post
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?!?!
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 01:26 PM.


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