Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Scripting problems (https://forums.graalonline.com/forums/showthread.php?t=26271)

Tin Man 03-25-2002 10:36 AM

Scripting problems
 
Im trying to do some script for a NPC that reduces all damage done to in a pattern, first it does 0.5 then nothing then 0.5, so on and so forth my problem is that it only works for the first part of the script then stops. I was wondering if some one could help my and fix my script so that it would follow that pattern. Id really apreciate it.

i havent scipted in a while so that would explane why its so long.

also when the NPC's activated it automaticly sets the players hearts to 3.

if (test && playerhearts > 3 || playerhearts == 3 && this.l33t = 0) { playerhearts = 3; this.l33t = this.l33t + 1;
}
if (test && playerhearts > 3 && this.l33t = 1) { playerhearts = 2.5; this.l33t = this.l33t + 1;
}
if (test && playerhearts > 3 && this.l33t = 2) { playerhearts = 2.5; this.l33t = this.l33t + 1;
}
if (test && playerhearts > 3 && this.l33t = 3) { playerhearts = 2; this.l33t = this.l33t + 1;
}
if (test && playerhearts > 3 && this.l33t = 4) { playerhearts = 2; this.l33t = this.l33t + 1;
}
if (test && playerhearts > 3 && this.l33t = 5) { playerhearts = 1.5; this.l33t = this.l33t + 1;
}
if (test && playerhearts > 3 && this.l33t = 6) { playerhearts = 1.5; this.l33t = this.l33t + 1;
}
if (test && playerhearts > 3 && this.l33t = 7) { playerhearts = 1; this.l33t = this.l33t + 1;
}
if (test && playerhearts > 3 && this.l33t = 8) { playerhearts = 1; this.l33t = this.l33t + 1;
}
if (test && playerhearts > 3 && this.l33t = 9) { playerhearts = .5; this.l33t = this.l33t + 1;
}
if (test && playerhearts > 3 && this.l33t = 10) { playerhearts = .5; this.l33t = this.l33t + 1;
}
if (test && playerhearts > 3 && this.l33t = 11) { playerhearts = 0; this.l33t = this.l33t + 1;
}
if (test && this.l33t = 12) {unset test; this.l33t = 0;}

Tin Man 03-25-2002 10:45 AM

lol i didnt know i could do that, lol. Hmm Visual Basic and G script are verry simmilar.

Bhala 03-25-2002 10:51 AM

if(test){
for(this.i=0;playerhearts in |0,3|;this.i+2){
playerhearts-=.5;
}
unset test;
}

omg look how simple it can be...

Tin Man 03-25-2002 10:58 AM

this doesnt work either:

if (playerhearts > 3 || playerhearts == 3 && this.l33t = 0) { playerhearts = 3; this.l33t = this.l33t + 1;
}
elseif (playerhearts > 3 && this.l33t = 1) { playerhearts = 2.5; this.l33t = this.l33t + 1;
}
elseif (playerhearts > 3 && this.l33t = 2) { playerhearts = 2.5; this.l33t = this.l33t + 1;
}
elseif (playerhearts > 3 && this.l33t = 3) { playerhearts = 2; this.l33t = this.l33t + 1;
}
elseif (playerhearts > 3 && this.l33t = 4) { playerhearts = 2; this.l33t = this.l33t + 1;
}
elseif (playerhearts > 3 && this.l33t = 5) { playerhearts = 1.5; this.l33t = this.l33t + 1;
}
elseif (playerhearts > 3 && this.l33t = 6) { playerhearts = 1.5; this.l33t = this.l33t + 1;
}
elseif (playerhearts > 3 && this.l33t = 7) { playerhearts = 1; this.l33t = this.l33t + 1;
}
elseif (playerhearts > 3 && this.l33t = 8) { playerhearts = 1; this.l33t = this.l33t + 1;
}
elseif (playerhearts > 3 && this.l33t = 9) { playerhearts = .5; this.l33t = this.l33t + 1;
}
elseif (playerhearts > 3 && this.l33t = 10) { playerhearts = .5; this.l33t = this.l33t + 1;
}
elseif (playerhearts > 3 && this.l33t = 11) { playerhearts = 0; this.l33t = this.l33t + 1;
}
elseif (playerhearts > 3 && this.l33t = 12) {unset test; this.l33t = 0;}
}

Bhala 03-25-2002 10:58 AM

Quote:

Originally posted by Kaimetsu
Yeah, that's another thing. Don't use flags for clientside-only temporary variables!
huh? was that to me? lol

Bhala 03-25-2002 10:59 AM

dude do you see my post or not?

Tin Man 03-25-2002 11:02 AM

Quote:

Originally posted by Bhala
dude do you see my post or not?
lol i just did thanks.

Bhala 03-25-2002 11:02 AM

lol np :D

Tin Man 03-25-2002 11:12 AM

gah i tried using your script and im stuck in a loop of death also by its self it didnt work.

Bhala 03-25-2002 11:18 AM

oops i see why... playerhearts in |.5,3| that should work

nyghtGT 03-25-2002 04:22 PM

ok, this script does a lot of f***** up thing...

one thing:
NPC Code:

NPC Code:

if (playerhearts > 3 || playerhearts == 3 && this.l33t = 0){playerhearts = 3; this.l33t = this.l33t + 1;
}

should be:

if ((playerhearts>3||playerhearts==3)&&this.l33t=0) {
playerhearts=3;
this.l33t+=1;
}




Saga2001 03-25-2002 06:07 PM

Also just a suggestion, I would restrain from using numerical values in your variable names, just not a good idea.

Tin Man 03-25-2002 09:16 PM

Quote:

Originally posted by Bhala
oops i see why... playerhearts in |.5,3| that should work
ok well that didnt work, thanks any way and nyghtGT im trying your suggestion right now.

screen_name 03-25-2002 09:38 PM

NPC Code:

// NPC made by screen_name

if (created) {
this.counter=0;
this.on=1;
timeout=.1;
}

if (timeout&&this.on==1) {
if (this.counter%2==0 && playerhearts>.5) {
playerhearts-=.5;
}
this.counter++;
timeout=.1;
}


mhermher 03-25-2002 10:53 PM

Quote:

Originally posted by nyghtGT
ok, this script does a lot of f***** up thing...

one thing:
NPC Code:

NPC Code:

if (playerhearts > 3 || playerhearts == 3 && this.l33t = 0){playerhearts = 3; this.l33t = this.l33t + 1;
}

should be:

if ((playerhearts>3||playerhearts==3)&&this.l33t=0) {
playerhearts=3;
this.l33t+=1;
}




a more effective way:


NPC Code:


if (playerhearts=>3&& this.l33t = 0) {
playerhearts = 3;
this.l33t+=1;
}



screen_name 03-25-2002 11:18 PM

this.l33t++;

Tin Man 03-26-2002 01:46 AM

umm here let me explane what i wanted better.

for everytime the player gets hurt the player will be delt nothing the first time then 0.5 the next time and it will continue in that patern till the player is dead.

i hope i havent been too anoying in my request and i am very greatfull for evey posting some script here.

mhermher 03-26-2002 01:47 AM

Quote:

Originally posted by Tin Man
umm here let me explane what i wanted better.

for everytime the player gets hurt the player will be delt nothing the first time then 0.5 the next time and it will continue in that patern till the player is dead.

i hope i havent been too anoying in my request and i am very greatfull for evey posting some script here.

lol i remember helping Chrisz with this script.

screen_name 03-26-2002 02:54 AM

NPC Code:

// NPC made by screen_name

if (playerenters && !hasweapon(-HurtSystem)) {
toweapons -HurtSystem;
this.l33t=0;
}

if (playerhurt) {
this.l33t++;
if (this.l33t%2!=0) {
playerhearts-=.5;
}
}



hows that??

haunter 03-26-2002 03:19 AM

Quote:

Originally posted by Tin Man
umm here let me explane what i wanted better.

for everytime the player gets hurt the player will be delt nothing the first time then 0.5 the next time and it will continue in that patern till the player is dead.

i hope i havent been too anoying in my request and i am very greatfull for evey posting some script here.

Can't you just double the player's heart count? :rolleyes:

Tin Man 03-26-2002 06:02 AM

Thank you all so very much each one of you contributed to the end script and im very great full.

screen_name 03-26-2002 08:05 AM

no problem bro

:p


All times are GMT +2. The time now is 06:43 PM.

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