Few problems that I stumble on [ANOTHER POST]

Y4T5UR0
19 Dec 2019, 16:11So I found several problems when doing my game project.
- I plan to have my own customized health attribute (in percentage) which should have been a result of the operation [Health] / [Max Health] * 100 but then the problem is, apparently Quest can't count something like this...
- I plan to increase the Max HP when the player levels up using a script, but then the problem is that the status attribute doesn't immediately update along with the "real" attribute, which is supposedly already raised by the time.
- Attack bonus possibilities: Usually in RPGs, there is something called "Critical hit". I wanted to apply this to my game, using the IFs script to apply on the Attack attribute, so the attack, in a possibility (let's say 10%), will be 5, but will be 4 for the rest 90%, but it doesn't work. Help meh please! (T - T)
Also, I wanted to make the monster attack after few seconds, but when I apply the script and run the game, what I get is instead me getting attacked repetitively even though the monster is dead :v
- Lastly, I want to create doors. Well, I hv checked some posts on the forums talking about doors and locks too, but it's not exactly what I want to do! (btw I set the doors to containers already)
I don't want the player to have the door automatically opened for them when they have the keys! I want the players to be independent when they have the keys! I want them to be given a choice if they want to open the door or not (only if they have the key)! If they answer yes, then the door will be unlocked and opened, and so is the exit!
But then Quest is just (No offense to the developers) too irritating that my blood pressure goes really high!
I tried using scripts or switches but then an error like: "Variable this and that is not found" (I mean, not literally) or like "String couldn't be converted into boolean" just keeps on appearing
Helph please...
My productivity has fallen so much, day by day, as more questions keep on popping
(Though I'm still grateful for being able to take out the code last time and not restarting my game making from the start. Thanks everyone :D)

Io
19 Dec 2019, 16:21- It should be able to. Odds are you have a Double/Integer error - can you post the actual error you get? Quest sometimes gets finicky combining 5.0+3 vs 5+3 vs 5.0+3.0.
- The Status attribute never updates automatically. If you have a status attribute displayed on the side, saying "Health: 30/50", then you need a changescript for BOTH the player's Health and MaxHealth:
game.WhateverYouCalledTheHealthStatusAttribute = Player.Health+"/"+Player.MaxHealth
- You say it doesn't work, but I don't know what you've tried so far to make it possible. Without knowing that, the best I can do is direct you to the function GetRandomInt(SomeLowerNumber, SomeHigherNumber).
Monster Delay vs Repeated Attacking - Without knowing more about your script itself I really can't help. It's possible you're running the "Wait X seconds and then do something" block, and then after-but-outside you have something else. So, in psuedocode:
wait 5 seconds and then{
// do thingA
}
do thingB
, the above which results in the code saying, "Alright, I'll wait 5 seconds to do thingA. Now let me just do thingB IMMEDIATELY. Alright 5 seconds passed, time for thingA now!"
- You have the Door object, and you can Open it. When you do, the game runs a script:
if (SomeKeyObject.parent=Player){
ShowMenu("Open the door?", Split("Yes-No", "-"), false){
if (result="Yes"){
//Do the stuff for opening the door.
}
else{
// Do the stuff for not yet opening the door.
}
}
}
else{
msg("You don't have the key")
}
Like always, I have to type out what it is in code-view, but it becomes more understandable once you copy-paste and convert to regular view. Hope this helps!
Lastly, don't worry about productivity. My latest game, I had to completely scrap 3 times because I kept finding I didn't know enough about Quest to make the game I'd envisioned. It was only on attempt 4 I could put things together right.
hegemonkhan
19 Dec 2019, 16:31- here's a guide on doing min-max stuff for your 'statusattributes' functionality:
http://textadventures.co.uk/forum/quest/topic/5387/i-really-need-help#37375
- critical hit:
I'm using the 'RandomChance (XXX)' Function/Script, so this requires that your parameter's argument/input/value/attribute's_value/variable's_value be in the range/bounds of 0 to 100)
https://docs.textadventures.co.uk/quest/functions/corelibrary/randomchance.html
for example: player.luck = GetRandomInt (0,100)
example usage (likely in your combat/attack coding):
// create ("katana")
// katana.damage = 50
// player.weapon = katana
// player.luck = GetRandomInt (0,100)
player.damage = player.weapon.damage * critical_hit_function (player.luck)
// player.damage = [50] * [either: 2 or 1]
// player.damage = [either: 100 or 50]
// orc.current_life = orc.current_life - player.damage
<function name="critical_hit_function" parameters="integer_attribute_parameter" type="int">
if (RandomChance (integer_attribute_parameter)) {
critical_hit_modifier_integer_variable = 2
} else {
critical_hit_modifier_integer_variable = 1
}
return (critical_hit_modifier_integer_variable)
</function>
hegemonkhan
19 Dec 2019, 16:45PS, here's some help/guides on learning quest and its coding:
http://textadventures.co.uk/forum/general/topic/ljjm32av4e2t9ot49k478g/help#710be61e-eae1-4af1-8363-520cc718ba1c
ask if you need any help or explanation with anything

Y4T5UR0
19 Dec 2019, 17:01Thanks a lot for the quick reply >_<
@Io Owh I think it's because I used string. Am I supposed to use integer/double? :v
Alright. Will keep your advice in mind.
(I'll get through the details tom. It's getting late here)

Io
19 Dec 2019, 17:03Yep, integer/double. In code view, it's the difference between "5" and 5.
Quest can no more divide "5" by 10 than it can divide "Fox" by 10.

Y4T5UR0
19 Dec 2019, 17:10Btw hegemonkhan, as for the link you posted for my third problem, I did exactly that with the IF script, by using the percentage random chance.
But then there's an error saying sth like "LazyLoadScript" or sth
hegemonkhan
19 Dec 2019, 17:12there's lot of issues with using doubles (floats / floating points / decimals / fractions) and integers (non-decimals / non-fractionals) together: rounding (truncation vs upper/lower, precision, etc) and etc issues... (programming calculators... is a lot of "fun"... lol)
it's really better if possible to only use integers... though this can be challenging as well... meh... math is messy and hard, lol
Amount (able to do arithmetic:addition/subtraction/multiplication/division/modulus, upon them) Data Types:
Integers: ..., -999, 0, 999, ...
Doubles: ..., -999.999, 0.0, 123.1, ...
NON-Amount (NOT able to do arithmetic upon them) Data Types:
Strings (able to do concatenation upon them): "a", "abc", "1", "123", "true", "orc", "abc_123", "hi, how are you? my name is hk, what is your name?"
Booleans: true/false
and other Data Types

Y4T5UR0
19 Dec 2019, 17:17@Io
Oof
Thank you so much :v
So I'll just have to do ! % on the status rite
mrangel
19 Dec 2019, 22:33For the percentage health, you might want 100 * health / maxhealth
.
Putting health / maxhealth * 100
, I would expect it to divide health by maxhealth, round it to an int (getting 1 if you're on full health and 0 otherwise) and then multiply by 100 to get either 100 or 0.

Dcoder
20 Dec 2019, 01:16Or use parentheses:
(health * 100) / maxhealth

Y4T5UR0
21 Dec 2019, 00:10It's working now. Thanks.
I'm still confused about the WAIT script and CRITICAL ATTACK though...

Io
21 Dec 2019, 00:20Well again, short of seeing your code there's not much we can help with wait. As for critical though, try something like:
if (RandomChance(25)) {
Player.Damage=Player.Damage*2
//We had a 25% chance to crit, and we did, doubling our damage
}
else{
//We failed and nothing happens
}

Y4T5UR0
21 Dec 2019, 00:54Here's my script:
if (Snake_1.Active = true) {
firsttime {
msg ("You make the first move and charge towards the snake")
}
Snake_1.Health = Snake_1.Health - You.Attack
msg ("You inflict {You.Attack} damage to Snake (Lv.5)!\"")
if (Snake_1.Active = true) {
You.Health = You.Health - Snake_1.Attack
msg ("You receive {Snake_1.Attack} damage!")
}
}
else if (Snake_1.Active = False) {
msg ("It's dead already, smh.")
}

Io
21 Dec 2019, 01:37So what you'd want is to have a script to change You.Attack based on whether you crit or not, and insert that before
Snake_1.Health = Snake_1.Health - You.Attack
but after your firsttime script.
jmnevil54
21 Dec 2019, 03:39I recommend looking at ThePix's Zombie Apocalypse game. Otherwise, I would need to see the whole code of your game.