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 02-07-2002, 02:40 AM
GregoryYoshi GregoryYoshi is offline
Registered User
Join Date: Jan 2002
Location: Wherever I am right now
Posts: 227
GregoryYoshi is on a distinguished road
Send a message via AIM to GregoryYoshi Send a message via Yahoo to GregoryYoshi
Dilema...

I seem to be having a problem with my mineral mining scripts.

The NPC weapon is fine for the most part...it retrieves the player's ID and then sends it through triggeraction.

NPC Code:
//#CLIENTSIDE
// NPC made by GregoryYoshi
if (playerenters) {
setshape 1,32,32;
this.axepower = 2;
setcharprop #c,Level 1 Pickaxe;
}
if (playertouchsme) {
toweapons Pickaxe L1;
hide;
sleep 3;
show;
}

if (weaponfired) {
this.axepower = 2;
this.playerid = playerid;
freezeplayer .75;
setani jaxe,pickaxemetal.png;
triggeraction playerx+1.5+vecx(playerdir)*2,playery+1.75+vecy(pl ayerdir)*2,mining,#v(this.axepower),#v(this.player id);
showimg 210,dk_hitpointer.png,playerx+1.5+vecx(playerdir)* 2,playery+1.75+vecy(playerdir)*2;
sleep .75;
setani idle,;
hideimg 210;
}



The problem is the mineral NPC (which is a class NPC script) is not accepting the playerid parameter sent through triggeraction

NPC Code:
if (created) {
setshape 1,32,32;
this.mined = 0;
}

if (actionmining && !this.mined==100) {
this.mined = this.mined + strtofloat(#p(0));
this.hitterid = strtofloat(#p(2));
gethitter();
setcharprop #c,#v(this.mined) | #v(this.hitter);
} else
if (actionmining && this.mined==100) {
this.hitterid = strtofloat(#p(1));
gethitter();
setimg explosion.gif;
play2 bomb.wav,x-1,y-1,1;
if (hitter>0) {
with (players[hitter]) {
freezeplayer 1;
setani dk_mined,this.type*10;
if (this.type==4) {
setstring uncraftedgold,#v(strtofloat(#s(uncraftedgold))+1);
} else if (this.type==3) {
setstring uncraftedred,#v(strtofloat(#s(uncraftedred))+1);
} else if (this.type==2) {
setstring uncraftedblue,#v(strtofloat(#s(uncraftedblue))+1);
} else if (this.type==1) {
setstring uncraftedgreen,#v(strtofloat(#s(uncraftedgreen))+1 );
}
}
}
hide;
sleep 5;
this.type = int(random(1,5);
this.mined = 0;
show;
}

function gethitter() {
hitter = -1;
for (i=0; i<playerscount; i++)
if (players[i].id==this.hitterid) {
hitter = i;
break;
}
}



Neither of these are confidentail scripts, so I don't mind showing them

There's probably something wrong that I'm doing...hopefully I can get this fixed fast
__________________
Zayjee uses this account now. OK?
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 05:47 AM.


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