How do I limit items picked up by player (Gamebook)?

Another Gamebook question I suppose.

  1. How do I limit items picked up by the player?
    Ex. Player has a pocket for 2 items only. Player sees another item he/she can take but a message will say that he/she can no longer pick up an item unless he/she drops or uses the current ones he/she has. How will I do that?

  2. How do I upgrade their items?
    Ex. Player has a maximum of 2 items in his/her pockets. Then he/she decided to upgrade and so the maximum of items expands. Is that possible? If so, can anyone help me?

  3. How do I make it possible for players to change clothing, weapon, etc.?
    Ex. If player is wearing a current beltpouch that can contain 2 items and he/she sees a bigger beltpouch that can keep 3 items. So now player wants to take it and drop the current one he/she has. Is it possible to make that happen? Same thing for weapon. If player has a handgun with 12 ammo and player sees a handgun with 24 ammo, player would prefer that one. How do I do that?

Please help me. Thank you.


to do scripting in the Game Book:

[WHATEVER] Page Object -> 'Page' Tab -> Page Type: [script] or [script + text] -> (see below)

the two super scripts are the 'attribute' Script and the 'if' Script:


// Attribute Script:

add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below)

set variable NAME_OF_OBJECT.NAME_OF_ATTRIBUTE = [EXPRESSION] VALUE_OR_EXPRESSION

some examples:

set variable player.strength = [EXPRESSION] 0
set variable player.strength = [EXPRESSION] 100
set variable player.strength = [EXPRESSION] player.strength + 5

set variable player.alias = [EXPRESSION] "jessitayylor"
set variable player.alias = [EXPRESSION] "HK"

set variable player.poisoned = [EXPRESSION] false
set variable player.poisoned = [EXPRESSION] true

set variable game.introduction = [EXPRESSION] "hi, welcome to my game, I hope you enjoy it"

set variable game.state = [EXPRESSION] 0
set variable game.state = [EXPRESSION] 1
set variable game.state = [EXPRESSION] 2
set variable game.state = [EXPRESSION] 3


// the 'if' Script:

add new script -> 'scripts' section/category -> 'if' Script -> (see below)

if [EXPRESSION] CONDITIONAL_EXPRESSION

if [EXPRESSION] player.current_life <= 0
-> then -> add new script -> 'finish/end the game' Script

if [EXPRESSION] game.state = 3
-> then -> add new script -> WHATEVER script
else if [EXPRESSION] game.state = 2
-> then -> add new script -> WHATEVER script
else if [EXPRESSION] game.state = 1
-> then -> add new script -> WHATEVER script
else
-> add new script -> WHATEVER script

if [EXPRESSION] player.poisoned
-> then -> add new script -> print [EXPRESSION] "You ARE poisoned"
else
-> add new script -> print [EXPRESSION] "You're NOT poisoned"

if [EXPRESSION] player.alias = "HK"
-> then -> add new script -> print [EXPRESSION] "You are a really cool person"
else if [EXPRESSION] player.alias = "jessitayylor"
-> then -> add new script -> print [EXPRESSION] "you're jessitayylor"


Hi thank you again for replying.
I typed and set everything you said in Game > Script

player.strength = o
player.strength = 100
player.strength = + 5
player.alias = "jessitayylor"
player.alias = "HK"
player.poisoned = false
player.poisoned = true
game.introduction = "hi, welcome to my game, I hope you enjoy it"
game.state = 0
game.state = 1
game.state = 2
game.state = 3
if (CONDITIONAL_EXPRESSION) {
}
if (player.current_life <= 0) {
  msg ("End Game")
}
if (game.state = 3) {
  msg ("Game state 3")
}
else if (game.state = 2) {
  msg ("game state 2")
}
else if (game.state = 1) {
  msg ("Game state 1")
}
if (player.poisoned) {
  msg ("You are poisoned")
  msg ("You are not poisoned.")
}
if (player.alias = "HK") {
  msg ("Youre a really cool person")
}
else if (player.alias = "jessi") {
  msg ("Youre jessi")
}

What do I do next after?


(filler for getting my edited post, updated/posted)
(again, filler for getting my edited post, updated/posted)


those were just examples... and you don't want to do all of them (as they're just changing their values).... my bad....

it's going to take quite a bit of really specific and detailed instructions/explanations for what you want to do... I was only giving really simple quick examples of Attribute usage only... there's a lot more to it though...


let me try (somewhat) specifically at helping with just doing your #1:

How do I limit items picked up by the player?
Ex. Player has a pocket for 2 items only. Player sees another item he/she can take but a message will say that he/she can no longer pick up an item unless he/she drops or uses the current ones he/she has. How will I do that?


creating/adding/setting a 'current_inventory_quantity' and a 'maximum_inventory_quantity' Integer Attributes, and their initial Values, on the default 'player' Player Object:

'game' special/required Game Settings and Publishing Info Object -> 'start' Script -> (see below)

add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below)

set variable player.current_inventory_quantity = [EXPRESSION] 0

add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below)

set variable player.maximum_inventory_quantity = [EXPRESSION] 2


using the illusion of objects and transferring/moving objects:

via Attribute's values adjustment/changing/altering


for this example, let's also create a potion counter (pretty much the same as above):

'game' special/required Game Settings and Publishing Info Object -> 'start' Script -> (see below)

add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below)

set variable player.current_potion_quantity = [EXPRESSION] 0

add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below)

set variable player.maximum_potion_quantity = [EXPRESSION] 99

// note that our potion max quantity of 99 far exceeds our inventory max quantity of 2, we need to take this into account with our 'if' Script checking scripting that we'll cover below


// the illusion of "adding an object to our inventory", via incrementing our 'player.current_inventory_quantity' Integer Attribute, and its 'if' Script checking scripting:

'WHATEVER' Page -> Page Type: [script] or [script + text] -> (see below)

add new script -> 'scripts' section/category -> 'if' Script -> (see below)

if [EXPRESSION] player.maximum_potion_quantity > player.maximum_inventory_quantity

-> then -> add new script -> 'output (whatever)' section/category -> 'print a message' Script -> (see below)

print [EXPRESSION] "ERROR: your max potion quantity is greater than your max inventory quantity"

else if [EXPRESSION] player.current_inventory_quantity < player.maximum_inventory_quantity

-> then -> add new script -> 'scripts' section/category -> 'if' Script -> (see below)

-> if [EXPRESSION] player.current_potion_quantity < player.maximum_potion_quantity

->-> then -> add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below, repeat)

set variable player.current_inventory_quantity = [EXPRESSION] player.current_inventory_quantity + 1

set variable player.current_potion_quantity = [EXPRESSION] player.current_potion_quantity + 1

->-> add new script -> 'output (whatever)' section/category -> 'print a message' Script -> (see below)

Print [EXPRESSION] "You took the potion and put it into your inventory"

-> else

->-> add new script -> 'output (whatever)' section/category -> 'print a message' Script -> (see below)

Print [EXPRESSION] "You're at max quantity for potions (you must first remove a potion, before you can add another potion to your inventory)"

else

-> add new script -> 'output (whatever)' section/category -> 'print a message' Script -> (see below)

Print [EXPRESSION] "You're at max quantity for items (you must first remove an item, before you can add another item to your inventory)"

if (player.maximum_potion_quantity > player.maximum_inventory_quantity) {

  msg ("ERROR: your max potion quantity is greater than your max inventory quantity")

} else if (player.current_inventory_quantity < player.maximum_inventory_quantity) {

  if (player.current_potion_quantity < player.maximum_potion_quantity) {

    player.current_inventory_quantity = [EXPRESSION] player.current_inventory_quantity + 1
    player.current_potion_quantity = [EXPRESSION] player.current_potion_quantity + 1
    msg ("You took the potion and put it into your inventory")

  } else {

    msg ("You're at max quantity for potions (you must first remove a potion, before you can add another potion to your inventory)")

  }

} else {

  msg ("You're at max quantity for items (you must first remove an item, before you can add another item to your inventory)")

}

and you'd use another Page, doing nearly the same as above, for increasing your max quantity of your inventory:

'WHATEVER' Page -> Page Type: [script] or [script + text] -> (see below)

add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below)

set variable player.maximum_inventory_quantity = [EXPRESSION] player.maximum_inventory_quantity + 20


and you'd use another Page, doing nearly the same as above, for increasing your max quantity of your 'potions' in your inventory:

'WHATEVER' Page -> Page Type: [script] or [script + text] -> (see below)

add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below)

set variable player.maximum_potion_quantity = [EXPRESSION] player.maximum_potion_quantity + 11


and you'd use another Page, doing nearly the same as above, for decreasing your max quantity of your inventory:

'WHATEVER' Page -> Page Type: [script] or [script + text] -> (see below)

add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below)

set variable player.maximum_inventory_quantity = [EXPRESSION] player.maximum_inventory_quantity - 20


and you'd use another Page, doing nearly the same as above, for decreasing your max quantity of your 'potions' in your inventory:

'WHATEVER' Page -> Page Type: [script] or [script + text] -> (see below)

add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below)

set variable player.maximum_potion_quantity = [EXPRESSION] player.maximum_potion_quantity - 11


// and still doing the same thing for applying an event and its outcomes:

'WHATEVER' Page -> Page Type: [script] or [script + text] -> (see below)

add new script -> 'scripts' section/category -> 'if' Script -> (see below for a really stupid example, lol)

if [EXPRESSION] player.current_potion_quantity = 99

-> then -> add new script -> (see below, for a really stupid example)

print [EXPRESSION] "You win the game"

else

-> add new script -> (see below, for a really stupid example)

print [EXPRESSION] "You lose the game"


hopefully... this is enough... to help you get the idea of how to do this stuff... but there's a lot I left out or didn't get into....


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums