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 11-26-2004, 03:19 PM
Salaisuus Salaisuus is offline
Registered User
Join Date: Mar 2004
Posts: 68
Salaisuus is on a distinguished road
1+1=3?

These things are used to pick up and drop an item.

Class melon:
NPC Code:
if (created) {setimg melon.gif;
setshape2 1,1,{22,22};}
if (actionpickup) {
setstring clientr.melon, #v(strtofloat(#s(clientr.melon))+1);
addweapon melon;
destroy;}



Weapon melon:
NPC Code:
 if (actionserverside) { putnpc2 playerx,playery,{join melon;} ;}
//#CLIENTSIDE
if (playerchats&&strequals(#c,drop)){
triggeraction 0,0,serverside,melon,#a;
setstring clientr.melon, #v(strtofloat(#s(clientr.melon))-1);}



Weapon pickup:
NPC Code:
if (weaponfired) {
triggeraction playerx+1.5+vecx(playerdir)*2,
playery+2+vecy(playerdir)*2,pickup,;}



Some compination of these scripts must be causing that
when it(class melon) is picked up you get +2 in the clientr.melon instead of the +1 its supposed to give.
But I cant seem to find out what it is.
Help?
Reply With Quote
  #2  
Old 11-26-2004, 06:20 PM
calum calum is offline
Registered User
Join Date: Nov 2003
Location: Scotland
Posts: 182
calum is on a distinguished road
I'm not sure how most of you script could have worked anyway but it works like this after i fixed some things...

melon class...
NPC Code:

if (created)
{
setimg chest.png;
setshape2 1, 1, {22, 22};
}
if (actionpickup) {
setstring clientr.melon, #v(strtofloat(#s(clientr.melon))+1);
addweapon melon;
destroy;
}



melon weapon...
NPC Code:

if (actionserverside)
{
if (strequals(#p(0),melon)){
with(getplayer(#p(1))){
putnpc2 strtofloat(#v(playerx)),strtofloat(#v(playery)),{
join melon;
}
}
}
}
//#CLIENTSIDE

if (playerchats && strequals(#c,drop)){

triggeraction x, y, serverside, melon, melon, #a;

setstring clientr.melon, #v(strtofloat(#s(clientr.melon))-1);
}



pickup weapon...
NPC Code:

//#CLIENTSIDE
if (weaponfired) {
triggeraction playerx + 1.5 + vecx(playerdir)*2, playery + 2 + vecy(playerdir)*2, pickup, ;
}

__________________
Reply With Quote
  #3  
Old 11-26-2004, 09:05 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Its because you can't change a clientr. string clientside. So, you never lose one when you drop it.
Reply With Quote
  #4  
Old 11-27-2004, 12:21 AM
Salaisuus Salaisuus is offline
Registered User
Join Date: Mar 2004
Posts: 68
Salaisuus is on a distinguished road
Quote:
Its because you can't change a clientr. string clientside. So, you never lose one when you drop it.
Ah yes,
I tough it was working first beacuse I used a npc the check the amount of melons

//#CLIENTSIDE
if (playerchats&&strequals(#c,count melons)){
say2 #s(clientr.melons);}

But because it was client side it aparently gave me some kind of clientside amount of clientr.melon, and i tought they where redusing. odd.
when I checked player atriputes wiht rc it showed a difrent amount.

I got it fixed now, thanks.
Reply With Quote
  #5  
Old 11-27-2004, 09:41 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
I think you needed something to update how many melon's you had. When you pick up a melon add a time out instead of doing one constantly
__________________
Reply With Quote
  #6  
Old 11-27-2004, 04:57 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
The melon dropper should look like this i guess :

NPC Code:

if (actionserverside) {
quant = strtofloat(#s(clientr.melon));
if (quant>=1) {
setstring clientr.melon,#v(quant-1);
putnpc2 playerx,playery,{join melon;} ;
}
}

//#CLIENTSIDE
if (playerchats && strequals(#c,drop)) {
setplayerprop #c,;
triggeraction 0,0,serverside,melon;
}

Reply With Quote
  #7  
Old 11-27-2004, 09:05 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Ksi-gs
__________________
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 07:25 PM.


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