Hey, I´m working on a game for quite some time now and have some questions
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 */ }