Source-X icon indicating copy to clipboard operation
Source-X copied to clipboard

Discussion: Server layers system

Open Tolokio opened this issue 2 years ago • 4 comments

There are some times where I need to store items somewhere. In thoose cases I need to create a container and put it on the map. Or I can create an account with a player that store all that stuff on his bank. But this may cause many errors, as the container can be removed and mess all the script.

How do u see to create a server's layer or something like that? So we could use that as general storage container.

//Example:
[typedef ei_never_lose_this_item]
on=@destroy
cont=<serv.storage1>
return 1

//Another example (for the stable system problems where pets are removed if StableMaster is killed.)
//this script would get pets into <serv.storage1> and get pets back once a new stableMaster Spawn.

[chardef stable_master]

on=@death
serv.newitem i_backpack
ref1 <new.uid>
FORCONT <FINDLAYER.29.UID>
     local.pets ++
     cont=<ref1.uid>
endfor
if (<local.pets>)
    ref1.cont=<serv.storage1>
    ref5=<spawnItem>
    ref5.tag.PetsAtContainer=<ref1.uid>
else
    ref1.remove
endif

on=@create
if <spawnItem>
     ref1=<spawnitem>
     ref2=<ref1.tag.PetsAtContainer>
     ref3=<uid>
     if <ref2.isvalid>
          forcont <ref2.uid>
               cont=<ref3.findlayer.29.uid>
          endfor
          ref2.remove //remove container as it is no longer needed.
          ref1.tag.PetsAtContainer  //remove tag as it is no longer needed.
     endif
endif

Tolokio avatar Feb 06 '24 18:02 Tolokio

I thonk how layer are designed must be on a char. I dont think its possible to place a layer on server itself.

Jhobean avatar Feb 06 '24 22:02 Jhobean

Dosnt have to be a layer's system, just some kind of storage's system. Maybe I shouldnt use the word "layer". But the idea comes from layer system.

<serv.storage1> not <serv.findlayer.1>

Tolokio avatar Feb 06 '24 23:02 Tolokio

Instead, would more than one bank account work for one account/character?

The serv.findlayer.1 function can be a bit complicated. More possible alternative methods can be considered.

The first alternative solution that comes to my mind is;

like src.house.0.uid / src.houses.count etc.

There could be a property like src.bank.0.uid/src.banks to have multiple storages for a character and add a multi like

There may be virtual banks that can be added or removed as SRC.ADDBANK / SRC.DELBANK <uid>/<id>.

canerksk avatar Feb 25 '24 01:02 canerksk

Now there's LAYER_STORAGE for player related stuff. Any other ideas would require another issue, but we can use this one for discussion. The ADDBANK idea is fine in itself, though one might say, what about being able to create any number of global or char-specific containers? Moreover, should those be limited to player characters or also NPCs should have them?

cbnolok avatar Jul 31 '24 12:07 cbnolok