Using Quest CombatLib, (The Pixie's)

Xcrossovers
I 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

HegemonKhan
I 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:

<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
1. 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:
    <makedead type="script"><![CDATA[
if (not this.dead) {
this.alias = GetDisplayAlias (this) + " (dead)"
if (HasString (this, "lookwhendead")) {

Insert a new line it so it looks like this:
    <makedead type="script"><![CDATA[
if (not this.dead) {
player.xp = player.xp + this.xp
this.alias = GetDisplayAlias (this) + " (dead)"
if (HasString (this, "lookwhendead")) {

Give an attribute called "xp" to the player and every monster.

Xcrossovers
1. Yes they are set to healing potions, and the message does dislplay after drinking them, however the hits do not increase.
P.S. I have not edited the code for them at all. Edit: After closer inspection i found that the hp does change, but the hits are not updated until i am hit again by another monster ex. I get hit for 2 damage 28/30 hits left, drink healing potion, get hit for 3 damage 27/30 hits, so it is healing me its just not updating the ui till after i get hit again.

2. I inserted the code as you suggested, but as is nothing seems to happen, i have added the attributes, but the experience, and level still do not change after killing a monster, is there more i should add or just this? edit: I have gotten xp to work, but the character will not level up, it got to the point where i had 100198 xp and still had no level. Edit: the game adds the value of the xp behind the previous xp. Ex. 1+1=11.

maybe im just missing something, but i am pretty sure ive done everything you asked to the letter.

Xcrossovers
Nevermind i decided to go with the script you gave in the notes, but i edited the makedead script to go something like this for each individual "Boss monsters"

 firsttime {
CancelSpell
player.maxpoints = player.maxpoints + 5
LevelUp
msg ("YOU LEVELED UP!!!")
}


so that if the player faces a higher level monster before killing this monster when they come back they can still gain the "level" from this monster.
I doubt firsttime was necessary as you can kill a monster only once, but why not amirite? i decided to get rid of xp alltogether, as it was too complicated for my tiny brain. :roll: while this means ill have to edit every boss monsters makedead script, at least i can "level" the player without them gaining levels for simply walking around

thanks for the help.

The Pixie
Looking good.

You could make a boss type that inherits from monster, and have the new makedead script there. That is the beauty of types.

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

Support

Forums