Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   toweapons/addweapon? (https://forums.graalonline.com/forums/showthread.php?t=53206)

Salaisuus 06-17-2004 03:37 AM

toweapons/addweapon?
 
addweapon wont work for me at all, why why why?
toweapons works just fine with npc sever except when used clientside...
But yeah, plah plah, how do I get addweapon to effing work??
x_x

Oh and when I try to save classes RC says:
"Script *scriptname* saved (no npc with this class on the server)."
And wont display the file. Even tho there is an npc with that class on the server. Why oh why?

Bah.
Before I started my server I scripted everything I needed and then it turned out most of my stuff didnt work with npc server.
Argh.

So on a side note to that Im hiring a freaking scripter if anyone would care to help with a few simple (simple? maybe...) npcs. :\

Malinko 06-17-2004 04:14 AM

addweapon = serverside.
toweapons = the devil.

Xecutor 06-17-2004 04:45 AM

You have to have weapons in your weapons list(sword icon) to use addweapon (it adds a weapon to someones inventory).
toweapons should not be used if you have an npcserver.
To get the class file, look in the folder scripts.

matt8891 06-17-2004 05:31 AM

If you want to use toweapons;(adds npc to NPC-Control) do this:

if (actionserverside)
{if (playertouchsme) toweapons;
}

If you want to use addweapons;(adds NPC thats already in NPC-Control to player attributes) do this:

//#CLIENTSIDE
{if (playertouchsme)
addweapon (weaponame)
}

Duwul 06-17-2004 05:38 AM

Quote:

Originally Posted by matt8891
If you want to use toweapons;(adds npc to NPC-Control) do this:

if (actionserverside)
{if (playertouchsme) toweapons;
}

If you want to use addweapons;(adds NPC thats already in NPC-Control to player attributes) do this:

//#CLIENTSIDE
{if (playertouchsme)
addweapon (weaponame)
}

Erm, wtf?
addweapon only works serverside, and don't use toweapons at all =/

Lance 06-17-2004 09:41 AM

Do not use toweapons. It is deprecated and causes problems with the NPC-Server.

Use NC to add the weapon to the weapons database, then use the serverside command:
NPC Code:
addweapon weaponname;



LordVyse, a warning: Those who continually post bad advice in the scripting forum become masked from it.

Salaisuus 06-17-2004 05:36 PM

Right... So all I need to do Is ad the weapon script to the npcs before using addweapon.

I feel like getting rid of npc server, I dont seem to need it for all that much...

matt8891 06-17-2004 05:42 PM

Quote:

Originally Posted by Lance
Do not use toweapons. It is deprecated and causes problems with the NPC-Server.

Use NC to add the weapon to the weapons database, then use the serverside command:
NPC Code:
addweapon weaponname;



LordVyse, a warning: Those who continually post bad advice in the scripting forum become masked from it.

I still dont understand why toweapons is bad to use....If its so BAD to use why hasnt anyone removed it from the Commands?

Loriel 06-17-2004 05:44 PM

Because people still use it and Stefan does not want to break scripts.

Xecutor 06-17-2004 08:47 PM

Having a serveroption to disable it like mentioned in some other thread would be cool.

matt8891 06-17-2004 09:16 PM

Quote:

Originally Posted by Xecutor
Having a serveroption to disable it like mentioned in some other thread would be cool.

Maybe someone could script that into NPC-Server.

Loriel 06-17-2004 10:03 PM

I once suggested something like disablescriptcommands=toweapons,sendpm,...

osrs 06-18-2004 06:16 PM

About the class npc, you have to call the script (using the serverside command join) so it will show in the classes. If you have already called the script and it still does not show, so i have no clue.

Ningnong 06-18-2004 07:09 PM

Quote:

Originally Posted by Salaisuus
Right... So all I need to do Is ad the weapon script to the npcs before using addweapon.

I feel like getting rid of npc server, I dont seem to need it for all that much...

Don't get rid of the npc server, you will find it very useful. Just get someone who can script to edit your npcs for use with the npc-server.

Malinko 06-18-2004 09:57 PM

Classic still uses toweapons right? Since they have no NPC Server. N-Pulse did use it til we converted it all.

osrs 06-18-2004 09:58 PM

Quote:

Originally Posted by Malinko
Classic still uses toweapons right? Since they have no NPC Server. N-Pulse did use it til we converted it all.

I think Classic get an NPC-Server, or its debug server,

falco10291029 06-19-2004 12:02 AM

addweapon never works for me. I have tried tons of things. i do exactly what u r supposed to
[/code]
if (actionserverside) {addweapon wepname;}
//#CLIENTSIDE
if (playertouchsme) {triggeraction 0,0,serverside,}
[\code]
yet it never works. I dont know what I am going to do for my server. also for some reason offline it dont even recognize addweapon. It says its not a valid command. And usually offline it knows online commands......

Xecutor 06-19-2004 12:23 AM

Since your a beginner, just try addweapon weaponname; serversided. Make sure you have the weapon in your weaponslist. The command is not recoginized offline because the offline client does not recognize some (if not all) commands that require an NPC server.

xManiamaNx 06-19-2004 12:25 AM

falco21954368743698340,
Having triggeraction trigger to an x and y of 0 should only be used in WEAPONS.

All serverside:
if (playertouchsme) { addweapon wepname; }
Clientside junk shouldn't be used if all your are doing is adding a weapon when the player touches it.

The "Test" button on the offline editor hasn't been updated in ages. Most new commands it has never heard of. addweapon will not work offline, because there is no offline NPC-Server.

falco10291029 06-19-2004 01:33 AM

thank you all for your help

Ris 06-19-2004 01:38 AM

hmm well if you wanted to make it easyer on you then that instead of putting it on a level you could just put this in the Control-NPC thing just add
NPC Code:
if (!hasweapon(-narf narf)) addweapon -narf narf;


xManiamaNx 06-19-2004 01:57 AM

Quote:

Originally Posted by Ris
NPC Code:
if (!hasweapon(-narf narf)) addweapon -narf narf;


Not good in the control npc for anything besides System NPCs

falco10291029 06-19-2004 04:07 AM

yeh this is for setlevel2 but for some reason i cant get it to work if not in a wepon?

things like

if (actionserverside) {setlevel2 theplace.nw,2234,7980}
//clientw/e
if (weaponfired) {triggeraction 0,0,serverside,wepon}



but something like

if (actionserverside) {setlevel2 theotherplace.nw,3,-10}
//#CLIENTSIDE
if (w/e) {triggeraction 0,0,serverside,}



wont work (i kno the x and y in both are not able to work)

anyone know why?

xManiamaNx 06-19-2004 04:14 AM

Use actual scripts instead of junk like "if (w/e)" and stuff and then I'll help.

falco10291029 06-19-2004 04:18 AM

OK

NPC Code:

if (actionserverside) {
setlevel2 class.nw,30,30}
//#CLIENTSIDE
if (command) {triggeraction 0,0,serverside,}


wont work
NPC Code:

if (actionserverside) {
setlevel2 class.nw,30,30}
//#CLIENTSIDE
if (weaponfired) {triggeraction 0,0,serverside,warper}



will

osrs 06-19-2004 04:18 AM

Quote:

Originally Posted by falco10291029
yeh this is for setlevel2 but for some reason i cant get it to work if not in a wepon?

things like

if (actionserverside) {setlevel2 theplace.nw,2234,7980}
//clientw/e
if (weaponfired) {triggeraction 0,0,serverside,wepon}



but something like

if (actionserverside) {setlevel2 theotherplace.nw,3,-10}
//#CLIENTSIDE
if (w/e) {triggeraction 0,0,serverside,}



wont work (i kno the x and y in both are not able to work)

anyone know why?

You keep confusing yourself. Try reading this or the moderators will not be happy with you; (http://forums.graal2001.com/forums/s...ad.php?t=53241)

Your triggeraction is missing the weapon name and the parameter. (if there is no parameter, just let it empty). Something similiar to:

NPC Code:

if(actionserverside){
setlevel2 level.nw,30,30;
}

//#CLIENTSIDE

if(weaponfired){
triggeraction 0,0,serverside,WARPER,;
}



Make sure to replace WARPER by the name of the weapon; also you're missing the ; in the end of every execution line.

falco10291029 06-19-2004 04:19 AM

i mean it doesnt work if its not a wepon, what do you do then?

xManiamaNx 06-19-2004 04:23 AM

Since it's not a weapon you are triggering the action to the x of 0 and y of 0, not the npc's x and y. Also, end EVERY command with a ;

osrs 06-19-2004 04:24 AM

Quote:

Originally Posted by falco10291029
i mean it doesnt work if its not a wepon, what do you do then?

If it is a local npc (npc on level) just use setlevel2 serverside too.

NPC Code:

if(playertouchsme){
setlevel2 level.nw,30,30;
}

//#CLIENTSIDE

if(created) setimg block.png;




Is that what you're looking for?

falco10291029 06-19-2004 04:27 AM

ok so for a command thats not a weapon itll look like:

NPC Code:

if (actionserverside) setlevel2 class.nw,30,30;
//#CLIENTSIDE
if (flag) {triggeraction x,y,serverside,}


osrs 06-19-2004 04:55 AM

Quote:

Originally Posted by falco10291029
ok so for a command thats not a weapon itll look like:

NPC Code:

if (actionserverside) setlevel2 class.nw,30,30;
//#CLIENTSIDE
if (flag) {triggeraction x,y,serverside,}


You don't really need to use triggeraction in every script. Read my last post.

Note: You did not use ; in the end of the execution line again. :whatever:

Salaisuus 06-19-2004 06:36 AM

Quote:

Don't get rid of the npc server, you will find it very useful. Just get someone who can script to edit your npcs for use with the npc-server.
I wish.
Everyday I have people popping on my server asking for staff pos.
When ever I aks them if they can script they, for some reason, say "yes".
While I have come to notice they actually mean "No".

I wonder if I get flamed or something if I try to hire someone from these forums?

xManiamaNx 06-19-2004 06:55 AM

Welcome to Graal where a majority of the population act like stupid idiots, and will say they can do satuff that they really cant do just for power :)

falco10291029 06-19-2004 05:04 PM

Lol ok then i have a question, what flags will work serverside?

i know the following flags work:

playertouchsme

action-action-

seems a bit lacking, what others work serverside without using a triggeraction??

osrs 06-19-2004 05:33 PM

Quote:

Originally Posted by falco10291029
Lol ok then i have a question, what flags will work serverside?

i know the following flags work:

playertouchsme

action-action-

You will learn that while scripting; testing and fixing scripts is a good way. I would lose alot of time telling you what work serverside and what work clientside. (sounds and some images like gui's and personal systems are always good to keep on clientside)

Quote:

Originally Posted by falco10291029
seems a bit lacking, what others work serverside without using a triggeraction??

Triggeraction won't solve all your problems, you can do many things without use triggeraction.

Projectshifter 06-19-2004 06:26 PM

Quote:

Originally Posted by falco10291029
Lol ok then i have a question, what flags will work serverside?

i know the following flags work:

playertouchsme

action-action-

seems a bit lacking, what others work serverside without using a triggeraction??

Most things work both clientside and serverside. Because there is no actual creation of the NPC serverside, you can not do if (created) on the serverside, which is why most people call a triggeraction if (created) to perform the function serversided. The list of things that work both serverside and clientside is much larger than the list that won't work on one or the other, and it's best that you play with these things for yourself rather than ask people. Just go through, test the action and have it to sendtorc, simple as that. While we are generally very knowledgable at scripting, there are a million other things we focus on and have lives, so it's not always easy to remember a list of things that won't work, as most of them are easy enough to figure out. There are always multiple ways to perform the same task, so just play around with some scripts (don't EVER put timeout of .1 serverside or I will revoke this statement, lol) and you will have much better results than asking us a hundred questions.
-Projectshifter

falco10291029 06-19-2004 07:53 PM

Ok thaniks i thought that the list was very small since if i didnt put the //#CLIENTSIDE most scripts i made didnt work but thank you also one other thing, whats the command for if the person clicks with the left mouse? i thought it was if (leftmousebutton) but that never works

osrs 06-19-2004 08:18 PM

Quote:

Originally Posted by falco10291029
Ok thaniks i thought that the list was very small since if i didnt put the //#CLIENTSIDE most scripts i made didnt work but thank you also one other thing, whats the command for if the person clicks with the left mouse? i thought it was if (leftmousebutton) but that never works

Like what ProjectShifter said, there are many ways to do things on scripting, your question is a proof of that, because you can do it like this:
NPC Code:

if(mousedown && leftmousebutton){
setplayerprop #c,You used the left mouse button!;
}



Or even like this:
NPC Code:

if(mousedown && strequals(#p(0),left)){
setplayerprop #c,You used the left mouse button!;
}



You just forgot to use mousedown.
I think you should start from basic stuff, it is not that hard but is not that easy too for beginners. ^^

Lance 06-19-2004 09:24 PM

Quote:

Originally Posted by Projectshifter
Because there is no actual creation of the NPC serverside, you can not do if (created) on the serverside, which is why most people call a triggeraction if (created) to perform the function serversided.

Uh. You're thinking of weapons. You can obviously use the created event in other NPCs...

Projectshifter 06-19-2004 10:38 PM

Quote:

Originally Posted by Lance
Uh. You're thinking of weapons. You can obviously use the created event in other NPCs...

Heh, Lance just called me out on Debug about this =p Yes, it was in reference to weapons, as if you add a putnpc2 or so, that is created, database NPCs are created and such. Weapons were the topic (hence toweapons/addweapon being the subject), and weapons are not actually created serverside. Other than weapons, other NPCs can be created serverside, weapons are the only exception to this.
-Projectshifter


All times are GMT +2. The time now is 09:37 PM.

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