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 05-25-2004, 04:50 AM
Salaisuus Salaisuus is offline
Registered User
Join Date: Mar 2004
Posts: 68
Salaisuus is on a distinguished road
How to drop items?

This works fine ofline for me,
but what do I need to do to make it work with npc server?

if (strtofloat(#s(client.stuff)) >=1) {
if (playerchats && strequals(#c,drop)) {
putnpc potion.gif,bpotion.txt,playerx,playery;
setplayerprop #c,Dropped;
sleep 0.1;
setstring client.stuff, #v(strtofloat(#s(client.stuff))-1);
}

Also should the npc txt. file be saved to levels/scripts or am I a complete idiot?
Reply With Quote
  #2  
Old 05-25-2004, 05:38 AM
EsCanavi EsCanavi is offline
No Longer Graalian.
EsCanavi's Avatar
Join Date: Oct 2003
Location: ..:: Lassomption/Quebec/Canada ]::...
Posts: 214
EsCanavi is on a distinguished road
Send a message via AIM to EsCanavi Send a message via MSN to EsCanavi
script it serverside with

triggeraction 0,0,serverside,npcname,param1,p2,p3,p4...etc...

and a if ( actionserverside )
if ( strequals( #p(1),drop )

putnpc2 playerx,playery,{ script or class like join thiscalss;};

etc... well not sure about the syntax of #p(1) havent scripter far a while of course..
__________________
:: Free Gift... 40$ ::
:: WrsHosting ::
:: Need a webhost, contact me ( free ) 99.9% Online ::
Contact me: [email protected] (msn|mailbox)
Reply With Quote
  #3  
Old 05-25-2004, 05:44 AM
DIABLO2099 DIABLO2099 is offline
Registered User
Join Date: Sep 2002
Location: New York
Posts: 290
DIABLO2099 is on a distinguished road
The document is placed where the level is. (same folder)
__________________
-Former UnholyNation Server Manager.

Call me Xecutor.
Reply With Quote
  #4  
Old 05-25-2004, 06:07 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
putnpc is deprecated. Don't use it.

Sigh.

Oh, and Es - the first argument sent is read as #p(0) serverside.

I'll further note that what Es described is the script of a weapon.
Reply With Quote
  #5  
Old 05-25-2004, 08:16 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Yes, if you want it for a non-NPCW (non-weapon) then have it something like:

NPC Code:
if (created) setshape 1,1,1;
if (actionblah) {
putnpc2 x,y,{script;};
}
//#CLIENTSIDE
if (playertouchsme) triggeraction x,y,blah,param0,param1,param2,ect...;


That is just an example though ;
You can tweak it how you want (for the script part I suggest just having the script a one line command called "join classname;" and then put your script of the npc you drop into a class called "classname")

[EDIT]
Quote:
Originally Posted by Salaisuus
Also should the npc txt. file be saved to levels/scripts or am I a complete idiot?
The scripts folder is just the folder where classes are stored and should only be used for BACKUP perposes (sp?).
IF putnpc where to be used (which it shouldn't be) you would save it in a folder with the levels folder (or levels it self) and then put into the folder options: "file *.txt"
Or if it was in a sub folder in levels: "file subfoldername/*.txt"
Notice you DON'T include the levels/ part as everything in folder ops automaticly includes that for you
[/EDIT]
__________________
Do it with a DON!
Reply With Quote
  #6  
Old 05-25-2004, 08:20 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Quote:
Originally Posted by zokemon
playertouchesme
playertouchsme

Also, you're telling him to join 'classname' and to make a class called 'callname'. These should not be differently named...

Edit: Thank you for fixing. ^_^
Reply With Quote
  #7  
Old 05-25-2004, 08:22 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by Lance
playertouchsme

Also, you're telling him to join 'classname' and to make a class called 'callname'. These should not be differently named...
That is what we call "typos"
__________________
Do it with a DON!
Reply With Quote
  #8  
Old 05-25-2004, 08:23 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Quote:
Originally Posted by zokemon
That is what we call "typos"
I know, but the average newbie scripter who searches for help does not.
Reply With Quote
  #9  
Old 05-25-2004, 06:42 PM
protagonist protagonist is offline
Banned
protagonist's Avatar
Join Date: May 2003
Location: CAW
Posts: 5,586
protagonist is on a distinguished road
Send a message via AIM to protagonist Send a message via MSN to protagonist
Quote:
Originally Posted by zokemon
That is what we call "typos"

Hehe. It's a paradox typo. It's wrong either way.
Reply With Quote
  #10  
Old 05-26-2004, 03:40 AM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
Quote:
Originally Posted by Salaisuus
Also should the npc txt. file be saved to levels/scripts or am I a complete idiot?
Option 2 sir.
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
Reply With Quote
  #11  
Old 05-26-2004, 03:52 AM
Salaisuus Salaisuus is offline
Registered User
Join Date: Mar 2004
Posts: 68
Salaisuus is on a distinguished road
Eh eh eh?

Whats the

if ( strequals( #p(1),drop )

part for exactly?

I cant get it to work, I cant get anything to work. You people confuse me.
Reply With Quote
  #12  
Old 05-26-2004, 04:13 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Salaisuus
Whats the

if ( strequals( #p(1),drop )

part for exactly?

I cant get it to work, I cant get anything to work. You people confuse me.
It goes in the serverside part of the script (before //#CLIENTSIDE)
For example,
NPC Code:
If (actionserverside) {
if (strequals(#p(1),drop)) {
putnpc2 playerx,playery,{ //script or class (like join CLASSNAME);};
}
}



In the clientside part it would just be:
NPC Code:
triggeraction 0,0,serverside,WEAPONNAME,drop;




NOTE: This will only work for weapons. And you don't NEED to use a parameter for this one, just that you asked so I answered .
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #13  
Old 05-26-2004, 05:24 AM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
Quote:
Originally Posted by Salaisuus
Whats the

if ( strequals( #p(1),drop )

part for exactly?

I cant get it to work, I cant get anything to work. You people confuse me.
That's what happens when you copy and paste scripts
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #14  
Old 05-26-2004, 06:14 AM
Salaisuus Salaisuus is offline
Registered User
Join Date: Mar 2004
Posts: 68
Salaisuus is on a distinguished road
It gives me error "expected format if (flag) command"
When I use
if (strequals(#p(1),drop))

And its not a weapon anyhow...

I tried this:
if (strtofloat(#s(client.potions)) >=1) {
if (playerchats && strequals(#c,drop)) {
triggeraction 0,0,Bpotion,;
}
}
if (actionBpotion){
setplayerprop #c,Dropped;
sleep 0.1;
setstring client.potions, #v(strtofloat(#s(client.potions))-1);
putnpc2 potion.gif,playerx,playery,{if (created)
{setshape 1,2,1;}
if (playetouchsme){
setstring client.potions, #v(strtofloat(#s(client.potions))+1);
destroy;}}}

It doesnt even work ofline meh...
Reply With Quote
  #15  
Old 05-26-2004, 09:31 AM
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
if(actionserverside){
if(strequals(#p(1),wan)){
stuff
}
if(strequals(#p(2),wan2)){
more stuff here
}
}
//#CLIENTSIDE
if(weaponfired){
triggeraction 0,0,serverside,#w,wan,wan2;
}

#p = param
triggeraction x,y,serverside,weaponame,param1,param2,param3,etc, etc,etc;
__________________
V$:CONFL16T
Reply With Quote
  #16  
Old 05-26-2004, 02:38 PM
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
I'll give it a shot.

NPC Code:

if (actionBpotion){
setplayerprop #c,Dropped;
sleep 0.1;
setstring client.potions,#v(strtofloat(#s(client.potions))-1);
putnpc2 potion.gif,playerx,playery,{
if (created) {setshape 1,2,1;}
if (playetouchsme){
setstring client.potions,#v(strtofloat(#s(client.potions))+1 );
destroy;
}
};
}
//#CLIENTSIDE
if (strtofloat(#s(client.potions)) >=1) {
if (playerchats && strequals(#c,drop)) {
triggeraction x,y,Bpotion,;
//If a weapon, change x,y to 0,0
}
}



This could all be done serverside though, and you wouldn't have to worry about triggeraction.
NPC Code:

if (strtofloat(#s(client.potions)) >=1) {
if (playerchats && strequals(#c,drop)) {
drop();
}
}
function drop() {
setplayerprop #c,Dropped;
sleep 0.1;
setstring client.potions,#v(strtofloat(#s(client.potions))-1);
putnpc2 potion.gif,playerx,playery,{
if (created) {setshape 1,2,1;}
if (playetouchsme){
setstring client.potions,#v(strtofloat(#s(client.potions))+1 );
destroy;
}
};
}



Haven't tested it on a server so there is no guarantee that it will work.

I do know that putnpc2 does not work offline. Not sure about triggeraction though.
__________________
Maniaman

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

Reply With Quote
  #17  
Old 05-26-2004, 05:36 PM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
First learn to walk before trying to run, buddy.
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
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 11:30 AM.


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