Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Someone help me!! (https://forums.graalonline.com/forums/showthread.php?t=13583)

LinksReturn 10-02-2001 06:09 AM

Someone help me!!
 
How do i make the npcs variable increase by one each time it gets hit by the HAMMER?? Please help me

btedji 10-02-2001 06:12 AM

i think you would have to add scripting to the hammer

ownerofbabylon 10-02-2001 06:17 AM

he has a point

Xaviar 10-02-2001 06:22 AM

Triggeraction :D , course, I would use testnpc too to make it a little less laggy...

LinksReturn 10-02-2001 06:29 AM

In case u haven't noticed i'm new at the nat stuff. I don't know very much, but i'm trying :-P, i'm more of a lat :D. But anyways, i know about the scripting in the hammer, just not sure what to use lol

Xaviar 10-02-2001 06:45 AM

Quote:

Originally posted by Xaviar
Triggeraction :D , course, I would use testnpc too to make it a little less laggy...
That pretty much says it all, look 'em up in the commands.rtf, and if ya've still questions after that, post em, and Ill help ya out, Im cooking supper right now though, so I wont be too helpfull X_X

ZORG1986 10-02-2001 06:51 AM

Quote:

Originally posted by Xaviar


That pretty much says it all, look 'em up in the commands.rtf, and if ya've still questions after that, post em, and Ill help ya out, Im cooking supper right now though, so I wont be too helpfull X_X

Yea people should really look in commands.rtf before posting on here....

LinksReturn 10-02-2001 06:54 AM

I've looked at it, but i'm not sure how I would use it :( "triggeraction x,y,action,params; triggers a ‘if (action<action>)...’ on the objects on (x,y)"

params? O.o, and how would i apply it to the hammer

ZORG1986 10-02-2001 07:01 AM

triggeraction x,y,action,params;
You wouldnt need any params, the action would be the action name and the x and y would be the x and y location of the NPC the trigger action is directed at.
The NPC on x y would need the command
if (actionname) {actions go here}
name being the name of the action you triggerd
and if its to increase a variable the actions it would need to trigger would be
varialblename+=1;

Now chances are i have completley confused you, cause i have confused myself, and i think i have just decided Im crap at explaining commands, erm someone translate the above into English please, LoL

Xaviar 10-02-2001 07:06 AM

Quote:

Originally posted by LinksReturn
I've looked at it, but i'm not sure how I would use it :( "triggeraction x,y,action,params; triggers a ‘if (action<action>)...’ on the objects on (x,y)"

params? O.o, and how would i apply it to the hammer

Use a triggeraction on the x/y that you use the hammer on (use testnpc first to make sure theres an npc there), then in the npc you need to recognize if its been hit by the hammer:

if (actionactionname) {
if (this.hit<insertnumhere)
this.hit++;
else {
this.hit=0;
commands to run when its been hit num times;
}

LinksReturn 10-02-2001 07:10 AM

*scratches head*
All i need to know if the hammer thingy, i got it working for the sword, but what would i put in the hammer, or as teh action is what i'm asking. example: if(npctouchsme) or what?
oh btw thanx for helpin :)

LinksReturn 10-02-2001 07:12 AM

but then again, i have it in about the simplest form possible, i'm no nat expert as you can tell.

Vinvect 10-02-2001 08:19 AM

here
 
heres for hammer:
NPC Code:

if (playertouchsme) {
toweapons Hammer;
set gothammer;
set alreadygothammer;
destroy;
}
if (playerenters) {
hideimg 1;
this.step = 0;
timeout = 0;
show;
}
if (weaponfired && this.step<=0) {
triggeraction playerx+1.5+vecx(playerdir)*2,
playery+2+vecy(playerdir)*2,hammering,#v(hammerpow er);
hideimg 1;
hidesword 0.5;
freezeplayer 0.5;

timeout = 0.05;
this.step = 0;
}
if (timeout) {
this.step++;
if (this.step<10) {
if (this.step<3) {
if (playerdir==0) playersprite = 11;
else if (playerdir==2) playersprite = 6;
else playersprite = 9;
} else {
if (playerdir==0) playersprite = 10;
else if (playerdir==2) playersprite = 11;
else playersprite = 11;
}
if (this.step==6) {
set teststake;
set testhurt;
}
if (playerdir==0) showimg 1,wham0.gif,playerx-0.75,playery-1.7;
if (playerdir==1) showimg 1,wham1.gif,playerx-1.7,playery-0.2;
if (playerdir==2) showimg 1,wham2.gif,playerx+0.6,playery-0.4;
if (playerdir==3) showimg 1,wham3.gif,playerx+1.5,playery-0.2;
timeout = 0.05;
} else {
playersprite = 0;
hideimg 1;
this.step = 0;
}
}
if (teststake) {
unset teststake;
putx = playerx + 0.5;
puty = playery + 2;
if (playerdir==0) puty -= 3;
if (playerdir==1) { putx -= 2; puty -= 0.5; }
if (playerdir==2) { putx += 0.5; puty += 1; }
if (playerdir==3) { putx += 2; puty -= 0.5; }
putx = int(putx);
puty = int(puty);
set isstake;
for (i=0; i<2; i++) for (j=0; j<2; j++) {
b = board[putx+i+64*(puty+j)];
bx = b % 16;
by = int(b / 16);
if (!(bx==10+i && by==20+j) &&
!(bx==4+i && by==103+j))
unset isstake;
}
if (isstake) {
unset isstake;
board[putx+64*puty] = 10+112*16;
board[putx+1+64*puty] = 11+112*16;
board[putx+64*(puty+1)] = 10+113*16;
board[putx+1+64*(puty+1)] = 11+113*16;
updateboard putx,puty,2,2;
play axe.wav;
} else play arrowon.wav;
}
if (testhurt) {
unset testhurt;
testx = playerx+1.5;
testy = playery+2;
if (playerdir==0) testy-=2;
if (playerdir==1) testx-=2;
if (playerdir==2) testy+=2;
if (playerdir==3) testx+=2;
for (i=0; i<compuscount; i++) {
if (abs(testx-(compus[i].x+1))<=1 &&
abs(testy-(compus[i].y+1))<=1.5 &&
compus[i].mode!=3)
hitcompu i,3,testx,testy;
}
for (i=1; i<playerscount; i++) {
if (abs(testx-(players[i].x+1.5))<=1 &&
abs(testy-(players[i].y+2))<=1.5) {
// hitplayer i,2,testx,testy;
putleaps 2,testx-1,testy-1;
unset gothammer;
destroy;
}
}
}


then u put this on npc:
NPC Code:

if (actionhammering) {
hammerpower = strtofloat(#p(0));
this.power -= hammerpower;
if (this.power<=0) {
setstring PUT_NAMEHERE_,#v(strtofloat(#s(PUT_NAME_HERE))+1);
hide;
}
}


:megaeek: :megaeek: :megaeek: :megaeek: :megaeek: :megaeek:

entravial 10-02-2001 08:33 AM

~AlphaFlame~

Sir, please go away and come back after you learn how to NOT use flags for weapons.

btedji 10-02-2001 07:25 PM

he just copied the hammer script so he probably wasnt the one who used flags


All times are GMT +2. The time now is 12:03 AM.

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