A little bit of help for a beginner

Hey, I´m working on a game for quite some time now and have some questions

  1. First question is an easier one I think:
    How can i enable arrow-navigation for the player while still individualisitcly naming the rooms in the desription. (For example, when I rename "south" to "XYs room" then the arrow vanishes. How can I prevent this?
  2. I want to make fight possible and until now everything went well, the pistols shoot only if loaded, decrease the munition counter etc.
    But now I want to make the chance of hitting a target a certain percent level, depending on a player attribute. (So the hitting chance (percentage should be as high as the attribute "shooting skill"- but this doesnt work ;
  msg ("Nothing happens, there is no munition left")
}
else {
  DecreaseObjectCounter (Police Gun, "Munition")
  if (RandomChance( = Shooting)) {
    msg ("You hit the drone with the bullet and it falls from the sky.")
    DisableTimer (droneattack)
  }
  else {
    msg ("Your bullet misses the drone. You quickly aim again.")
  }
}```


you just got the syntax wrong for the 'RandomChance (NAME_OF_OBJECT.NAME_OF_INTEGER_ATTRIBUTE)' Script/Function:

http://docs.textadventures.co.uk/quest/functions/corelibrary/randomchance.html

I presume your 'player' Player Object has a 'Shooting' Integer Attribute:

if (RandomChance (player.Shooting)) {
  msg ("Successful shot")
} else {
  msg ("Failed shot")
}

conceptual examples:

player.Shooting = 0
if (RandomChance (player.Shooting)) { /* scripting */ } else { /* scripting */ }
// if (RandomChance (0)) { /* scripting */ } else { /* scripting */ }
// if (0%) { /* this will never occur */ } else { /* this will always occur */ }

player.Shooting = 25
if (RandomChance (player.Shooting)) { /* scripting */ } else { /* scripting */ }
// if (RandomChance (25)) { /* scripting */ } else { /* scripting */ }
// if (25%) { /* this will occur 1/4 of the time */ } else { /* this will occur 3/4 of the time */ }

player.Shooting = 50
if (RandomChance (player.Shooting)) { /* scripting */ } else { /* scripting */ }
// if (RandomChance (50)) { /* scripting */ } else { /* scripting */ }
// if (50%) { /* this will occur 1/2 of the time */ } else { /* this will occur 1/2 of the time */ }

player.Shooting = 75
if (RandomChance (player.Shooting)) { /* scripting */ } else { /* scripting */ }
// if (RandomChance (75)) { /* scripting */ } else { /* scripting */ }
// if (75%) { /* this will occur 3/4 of the time */ } else { /* this will occur 1/4 of the time */ }

player.Shooting = 100
if (RandomChance (player.Shooting)) { /* scripting */ } else { /* scripting */ }
// if (RandomChance (100)) { /* scripting */ } else { /* scripting */ }
// if (100%) { /* this will always occur */ } else { /* this will never occur */ }

Log in to post a reply.

Support

Forums