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 02-02-2009, 07:47 PM
Unkownsoldier Unkownsoldier is offline
Ignorance has no future
Join Date: Sep 2008
Posts: 1,287
Unkownsoldier is on a distinguished road
Little help.

Alright so what I need added onto this is a script that allows me to take .5 out of a players health in a given range of 1,1..

Heres what I have so far.


//#CLIENTSIDE

//up
if (playerdir=0){
this.x=playerx-10;
this.y=playery-20;
}
//left
if (playerdir=1){
this.x=playerx-10;
this.y=playery-10;
}
//down
if (playerdir=2){
this.x=playerx+0.4;
this.y=playery+10;
}
//right
if (playerdir=3){
this.x=playerx-10;
this.y=playery-10;
}
function onKeyPressed(c, k) {
if (k == "a") {
replaceani("idle", "idle");
replaceani("walk", "walk");
setani("idle", NULL);
}
}

if (weaponfired) {
setani pancho_katana-attack,;
replaceani idle,pancho_katana-idle;
replaceani walk,pancho_katana-walk;
hurtplayer(.5);


}
__________________
Look beyond the monitor.
Reply With Quote
  #2  
Old 02-02-2009, 07:51 PM
Soala Soala is offline
Ideas on Fire
Soala's Avatar
Join Date: Jun 2007
Location: In my head
Posts: 3,208
Soala is a jewel in the roughSoala is a jewel in the rough
so you want your script to actually take out .5 health from a player when you use the katana ? Because actually all it would do would be to hurt the player using the katana =P
Reply With Quote
  #3  
Old 02-02-2009, 07:59 PM
Unkownsoldier Unkownsoldier is offline
Ignorance has no future
Join Date: Sep 2008
Posts: 1,287
Unkownsoldier is on a distinguished road
I would like it to take out damage on another player.
__________________
Look beyond the monitor.
Reply With Quote
  #4  
Old 02-02-2009, 08:35 PM
Schetti Schetti is offline
SC2 Player
Schetti's Avatar
Join Date: Nov 2008
Location: Austria
Posts: 269
Schetti is on a distinguished road
just an idea, but what would be with something like:

if (weaponfired) {this.account=player.account;
setani pancho_katana-attack,;
replaceani idle,pancho_katana-idle;
replaceani walk,pancho_katana-walk;

}
function onPlayerTouchsme() {
if (player.account ==! this.account)
hurtplayer(.5);
}



just an idea, and makes this roll on, I hope
__________________
“Peace cannot be kept by force. It can only be achieved by understanding.” – Albert Einstein
Reply With Quote
  #5  
Old 02-02-2009, 09:07 PM
Unkownsoldier Unkownsoldier is offline
Ignorance has no future
Join Date: Sep 2008
Posts: 1,287
Unkownsoldier is on a distinguished road
Nah soz man that doesnt work, if you can't make it hurt the other person I understand but can you tell me how to make the other person do a gani when they are hit.
__________________
Look beyond the monitor.
Reply With Quote
  #6  
Old 02-02-2009, 09:32 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
This is the katana script:
PHP Code:
//#CLIENTSIDE
function onWeaponFired() {
  
temp.dx player.vecx(player.dir) * 1.5;
  
temp.dy player.vecy(player.dir) * 2;
  
triggeraction(dxdy"AttackPlayer"player.account.5);

Put this in a script that all players have:

PHP Code:
//#CLIENTSIDE
function onActionAttackPlayer(accdamage) {
  if (
acc == player.account) {
    return; 
// this ends the function
  
}
  if (
damage <= 0) {
     return;
  }
  
  
hurt(damage);
  
setAni("HURTGANI"null);

Let me know if you need anything explained.
__________________
Reply With Quote
  #7  
Old 02-02-2009, 09:32 PM
Soala Soala is offline
Ideas on Fire
Soala's Avatar
Join Date: Jun 2007
Location: In my head
Posts: 3,208
Soala is a jewel in the roughSoala is a jewel in the rough
Quote:
Originally Posted by Unkownsoldier View Post
Nah soz man that doesnt work, if you can't make it hurt the other person I understand but can you tell me how to make the other person do a gani when they are hit.
Go in your offline editor, put a simple NPC (a character actually) and give him everything (attack, etc...) then double click it, and study !
Reply With Quote
  #8  
Old 02-02-2009, 10:20 PM
Unkownsoldier Unkownsoldier is offline
Ignorance has no future
Join Date: Sep 2008
Posts: 1,287
Unkownsoldier is on a distinguished road
Still doesnt work but I will try experimenting

//#CLIENTSIDE

//up
if (playerdir=0){
this.x=playerx-10;
this.y=playery-20;
}
//left
if (playerdir=1){
this.x=playerx-10;
this.y=playery-10;
}
//down
if (playerdir=2){
this.x=playerx+0.4;
this.y=playery+10;
}
//right
if (playerdir=3){
this.x=playerx-10;
this.y=playery-10;
}
function onKeyPressed(c, k) {
if (k == "a") {
replaceani("idle", "idle");
replaceani("walk", "walk");
setani("idle", NULL);
}
}

if (weaponfired) {
setani pancho_katana-attack,;
replaceani idle,pancho_katana-idle;
replaceani walk,pancho_katana-walk;

}





function onWeaponFired() {
temp.dx = player.x + vecx(player.dir) * 1.5;
temp.dy = player.y + vecy(player.dir) * 2;
triggeraction(dx, dy, "AttackPlayer", player.account, .5);
}

function onActionAttackPlayer(acc, damage) {
if (acc == player.account) {
return; // this ends the function
}
if (damage <= 0) {
return;
}

hurt(damage);
setAni("HURTGANI", null);
}
__________________
Look beyond the monitor.
Reply With Quote
  #9  
Old 02-03-2009, 12:42 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Look closely at what I posted. There are two scripts there.
__________________
Reply With Quote
  #10  
Old 02-03-2009, 01:05 AM
Programmer Programmer is offline
Coder
Programmer's Avatar
Join Date: Jan 2008
Location: -78.464422, 106.837328
Posts: 449
Programmer has a spectacular aura aboutProgrammer has a spectacular aura about
Send a message via AIM to Programmer Send a message via MSN to Programmer Send a message via Yahoo to Programmer
Quote:
Originally Posted by Unkownsoldier View Post
Still doesnt work but I will try experimenting

PHP Code:
//#CLIENTSIDE

//up
if (playerdir=0){
this.x=playerx-10;
this.y=playery-20;
}
//left
if (playerdir=1){
this.x=playerx-10;
this.y=playery-10;
}
//down
if (playerdir=2){
this.x=playerx+0.4;
this.y=playery+10;
}
//right
if (playerdir=3){
this.x=playerx-10;
this.y=playery-10;
}
function 
onKeyPressed(ck) {
if (
== "a") {
replaceani("idle""idle");
replaceani("walk""walk");
setani("idle"NULL);
}
}

if (
weaponfired) {
setani pancho_katana-attack,;
replaceani idle,pancho_katana-idle;
replaceani walk,pancho_katana-walk;

}





function 
onWeaponFired() {
  
temp.dx player.vecx(player.dir) * 1.5;
  
temp.dy player.vecy(player.dir) * 2;
  
triggeraction(dxdy"AttackPlayer"player.account.5);
}  

function 
onActionAttackPlayer(accdamage) {
  if (
acc == player.account) {
    return; 
// this ends the function
  
}
  if (
damage <= 0) {
     return;
  }
  
  
hurt(damage);
  
setAni("HURTGANI"null);

Can you please encapsulate your code in [php] tags? This makes it easier to read and to understand. Thanks.
__________________
- Iᴀɴ Zɪᴍᴍᴇʀᴍᴀɴ
Reply With Quote
  #11  
Old 02-03-2009, 03:32 AM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
Use '==' when comparing two values for equality.
Use '=' when assigning a value to a variable.

Also, read: http://forums.graalonline.com/forums...ad.php?t=53858
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
Reply With Quote
  #12  
Old 02-03-2009, 06:35 PM
Ronnie Ronnie is offline
Registered User
Join Date: Jun 2008
Location: Nj, USA
Posts: 48
Ronnie is on a distinguished road
Send a message via AIM to Ronnie
Also unknownsoldier , it would be good if you had a specific weapon that all players had that you can add all the clientside effects which weapons do and such on the server your working for if they have one or not. Helps keep everything organized. And chris's script should work fine I just tested it.
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 08:37 PM.


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