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
  #81  
Old 02-04-2004, 02:51 AM
xManiamaNx xManiamaNx is offline
Supreme Dictator
xManiamaNx's Avatar
Join Date: Nov 2002
Location: 127.0.0.1
Posts: 385
xManiamaNx is on a distinguished road
Send a message via MSN to xManiamaNx Send a message via Yahoo to xManiamaNx
NPC-Servers have minds of their own

There will be times I'lls cript somethign and it wont work, I come back a few days later, and the exact code will work. It's really quite odd.

Stefan, does showtext work serverside?
__________________
Maniaman

Play Maloria Now: [2.3] [3]
Maloria Website

Reply With Quote
  #82  
Old 02-04-2004, 03:28 AM
Gman4pwnu Gman4pwnu is offline
Banned
Join Date: Jan 2004
Posts: 434
Gman4pwnu is on a distinguished road
Send a message via AIM to Gman4pwnu
When I try to triggeraction from clientside to serverside and write the mineral count to clientr's, it does not work. I do it as I would do it with client strings.
Reply With Quote
  #83  
Old 02-04-2004, 03:40 AM
Gman4pwnu Gman4pwnu is offline
Banned
Join Date: Jan 2004
Posts: 434
Gman4pwnu is on a distinguished road
Send a message via AIM to Gman4pwnu
Clientr's

Theres something wrong with this script, when uploaded, it never adds the clientr's. It never adds +1 to the clientr's. Everytime i type Show Minerals it shows 0 0 0 0 for the clientr's. I've never used clientr's. What is wrong with the script?
NPC Code:

if (created){
setstring clientr.lead,0;
setstring clientr.silver,0;
setstring clientr.gold,0;
setstring clientr.diamond,0;
}

if (playerchats && strequals(#c,Show Minerals)){
this.lead = clientr.lead;
this.silver = clientr.silver;
this.gold = clientr.gold;
this.diamond = clientr.diamond;
}

if (actionmined){
if (int(this.minechoice) > 25 && int(this.minechoice) <= 100){
setstring clientr.lead,#v(strtofloat(#s(clientr.lead)) + 1);
}
if (int(this.minechoice) > 100 && int(this.minechoice) <= 150){
setstring clientr.silver,#v(strtofloat(#s(clientr.silver)) + 1);
}
if (int(this.minechoice) > 150 && int(this.minechoice) <= 230){
setstring clientr.gold,#v(strtofloat(#s(clientr.gold)) + 1);
}
if (int(this.minechoice) > 230 && int(this.minechoice) <= 256){
setstring clientr.diamond,#v(strtofloat(#s(clientr.diamond)) + 1);
}
}
//#CLIENTSIDE
if (weaponfired){
this.posx = playerx + 1.5 + vecx(playerdir) * 2;
this.posy = playery + 1.5 + vecy(playerdir) * 2;
this.tile=tiles[this.posx,this.posy];
if (tiles[this.posx,this.posy] == 2055 || tiles[this.posx,this.posy] == 2056 || tiles[this.posx,this.posy] == 2073 || tiles[this.posx,this.posy] == 2074 || tiles[this.posx,this.posy] == 2070 || tiles[this.posx,this.posy] == 2086 || tiles[this.posx,this.posy] == 2076 || tiles[this.posx,this.posy] == 2060){
//setplayerprop #c, Omg you just mined a rock!;
freezeplayer .4;
setani dyn-pickaxe,;
this.minechoice = random(0,256);
triggeraction playerx+.5,playery+.5,mined,;
if (int(this.minechoice) >= 0 && int(this.minechoice) <= 25){
setplayerprop #c, Got Nothing!;
}
if (int(this.minechoice) > 25 && int(this.minechoice) <= 100){
setplayerprop #c, Got Lead!;
}
if (int(this.minechoice) > 100 && int(this.minechoice) <= 150){
setplayerprop #c, Got Silver!;
}
if (int(this.minechoice) > 150 && int(this.minechoice) <= 230){
setplayerprop #c, Got Gold!;
}
if (int(this.minechoice) > 230 && int(this.minechoice) <= 256){
setplayerprop #c, Got Diamond!;
}
}
//setplayerprop #c, #v(this.tile) = Current Tile;
}

if (playerchats && strequals(#c,Show Minerals)){
setplayerprop #c, Lead:#v(this.lead) Silver:#v(this.silver) Gold:#v(this.gold) Diamond:#v(this.diamond);
}

Reply With Quote
  #84  
Old 02-04-2004, 03:55 AM
Duwul Duwul is offline
Registered User
Join Date: Nov 2003
Posts: 105
Duwul is on a distinguished road
For one, this. vars set on the server can not be read from the client. It is the same the other way around. This. vars set on the client can not be read on the server.

Second, to set the value of a string to a var, you do

NPC Code:

this.myvar = strtofloat(#s(stringname));



Just doing it without strtofloat won't work, nor will just the name of the string.

Third. For the triggeraction, just do

NPC Code:

triggeraction 0,0,serverside,#w,mined,extra params for the amount/type of rocks;



Then, in the serverside part, you can pick it up with actionserverside, and check #p(0) for mined.

Also, why would you check each tile individually? And, you shouldn't have to use tiles[] anymore, you already set the tile in the this.tile var. Just make an array with all the tiles you want to check for, and do

NPC Code:

if (this.tile in tilearray)

__________________
-Ajira
Liek, omigosh.
<3 DoomsDay.
Reply With Quote
  #85  
Old 02-04-2004, 04:25 AM
Gman4pwnu Gman4pwnu is offline
Banned
Join Date: Jan 2004
Posts: 434
Gman4pwnu is on a distinguished road
Send a message via AIM to Gman4pwnu
im not that advanced into scripting yet.
Reply With Quote
  #86  
Old 02-04-2004, 04:31 AM
Termina_Owner Termina_Owner is offline
Registered User
Join Date: Oct 2003
Posts: 175
Termina_Owner is on a distinguished road
mineral's count?

NPC Code:

if (created){
setshape 1,32,32;
save[0] = 50; // Health
}
if (actionminded){
damage = strtofloat(#p(0));
save[0]-= damage;
message Arg... I only have #v(save[0]) life left! When shall you learn your mannres?;
if (save[0] <= 0){
message Damn Fool... YOU KILLED ME! WHYY!!!???;
save[0] = 50;
setstring clientr.mineralsachieved,#v(strtofloat(#s(clientr. mineralsachieved))+1);
}
}

__________________
- Rance Vicious
Reply With Quote
  #87  
Old 02-04-2004, 04:33 AM
Termina_Owner Termina_Owner is offline
Registered User
Join Date: Oct 2003
Posts: 175
Termina_Owner is on a distinguished road
I posted an easier solution in the Miner's thread that you added to spam the NPC Catagory..
__________________
- Rance Vicious
Reply With Quote
  #88  
Old 02-04-2004, 04:37 AM
Termina_Owner Termina_Owner is offline
Registered User
Join Date: Oct 2003
Posts: 175
Termina_Owner is on a distinguished road
BRILLIANT... Why didn't he think of it earlier.... Erm... Just hope he uses it... Hope he at least credit us for our patience with his spamming thread plans.
__________________
- Rance Vicious
Reply With Quote
  #89  
Old 02-04-2004, 04:41 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
sorry for the messy merge, the system here for merging threads didn't work the way I had expected it to, but the fact of the matter is, don't do this again please =/ just post one large thread with all your questions or I shall delete them next time
Reply With Quote
  #90  
Old 02-04-2004, 06:11 AM
R0bin R0bin is offline
Banned
R0bin's Avatar
Join Date: Oct 2002
Location: Wales, UK
Posts: 828
R0bin is on a distinguished road
Send a message via AIM to R0bin
Quote:
Originally posted by Stefan
2. with (getplayer(#a)) is completely nonsense, please kill the one who teached you such stuff
Hi Projectshifter!!!


also, by "bored", stefan means either, when the npc server has nothing to do, or he means when it just sends everything to the clientside.
Reply With Quote
  #91  
Old 02-04-2004, 03:07 PM
WanDaMan WanDaMan is offline
Master Tux
WanDaMan's Avatar
Join Date: Aug 2002
Location: England, United Kingdom
Posts: 5,571
WanDaMan is a jewel in the roughWanDaMan is a jewel in the rough
Send a message via MSN to WanDaMan
Wait this is so confusing, I remember being the first person to reply and me and osrs got into a battle at the beggining about this, I can't remember stefan posting before me, nor do I remember me spamming, what is going on?
__________________
V$:CONFL16T
Reply With Quote
  #92  
Old 02-04-2004, 04:55 PM
R0bin R0bin is offline
Banned
R0bin's Avatar
Join Date: Oct 2002
Location: Wales, UK
Posts: 828
R0bin is on a distinguished road
Send a message via AIM to R0bin
All gman's threads were merged into one.
Reply With Quote
  #93  
Old 02-04-2004, 07:23 PM
WanDaMan WanDaMan is offline
Master Tux
WanDaMan's Avatar
Join Date: Aug 2002
Location: England, United Kingdom
Posts: 5,571
WanDaMan is a jewel in the roughWanDaMan is a jewel in the rough
Send a message via MSN to WanDaMan
Now it looks like I just spammed, great moving !
__________________
V$:CONFL16T
Reply With Quote
  #94  
Old 02-04-2004, 08:20 PM
GoZelda GoZelda is offline
Mister 1,000,000
GoZelda's Avatar
Join Date: Jan 2003
Location: Brussels, capital of Europe.
Posts: 5,396
GoZelda will become famous soon enough
Send a message via AIM to GoZelda Send a message via MSN to GoZelda
Yeah, it totally flipped.

Bad remix ...
__________________

Quote:
Originally Posted by Lance
stefan is satan
I am the best.
[URL removed]Music or aural pollution?
Reply With Quote
  #95  
Old 02-04-2004, 09:43 PM
R0bin R0bin is offline
Banned
R0bin's Avatar
Join Date: Oct 2002
Location: Wales, UK
Posts: 828
R0bin is on a distinguished road
Send a message via AIM to R0bin
like the quantum leap remix i heard the other day! *shudders*
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 09:17 AM.


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