Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Setting another users attributes? (https://forums.graalonline.com/forums/showthread.php?t=31524)

Shorty2Dope 06-13-2002 11:05 AM

Setting another users attributes?
 
How do you do it with NPC server or if it is possible, without NPC server.

ex: I want to set another users name. I would say "setname account 'name to give' "

I don't understand how it is possible to do.. if someone can just explain to me how its done and how each command works, that would be great :D

The only thing I know how to do is set the attributes of the player actually interacting with the NPC. I don't know how to tell the NPC to do something to someone else :(

Falcor 06-13-2002 11:37 AM

set it w/o the npcs server? you could use server.strings...

like set a string such as..

server.#a_attr //i use #a so it will be unique for all players.

and then give it a value like

setmp 0 //the space between setmp and 0 is used for tokenizing

then tokenize #a(server.#a_attr); in a weapon that the person that you wanna change has (such as maybe a system weapon) and then change his stuff accordingly.

he would check for a server.#a_attr string to be set for him to change his attributes and you could make the weapon he has do what you want.

tokenizing the string would give you 2 tokens

#t(0) = setmp
#t(1) = 0

you would read token 1 to see what you want to do (in this case, set mp)

so

if(strequals(#t(0),setmp)) {
yourcode;
delete the server string; //bc if you dont he gets more mp over and over
}

within your code for setting mp you could use the value of #t(1) to set his mp.

Saga2001 06-13-2002 12:44 PM

Quote:

Originally posted by Falcor
set it w/o the npcs server? you could use server.strings...

like set a string such as..

server.#a_attr //i use #a so it will be unique for all players.

and then give it a value like

setmp 0 //the space between setmp and 0 is used for tokenizing

then tokenize #a(server.#a_attr); in a weapon that the person that you wanna change has (such as maybe a system weapon) and then change his stuff accordingly.

he would check for a server.#a_attr string to be set for him to change his attributes and you could make the weapon he has do what you want.

tokenizing the string would give you 2 tokens

#t(0) = setmp
#t(1) = 0

you would read token 1 to see what you want to do (in this case, set mp)

so

if(strequals(#t(0),setmp)) {
yourcode;
delete the server string; //bc if you dont he gets more mp over and over
}

within your code for setting mp you could use the value of #t(1) to set his mp.

See pickles can solve problems too.
Kinda sad that I haven't posted here for 3-5 days and thats the first thing I think to post...*dissappointed in self*

Shorty2Dope 06-14-2002 01:44 AM

I still don't get what part of that is telling the NPC to set someone elses attributes. I would think that it would have some sort of command saying what account it sets it to. :(

Falcor 06-14-2002 02:42 AM

The whole point is getting data from one client to another. It first gotes through the server (hence, i used server strings) then it is read by the other client. What is ther to get? Everyone in their system NPC has a code to read their server string and do what it says..


when it reads the server string it will do commands like

setmp strtofloat(#t(1));
setplayerprop #C0,#t(1);

etc.

zallus-k 06-16-2002 08:21 AM

BTW, that 'setname' is not a good example. #n is a read-only attribute, so it wouldn't work on a non-NPCServed server.

jeff335 06-16-2002 08:51 AM

He wanted to know how to pass stuff from one client to another WITH the npc server, aka Admin NPC. You do it using with(getplayer(account))

mikepg 06-16-2002 09:58 PM

hmmm
 
The only thing wrong with that, is it would create a TON of server strings. It would be easier to do something like.....

setstring server.editplayer,#a,atribute,color/feature/value;

so

if (playerchats&&startswith(setplayer,#c)) {
// First account
// Second what youre editing
// value
// setplayer mikepg coat blue
tokenize #c;
setstring server.editplayer,#t(1),#t(2),#t(3);
}

in the client's system you'd want to have a timeout or some other action that reads in those variables constantly, checking to see if it's their account, and what features to change.


All times are GMT +2. The time now is 08:31 PM.

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