1. If you have a problem and need help, create a new thread with a title that briefly describes the problem.
    Do not use titles like 'Help!' or 'I have a problem!'
    Dismiss Notice
  2. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

How do i make the shop where can i buy gold, stone or wood?

Discussion in 'Server Help' started by 34ever, May 16, 2012.

  1. 34ever

    34ever Catapult Fodder

    Messages:
    8
    i have see many servers with this shops, but i dont know how to do same..

    help me pleasee..:QQ:
     
  2. Boxpipe

    Boxpipe single, female, lawyer

    Messages:
    293
    Rooms can be edited by modifying configs in here or creating a new room config:
    KAG\Base\Entities\Rooms\
    (For the sake of this post lets call the room config "myroom.cfg")


    Within myroom.cfg you will see a line of code that reads:

    Code:
    [...]
    # room syntax - room name; room level (0 menu - 1... upgrade); room sprite; room help text; room items/functions, item2, item3 ...; costs , , , (g gold, s stone, w wood, c coins, l level, u upgrades_from, r requires_roomname - none) ...
    @$rooms =
    [...]
    
    This is where you list the name of your shop, room sprite, the help text, items within etc.

    Now wherever in the list you please you can name a resource shop within there that will most likely look like this:

    Code:
    [...]
    RESOURCE SHOP; Entities/Rooms/Sprites/Bank.png; Hold $KEY7$ to buy Wood, Stone and Gold.; buywood, buystone, buygold, sellgold; w0, c0;
    [...]
    
    Next you will need to declare what the "buywood" "buystone" "buygold" and "sellgold" functions do, such functions are declared under this line.

    Code:
    [...]
    # room_function syntax - function name; function actor name; function config file; function icon; function make sound; function icon frame; function icon frame size; function help text; costs , , , (g gold, s stone, w wood, c coins - none) ...
    @$room_functions =
    [...]
    
    Again wherever in the list you please you can declare the function's names, what config file the function is using, the function's icon, sound etc. An example of the "buywood" "buystone" "buygold" and "sellgold" functions being declared:

    Code:
    [...]
    buywood; -; -; Entities/Items/Sprites/MaterialStacks.png; Entities/Rooms/Sounds/ArrowsMake.ogg; 5; 16; Buy Wood; w-20, c10;
    buystone; -; -; Entities/Items/Sprites/MaterialStacks.png; Entities/Rooms/Sounds/ArrowsMake.ogg; 2; 16; Buy Stone; s-20, c10;
    buygold; -; -; Entities/Items/Sprites/MaterialStacks.png; Entities/Rooms/Sounds/ArrowsMake.ogg; 8; 16; Buy Gold; g-10, c20;
    sellgold; -; -; Entities/Items/Sprites/MaterialStacks.png; Entities/Rooms/Sounds/ArrowsMake.ogg; 8; 16; Buy Gold; g10, c-20;
    [...]
    
    Notice that each function declaration has to be on it's own line and each line is ended with an ";".
    This should help (without going into specifics) you add a resource shop (or any other kind of shop) into your server, as well look for comments placed around the file, they help explain some of the preexisting variables already used. (Anything starting with an "#" is a comment and thus does not affect the code).

    Example of a normal CTF room .cfg edited to implent a resource shop:

    Code:
    # Workshop config file
    # $ string
    # @ array
     
    # sprite
     
    $sprite_factory = room_sprite
     
    $sprite_texture = Entities/Rooms/Sprites/EmptyRoom.png
    s32_sprite_frame_width = 24
    s32_sprite_frame_height = 24
    $sprite_sound_death_hit =
    $sprite_sound_flesh_hit = Sounds/pick_wall?.ogg
    $sprite_sound_die = Sounds/destroy_wall.ogg
    $sprite_sound_spawn = Entities/Rooms/Sounds/ConstructShort.ogg
    $sprite_sound_gib = Entities/Rooms/Sounds/DestroyRoom.ogg
    $sprite_sound_emit =
     
        $sprite_gibs_start = *start*
     
        $gib_type = static_particle
        $gib_file = Entities/Rooms/Sprites/RoomGibs.png
        u8_gib_count = 9                    #number of gibs
        u8_gib_style = 0                    #column
        u8_frame_width = 8;
        u8_frame_height = 8;
        @u8_gib_frame = 1; 2; 3; 4; 5; 6; 7;    #row
        $gib_collide_sound = Sounds/rock_hit?.ogg
        f32_gib_mass = 2.5
        u8_gib_emit = 255                    #nothing
        f32_velocity = 12.0
        f32_offset_x = 0.0
        f32_offset_y = 0.0
     
        $sprite_gibs_end = *end*
     
    f32_blood_multiplier = 8.0
    clr_blood_color = 255; 50; 40; 30
     
      $sprite_animation_start = *start*
     
      # default
      $sprite_animation_default_name = default
      u16_sprite_animation_default_time = 1
      u8_sprite_animation_default_loop = 0
      @u16_sprite_animation_default_frames = 0;
     
      $sprite_animation_end = *end*
     
    # light
    f32_light_radius = 50.0
    clr_light_color = 255; 255; 240; 171
    1_light_default_on = 0
    # room
    $sprite_sound_build = Entities/Rooms/Sounds/Construct.ogg
     
    # ball
     
    $ball_factory = room_ball
     
    f32_ball_width = 24.0
    f32_ball_height = 24.0
    f32_ball_radius = 12.0
    f32_ball_max_upspeed = 0.0
    f32_ball_max_fallspeed = 0.0
    f32_ball_max_airspeed = 0.0
    f32_ball_max_groundspeed = 0.0
    f32_ball_max_actionspeed = 0.0
    f32_ball_gravity = 0.0
    f32_ball_ground_slide = 0.0
    f32_ball_wall_slide = 0.0
    f32_ball_ladder_slide = 0.0
    f32_ball_ground_bounce = 0.0
    f32_ball_wall_bounce = 0.0
    1_ball_opens_doors = 0
    1_ball_opens_bridges = 0
     
    # unused
     
    $movement_factory =
    $weapon_factory =
    $brain_factory =
     
    # general
     
    $name =
    f32_health = 3.0
    f32 gib_health = -2.5
    $help_text = Hold $KEY7$ and\nselect workshop\nto build
     
    u8_default_room = 0
     
    # room syntax - room name; room level (0 menu - 1... upgrade); room sprite; room help text; room items/functions, item2, item3 ...; costs , , , (g gold, s stone, w wood, c coins, l level, u upgrades_from, r requires_roomname- none) ...
    @$rooms = BOMB WORKSHOP; Entities/Rooms/Sprites/BombShop.png; Press $KEY7$ to buy bombs; bomb; w50;   
              QUARTERS; Entities/Rooms/Sprites/Quarters.png; Wait inside to heal; heal; w50;
              ARROW WORKSHOP; Entities/Rooms/Sprites/ArrowShop.png; Press $KEY7$ to make arrow; arrow; w50;
              SIEGE WORKSHOP; Entities/Rooms/Sprites/SiegeShop.png; Press $KEY7$ to build\ncatapult or outpost; catapult, outpost; w50, g30;
    RESOURCE SHOP; Entities/Rooms/Sprites/Bank.png; Hold $KEY7$ to buy Wood, Stone and Gold.; buywood, buystone, buygold, sellgold; w50, c5;
              ;
     
    # room_function syntax - function name; function actor name; function config file; function icon; function make sound; function icon frame; function icon frame size; function help text; costs , , , (g gold, s stone, w wood, c coins - none) ...
    @$room_functions = bomb; -; -; Entities/Items/Sprites/MaterialStacks.png; Entities/Rooms/Sounds/BombMake.ogg; 12; 16; Bomb costs 20 coins; c20;
                      arrow; -; -; Entities/Items/Sprites/MaterialStacks.png; Entities/Rooms/Sounds/ArrowsMake.ogg; 10; 16; Arrow cost 1 coin; c*10;
                      catapult; -; -; Sprites/catapult.png; d; 0; 32; Construct a Catapult; w120, c20;
                      outpost; -; -; Sprites/outpost1.png; d; 0; 32; Construct an Outpost; w120, c50;
                      heal; -; -; -; Sounds/heart.ogg; 0; 0; Healing 2 coins per 1/2 heart; c2;
    buywood; -; -; Entities/Items/Sprites/MaterialStacks.png; Entities/Rooms/Sounds/ArrowsMake.ogg; 5; 16; Buy Wood; w-20, c10;
    buystone; -; -; Entities/Items/Sprites/MaterialStacks.png; Entities/Rooms/Sounds/ArrowsMake.ogg; 2; 16; Buy Stone; s-20, c10;
    buygold; -; -; Entities/Items/Sprites/MaterialStacks.png; Entities/Rooms/Sounds/ArrowsMake.ogg; 8; 16; Buy Gold; g-10, c20;
    sellgold; -; -; Entities/Items/Sprites/MaterialStacks.png; Entities/Rooms/Sounds/ArrowsMake.ogg; 8; 16; Buy Gold; g10, c-20;
                      ;
               
    # - nothing
    # - in room_functions as texture = don't add to menu - collide function
    # d default build sound           
    # c*10 - buy as much as possible, max 10
    
     
    Robinskie, Noc, 34ever and 2 others like this.
  3. 34ever

    34ever Catapult Fodder

    Messages:
    8
    Thank you, sir!