1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Item Scope

Discussion in 'Scripts' started by greatguys1, Aug 20, 2018.

  1. greatguys1

    greatguys1 Active Adventurer Developer Warriors of the North

    Apr 20, 2013
    As far as I know, items mostly need to be shared in their scope. In what cases, however, should the scope be client or server side only? I would think that information like name, desc, setmodel 'n stuff that would be in game_spawn would have to be shared.
  2. Thothie

    Thothie Administrator Staff Member Administrator Moderator Developer

    Apr 8, 2005
    Items are shared scope by default. It's a bit of a gray area, since most of the commands are server side, and send data to the client - but if you've looked at my item mod script (where you see insanity like "name $get(ent_me,name)", stuff does get weird sometimes. Unless you're certain you want to client only or server only, best to leave it shared on items. (Unlike Monsters which you want to be server side scoped nearly all the time.)

    This is also what lead to the "syncitem <item_id> <player_id>" crap, though you shouldn't have to worry about that, provided you don't do anything crazy, like trying to change the name/desc of items post-spawn or through an applyeffect.

    Items are also really funky with how they go about using their client side scripts - it doesn't quite work like an CLFX script, where there's a unique instance of it, but rather it responds to various client hard events from the owner (such as game_+attack, and <attack_data_callback>_start). So if you do want a CLFX script, best to clientevent it up separately and update it in the usual fashion, rather than attempting to integrate it into the item script's native client side.

    Best to start with modifying an existing item script, as making items from scratch is a royal pain. If you insist, however, base_weapon_new probably has the least number of odd base scripts to comb through, being largely self contained, aside from base_item and base_item_extras. Last bit of advice for making weapons from scratch would be: Don't fight against the weapon registration system - as much as I hate it, trying to work around it will cause endless headaches. Don't use game_attack unless you have no other choice.

Share This Page