PDA

View Full Version : How to drop items?


Salaisuus
05-25-2004, 04:50 AM
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?
:frown:

EsCanavi
05-25-2004, 05:38 AM
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..

DIABLO2099
05-25-2004, 05:44 AM
The document is placed where the level is. (same folder)

Lance
05-25-2004, 06:07 AM
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.

zokemon
05-25-2004, 08:16 AM
Yes, if you want it for a non-NPCW (non-weapon) then have it something like:

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")


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 ;)

Lance
05-25-2004, 08:20 AM
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. ^_^

zokemon
05-25-2004, 08:22 AM
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" ^^

Lance
05-25-2004, 08:23 AM
That is what we call "typos" ^^

I know, but the average newbie scripter who searches for help does not. :)

protagonist
05-25-2004, 06:42 PM
That is what we call "typos" ^^


Hehe. It's a paradox typo. It's wrong either way.

osrs
05-26-2004, 03:40 AM
Also should the npc txt. file be saved to levels/scripts or am I a complete idiot?
:frown:

Option 2 sir. :)

Salaisuus
05-26-2004, 03:52 AM
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.
:eek:

napo_p2p
05-26-2004, 04:13 AM
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.
:eek:

It goes in the serverside part of the script (before //#CLIENTSIDE)
For example,
If (actionserverside) {
if (strequals(#p(1),drop)) {
putnpc2 playerx,playery,{ //script or class (like join CLASSNAME);};
}
}

In the clientside part it would just be:
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 ;).

Dach
05-26-2004, 05:24 AM
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.
:eek:
That's what happens when you copy and paste scripts :whatever:

Salaisuus
05-26-2004, 06:14 AM
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...

WanDaMan
05-26-2004, 09:31 AM
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;

xManiamaNx
05-26-2004, 02:38 PM
I'll give it a shot.


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.

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.

osrs
05-26-2004, 05:36 PM
First learn to walk before trying to run, buddy.