Using Quest CombatLib, (The Pixie's)
Xcrossovers
30 Apr 2016, 19:08I have had some problems with the combat libraries i recieved from The Pixie, I will list my problems, and any help with these will be greatly appreciated.
1. Using healing potions.
When using a healing potion in-game hp does not change, i am not sure if i need to input a value for the health given by the potion or if this is just bugged.
2. Leveling the player.
I would like to allow the player to gain exp after killing a monster, but the library states that it does not track exp, so how could i go about adding an exp tracking, and leveling system?
These are the only questions i have as of now, any help from the coding pro's on this forum would be great.
Here is a link to the Combat Library i am currently using in case you need to download it: http://forum.textadventures.co.uk/viewtopic.php?f=18&t=4886
1. Using healing potions.
When using a healing potion in-game hp does not change, i am not sure if i need to input a value for the health given by the potion or if this is just bugged.
2. Leveling the player.
I would like to allow the player to gain exp after killing a monster, but the library states that it does not track exp, so how could i go about adding an exp tracking, and leveling system?
These are the only questions i have as of now, any help from the coding pro's on this forum would be great.
Here is a link to the Combat Library i am currently using in case you need to download it: http://forum.textadventures.co.uk/viewtopic.php?f=18&t=4886
HegemonKhan
30 Apr 2016, 19:49I don't know Pixie's Combat Library (haven't had the time to look at it yet), but maybe I can be of some help...
you can't just add a library file to your game, you need your game to have (and match up the names/labels too) all the required stuff that the library needs, implemented in the game. Think of most library files as just "patches, xpacs, or add-ons" to your own game, adding/building-on/in more stuff to it only, that is why the game has to be set up (and matched up) to work with the library (or vice-versa: the library has to be set up, and matched up, to work with your game). For example: if you created a 'life' Integer Attribute on/for your player in your game, but the library uses a 'hp' Integer Attribute for the player, you got a mismatch of named/labeled Attributes (life =/= hp), when they're suppose to be the same Integer Attribute for the player.
1. if it's not an error with the library, you likely (if you're new to quest and/or programming) need to toggle on the built-in 'health' Attribute/system or create your own 'health/life/hp/whatever' Integer (int) Attribute/ystem (not sure what Pixie's library uses): if your player has no 'health/life/hp' Integer Attribute, thenn the health/life/hp potions and their 'health/life/hp' Integer Attribute can't be adding their value-amounts to your player's 'health/life/hp' value-amount:
the how the 'health/life/hp' potion (in this example, it's a +50 life potion) Object's Verb's scripting should look (using my own Attribute names/labels), but you can use whatever you want for your names/labels for your Attributes):
player.current_life = player.current_life + 50
in code, in ~full, a simple sample example:
so, if you never either: created/added a 'life/health/hp' Integer Attribute on the player or toggled on the built-in 'health' Attribute:
________ = _________ + 50
obviously, you got an error or no health/life/hp increase, as you're missing most of the script to do it ...
2. aside from creating an 'experience' and 'level' Integer (int) Attributes, here's a formula-code that I like for handling leveling up (this is just for level increasing, not stat choosing/raising):
here's how it does the leveling in game:
your current level ~ total experience needed for next level
0 ~ 100
(your experience - 100)
1 ~ 200
(your experience - 200)
2 ~ 300
(your experience - 300)
3 ~ 400
(your experience - 400)
etc etc etc
in other words, each new level requires +100 more experience than the last level did (however, this doesn't mean you'll be leveling up every +100 experience you get, lol, as the amount of experience you needed for that level is subtracted from your experience: so, only your extra/remaining experience carries over for the next level)
so, with the code formula, it works like this:
say you kill a monster and it gives you 100 experience, that would increase your level from 0 to 1, and it subtracts 100 from your experience (100), thus having you be at 0 experience (100-100), needing +200 experience for level 2
(starting over from level 0, not continued from above example)
say you kill a monster and it gives you 400 experience, that would increase your level from 0 to level 2, leaving you with only 100 experience left, requiring +200 experience for level 3: 400 - 100 = 300 experience (you're level 1 now) - 200 experience (you're level 2 now) = 100 experience left (you need +200 more experience to reach level 3)
(starting over from level 0, not continued from above examples)
say you kill a monster and it gives you 600 experience, that would increase your level from 0 to level 3, leaving you with only 0 experience left, requiring +400 experience for level 4: 600 - 100 = 500 experience (you're level 1 now) - 200 experience (you're level 2 now) = 300 experience - 300 experience (you're now level 3) = 0 experience (you need +400 experience for level 4)
this formula works for whatever level you're at, I just used level 0 to explain it
I like this formula, as it's a very reasonable needed experience incrementing for next level, not too much much and not too little, for me, just perfect.
----------------
here's a link that explains Attributes and the 'if' Script:
viewtopic.php?f=18&t=5559
ask if you need any help or explanation of anything.
you can't just add a library file to your game, you need your game to have (and match up the names/labels too) all the required stuff that the library needs, implemented in the game. Think of most library files as just "patches, xpacs, or add-ons" to your own game, adding/building-on/in more stuff to it only, that is why the game has to be set up (and matched up) to work with the library (or vice-versa: the library has to be set up, and matched up, to work with your game). For example: if you created a 'life' Integer Attribute on/for your player in your game, but the library uses a 'hp' Integer Attribute for the player, you got a mismatch of named/labeled Attributes (life =/= hp), when they're suppose to be the same Integer Attribute for the player.
1. if it's not an error with the library, you likely (if you're new to quest and/or programming) need to toggle on the built-in 'health' Attribute/system or create your own 'health/life/hp/whatever' Integer (int) Attribute/ystem (not sure what Pixie's library uses): if your player has no 'health/life/hp' Integer Attribute, thenn the health/life/hp potions and their 'health/life/hp' Integer Attribute can't be adding their value-amounts to your player's 'health/life/hp' value-amount:
the how the 'health/life/hp' potion (in this example, it's a +50 life potion) Object's Verb's scripting should look (using my own Attribute names/labels), but you can use whatever you want for your names/labels for your Attributes):
player.current_life = player.current_life + 50
in code, in ~full, a simple sample example:
<object name="player">
<attr name="current_life" type="int">500</attr>
<attr name="maximum_life" type=999</attr>
<attr name="changedcurrent_life" type="script"><![CDATA[
if (player.current_life <=0) {
msg ("You're dead or you've died or you were killed.")
msg ("GAME OVER")
finish
} else if (player.current_life > player.maximum_life) {
player.current_life = player.maximum_life
}
]]></attr>
</object>
<object name="life_50_potion">
<attr name="alias" type="string">life potion</attr>
<attr name="drink" type="script">
player.current_life = player.current_life + 50
</attr>
<attr name="displayverbs" type="simplestringlist">look; take; drink</attr>
<attr name="inventoryverbs" type="simplestringlist">look; drop; drink</attr>
</object>
<verb>
<property>drink</property>
<pattern>drink</pattern>
<defaultexpression>You can't drink that.</defaultexpression>
</verb>
so, if you never either: created/added a 'life/health/hp' Integer Attribute on the player or toggled on the built-in 'health' Attribute:
________ = _________ + 50
obviously, you got an error or no health/life/hp increase, as you're missing most of the script to do it ...
2. aside from creating an 'experience' and 'level' Integer (int) Attributes, here's a formula-code that I like for handling leveling up (this is just for level increasing, not stat choosing/raising):
<function name="leveling_function">
if (player.current_experience >= player.current_level * 100 + 100) {
player.current_experience = player.current_experience - (player.current_level * 100 + 100)
player.current_level = player.current_level + 1
leveling_function
}
</function>
here's how it does the leveling in game:
your current level ~ total experience needed for next level
0 ~ 100
(your experience - 100)
1 ~ 200
(your experience - 200)
2 ~ 300
(your experience - 300)
3 ~ 400
(your experience - 400)
etc etc etc
in other words, each new level requires +100 more experience than the last level did (however, this doesn't mean you'll be leveling up every +100 experience you get, lol, as the amount of experience you needed for that level is subtracted from your experience: so, only your extra/remaining experience carries over for the next level)
so, with the code formula, it works like this:
say you kill a monster and it gives you 100 experience, that would increase your level from 0 to 1, and it subtracts 100 from your experience (100), thus having you be at 0 experience (100-100), needing +200 experience for level 2
(starting over from level 0, not continued from above example)
say you kill a monster and it gives you 400 experience, that would increase your level from 0 to level 2, leaving you with only 100 experience left, requiring +200 experience for level 3: 400 - 100 = 300 experience (you're level 1 now) - 200 experience (you're level 2 now) = 100 experience left (you need +200 more experience to reach level 3)
(starting over from level 0, not continued from above examples)
say you kill a monster and it gives you 600 experience, that would increase your level from 0 to level 3, leaving you with only 0 experience left, requiring +400 experience for level 4: 600 - 100 = 500 experience (you're level 1 now) - 200 experience (you're level 2 now) = 300 experience - 300 experience (you're now level 3) = 0 experience (you need +400 experience for level 4)
this formula works for whatever level you're at, I just used level 0 to explain it
I like this formula, as it's a very reasonable needed experience incrementing for next level, not too much much and not too little, for me, just perfect.
----------------
here's a link that explains Attributes and the 'if' Script:
viewtopic.php?f=18&t=5559
ask if you need any help or explanation of anything.
The Pixie
30 Apr 2016, 20:521. I am not aware of any issues with healing potions. It should just heal you up to max. Do you get the message "You drink the healing potion, and suddenly you feel fine."? Have you set it to be a healing potion rather than a potion? On the combat tab, the only thing to set besides the type should be the cost; is that what you see?
2. Probably the best way to do XP would be to edit the "makedead" script in the file CombatTypes.xml. There is a bit like this:
Insert a new line it so it looks like this:
Give an attribute called "xp" to the player and every monster.
2. Probably the best way to do XP would be to edit the "makedead" script in the file CombatTypes.xml. There is a bit like this:
<makedead type="script"><
thanks for the help.
The Pixie
08 May 2016, 19:45Looking good.
You could make a boss type that inherits from monster, and have the new makedead script there. That is the beauty of types.
You could make a boss type that inherits from monster, and have the new makedead script there. That is the beauty of types.