I'm..I'm afraid I have juuust a few more stupid questions. xDD; This is kinda the last few things I have to figure out beforehand, so I shouldn't be troubling you after this.
1) I implemented a battle condition that drops a random amount of money at the end of a battle. It gets called fine in the first battle. In the boss battle (I'm just using the demo battles with minor alterations to test features), however, it never gets called. It's quite puzzling, since I'm pretty sure I set it up the same way both times.
Here's the code for that, if it helps:
Code: Select all
#stored in char_stats.rpy
$drop_loot = AnyCondition()
$drop_loot.AddCondition(FactionDestroyedCondition('Enemies'))
$drop_loot.AddResult(CallLabelInNewContextResult('calc_loot'))
label calc_loot:
$loot_gain= avg_level * renpy.random.randint(20, 50)
"Received %(loot_gain)d coins!"
$money+= loot_gain
return
#stored in battle_def.rpy in python block before battle declared. Shouldn't matter, as levelplans are stored the same way and seem to be accessed just fine.
avg_level = cadfael.Stats.Level + clone.Stats.Level/2
I'm calling it both times by adding the condition to the battle, so I'm not sure why the second one isn't going.
2)The game is quite linear, so backtracking, and thus grinding if boss is too hard to beat, is not possible. I'm making up for this by having a gym in each town, where all the stats can be buffed (within reason). All of them have come along quite smoothly save for XP. I'm really not sure how to even approach this. Directly upping the stat causes the game to think it's in battle, which is a bit inconvenient. I'd just like to know if there's a way to do this. XD;
3) Last one. :'D Kinda came out of nowhere. Basically the equipment screen, which I copied directly from the demo for now, is throwing up an error. Specifically, interacting with a non-empty widget or stack. There's seemingly no cause, as I haven't altered it in any way before it started doing this.
So most of the code in the equip screen proper is the same. Only thing different is how it's called via ui button.
Code: Select all
init:
$ money_disp = None
$equip_button_on=False
python hide:
def money_overlay():
if money_disp:
ui.text ("Money:" + str(money_disp),
xpos=0.0, xanchor="left",
ypos=0.0, yanchor="top")
config.overlay_functions.append(money_overlay)
def equip_button():
if equip_button_on:
ui.textbutton(_("Equipment"),
xpos=0.98, ypos=0.02,
xanchor='right', yanchor='top',
clicked=renpy.call_in_new_context('equipment'))
config.overlay_functions.append(equip_button)
My only guess is the "sell" screen is interfering with it. Again, I don't know why. I have modified it, but one of the modifications was undoing those modifications. It should be better now. So I'm a bit lost. Here's that, if it helps. A lot of the stuff here is just placeholder, I really want to figure out how to get it working, first. xD;;
Store.rpy (handles interacting with the salesperson)
Code: Select all
label store:
$money_disp=money
s "Welcome! How can I help you?"
jump store_menu
label store_menu:
menu:
"Buy":
jump buy_what
"Sell":
jump sell
"Nevermind":
jump store_leave
label buy_what:
s "What would you like to buy?"
menu:
"Potion - %(potion_price)d coins":
$item = "potion"
jump quantity
label store_total:
s "That will be %(total_price)d coins, please!"
$money-=total_price
$money_disp=money
jump store_thanks
label store_thanks:
$money_disp=money
$equip_button_on=False
s "Thank you for your patronage! Is there anything else I can do for you?"
jump store_menu
label store_leave:
s "Alright then. Drop by any time!"
$money_disp=None
jump go_where
#once again, the return will be replaced with a jump back to town
label quantity:
$ quant = renpy.input("And how many will that be?")
$ quant = int(quant.strip())
jump purchase
label purchase:
if item=="potion":
$inv.AddItem(Library.Items.Potion, quant)
$total_price = potion_price * quant
jump store_total
label sell_price:
s "I can give you %(item_worth)d coins for this. Is that ok?"
menu:
"Yes":
jump sell_item
"No":
s "Ok then. Is there anything else I can do?"
menu:
"Yes":
jump store_menu
"No":
jump store_leave
return
Sell.rpy (handles selecting item to sell from equipment)
Code: Select all
label sell:
python:
finished = False
while finished == False:
ui.window(style=style.BattleMenuWindow, xmaximum=700, xminimum=700, ymaximum=500, yminimum=500)
# Three layout rows - one for the prev/next buttons, one for the equipment controls,
# one for a 'done' button.
vp=ui.viewport(draggable=True, ymaximum=400)
ui.vbox()
for e in equipment:
ui.textbutton(_(e.Name),
clicked=ui.returns(('sell',e)), style=style.BattleMenuButton)
ui.close()
# End of equipment list items
ui.bar(adjustment=vp.yadjustment, style=style.vscrollbar, ymaximum=400, yminimum=400)
# End of right panel
# End of two columns of equipment
ui.textbutton('Done', clicked=ui.returns( ('done', None) ), style=style.BattleButton, xalign=0.5)
# End of two layout rows
result = ui.interact()
command=result[0]
param = result[1]
if command=="sell":
if param.Name=='Steel Helmet':
item_worth =sh_price/2
else:
item_worth=100
renpy.call_in_new_context('sell_price')
elif command =="done":
finished = True
label sell_item:
$money+=item_worth
$equipment.remove(param)
$finished = True
jump store_thanks
I'm sorry for asking so much. OTL