Character creation with perks

Users who are viewing this thread

chadamas

Recruit
Hey, people. I'll start by saying that this may be my first post, but I'm not new to these forums (been combing through threads here for weeks now, ever since I realized I could mod M&B). So I apologize if I ask something that has already been answered, but I promise I have tried using the search function.

I've been working on a mod for my own enjoyment, and, while progress is slow, things have been going pretty well up until today. My primary focus so far has been on character creation. Ideally, I wanted to get rid of all the questions at the beginning of the game and go straight to the character page with a pool of Attribute, Skill, and Weapon Proficiency points that I could distribute however I wanted. Extensive searching on this forum, though, seemed to suggest that wasn't possible. So instead, I opted for a class/perk system.

The classes weren't a problem. I was able to add that menu, and have all stats update accordingly. But I wanted to take a different direction for the perks, and actually make them have a lasting impact throughout the game.

You can only choose one perk at the beginning of the game. A couple of examples (formulas may be changed):
Swift Learner: grants an additional 5% XP whenever XP is rewarded
Comprehension: all books give one additional Attribute/Skill point when your character finishes them

I've already coded those and have them working properly, along with a few others. But there are two that I'm really having trouble with, and I wondered if anyone here could help me out...or at least tell me if they're even possible.

The first one is a weapons perk, which allows you to use a weapon with a difficulty rating one level beyond your Skill/Attribute. Ex: A Great Axe (difficulty 10), could be used with a STR of 9. I tried doing this the same way I did with the XP in the Swift Learner perk (created a script in module_scripts to check whether or not the character had the perk, and assign bonuses accordingly), but that was a dead end. Is something like this even possible? Or, maybe even to set all weapon difficulties to 0 for a character who has this perk?

Another is a sort of "Insomniac" type of perk, with which a character receives bonuses to his/her attributes at night. I'm pretty sure I could do this one, but I've spent so long fiddling with that weapons perk that I just don't feel like blindly going through the module files again right now. So...can anyone tell me the quickest route to accomplish this?

Whew...I feel like I'm writing a book here. Sorry for being so long-winded. I have other questions and ideas, but I'll leave it at this for now.

Thank you for any suggestions or pointers!
 
lol, a Fallout player!

Yeah, I am a huge fan of Fallout (didn't realize it was that obvious--maybe "Perks" isn't the right word, haha), but that's not at all what I'm trying to do with this mod. At least...I don't think.
 
The first one is a weapons perk, which allows you to use a weapon with a difficulty rating one level beyond your Skill/Attribute. Ex: A Great Axe (difficulty 10), could be used with a STR of 9. I tried doing this the same way I did with the XP in the Swift Learner perk (created a script in module_scripts to check whether or not the character had the perk, and assign bonuses accordingly), but that was a dead end. Is something like this even possible? Or, maybe even to set all weapon difficulties to 0 for a character who has this perk?
As far as I know, you can't modify the stats of a weapon ingame.

Another is a sort of "Insomniac" type of perk, with which a character receives bonuses to his/her attributes at night. I'm pretty sure I could do this one, but I've spent so long fiddling with that weapons perk that I just don't feel like blindly going through the module files again right now. So...can anyone tell me the quickest route to accomplish this?
That one should be easy enough. Just create a trigger in module_triggers that runs once per game hour that checks if it is day or night, and raises or lowers the attributes accordingly. Something like this should do the trick:
(1.0, 0, 0, [
            (try_begin),
  (neq, "$g_attributes_raised", 1),
  (is_currently_night),
  (troop_raise_attribute, "trp_player",ca_strength,1),
  (troop_raise_attribute, "trp_player",ca_agility,1),
  (troop_raise_attribute, "trp_player",ca_intelligence,1),
  (troop_raise_attribute, "trp_player",ca_charisma,1),
  (assign,"$g_attributes_raised", 1),
(else_try),
  (neq, "$g_attributes_raised", 0),
  (neg|is_currently_night),
  (troop_raise_attribute, "trp_player",ca_strength,-1),
  (troop_raise_attribute, "trp_player",ca_agility,-1),
  (troop_raise_attribute, "trp_player",ca_intelligence,-1),
  (troop_raise_attribute, "trp_player",ca_charisma,-1),
  (assign,"$g_attributes_raised", 0),
(try_end),
            ], []),
I haven't tested that, but it should work.If you get an "Unassigned global variable" error message, just the line (assign,"$g_attributes_raised", 0), to the "game_start" script.
 
Thank you for the response! That works perfectly. Much appreciated. And thanks for the info on the weapon-modification.
 
YW. One thing I forgot to put in that trigger though was a check for if the player has the insomniac perk. The way it is right now it will always affect the player whether they have the perk or not.
 
chadamas said:
The first one is a weapons perk, which allows you to use a weapon with a difficulty rating one level beyond your Skill/Attribute. Ex: A Great Axe (difficulty 10), could be used with a STR of 9. I tried doing this the same way I did with the XP in the Swift Learner perk (created a script in module_scripts to check whether or not the character had the perk, and assign bonuses accordingly), but that was a dead end. Is something like this even possible? Or, maybe even to set all weapon difficulties to 0 for a character who has this perk?

Try the opposite- check if the character doesn't have the perk, and if not then don't allow it until the conditions in the description. Can't provide code help here though I'm just throwing out ideas, python is a horrible language.
 
I got this working, but I want it to check if a quest is active, and if not, I want it to have zero negative effects.
I have it where it won't give you bonuses if said quest isn't on already, but you still get negative effects.

How might one do that?
 
Keedo420 said:
YW. One thing I forgot to put in that trigger though was a check for if the player has the insomniac perk. The way it is right now it will always affect the player whether they have the perk or not.
Yep, that's no problem. I added the condition to it and made sure it worked properly. Thanks again. That was incredibly simple...I probably would have ended up trying it in some other roundabout way that wouldn't have been nearly as effective.

Mayhem said:
Try the opposite- check if the character doesn't have the perk, and if not then don't allow it until the conditions in the description. Can't provide code help here though I'm just throwing out ideas, python is a horrible language.
Haha, yeah, I agree with you on Python. This is my first experience with it, and so far I am not loving it. As for your suggestion, I'll give it a try, but I'm not sure that would work either. I don't really know this for sure, but it seems like the portion of that code (for example: difficulty(10)) is looking for a direct numerical input. I couldn't get it to read that as a variable at all when I was messing with it.

SupaNinjaMan said:
I got this working, but I want it to check if a quest is active, and if not, I want it to have zero negative effects.
I have it where it won't give you bonuses if said quest isn't on already, but you still get negative effects.

How might one do that?

Hmm...seems kinda strange that you're still getting negative effects from it. Did you try checking for the quest in the conditions block? I have mine set up to check for a global variable I assigned to the character perk.

Here's my code, just as an example:
(1.0, 0, 0, [(eq,"$character_perk",cc2_insomniac),], [
    (try_begin),
    (neq, "$g_attributes_raised", 1),
    (is_currently_night),
    (troop_raise_attribute, "trp_player",ca_strength,5),
    (troop_raise_attribute, "trp_player",ca_agility,5),
    (troop_raise_attribute, "trp_player",ca_intelligence,5),
    (troop_raise_attribute, "trp_player",ca_charisma,5),
    (assign,"$g_attributes_raised", 1),
  (else_try),
    (neq, "$g_attributes_raised", 0),
    (neg|is_currently_night),
    (troop_raise_attribute, "trp_player",ca_strength,-5),
    (troop_raise_attribute, "trp_player",ca_agility,-5),
    (troop_raise_attribute, "trp_player",ca_intelligence,-5),
    (troop_raise_attribute, "trp_player",ca_charisma,-5),
    (assign,"$g_attributes_raised", 0),
  (try_end),
    ]),

Hopefully that will give you an idea. I have (eq,"$character_perk",cc2_insomniac), in my conditions block...I think you could probably check for an active quest in the same way.
 
Code:
(1.0, 0, 0, [
			
            (try_begin),
			(check_quest_active,qst_perk_insomniac)
            (neq, "$g_attributes_raised", 1),
            (is_currently_night),
            (troop_raise_attribute, "trp_player",ca_strength,3),
            (troop_raise_attribute, "trp_player",ca_agility,3),
			(troop_raise_skill, "trp_player",skl_athletics,1),
			(troop_raise_skill, "trp_player",skl_ironflesh,1),
			(troop_raise_skill, "trp_player",skl_power_strike,1),
            (assign,"$g_attributes_raised", 1),
          (else_try),	
			(neg|is_currently_night),
            (troop_raise_attribute, "trp_player",ca_strength,-4),
            (troop_raise_attribute, "trp_player",ca_agility,-4),
			(troop_raise_skill, "trp_player",skl_athletics,-1),
			(troop_raise_skill, "trp_player",skl_ironflesh,-1),
			(troop_raise_skill, "trp_player",skl_power_strike,-1),
            (assign,"$g_attributes_raised", 0),
          (try_end),
            ], []),

As you can see, I gave penalties to insomniacs during the day, but I don't know how to make it where non-insomniacs are not hit by this penalty. I made it where you have to have the perk, an active quest, to get the bonuses (i think), but not to get the penalties. I'll try a modified yours, maybe it'll work better.

Also, this is my first try with python, so e dumb with me if you feel it necessary.
 
SupaNinjaMan said:
Code:
(1.0, 0, 0, [
			
            (try_begin),
			(check_quest_active,qst_perk_insomniac)
            (neq, "$g_attributes_raised", 1),
            (is_currently_night),
            (troop_raise_attribute, "trp_player",ca_strength,3),
            (troop_raise_attribute, "trp_player",ca_agility,3),
			(troop_raise_skill, "trp_player",skl_athletics,1),
			(troop_raise_skill, "trp_player",skl_ironflesh,1),
			(troop_raise_skill, "trp_player",skl_power_strike,1),
            (assign,"$g_attributes_raised", 1),
          (else_try),	
			(neg|is_currently_night),
            (troop_raise_attribute, "trp_player",ca_strength,-4),
            (troop_raise_attribute, "trp_player",ca_agility,-4),
			(troop_raise_skill, "trp_player",skl_athletics,-1),
			(troop_raise_skill, "trp_player",skl_ironflesh,-1),
			(troop_raise_skill, "trp_player",skl_power_strike,-1),
            (assign,"$g_attributes_raised", 0),
          (try_end),
            ], []),

As you can see, I gave penalties to insomniacs during the day, but I don't know how to make it where non-insomniacs are not hit by this penalty. I made it where you have to have the perk, an active quest, to get the bonuses (i think), but not to get the penalties. I'll try a modified yours, maybe it'll work better.

Also, this is my first try with python, so e dumb with me if you feel it necessary.
I'm a newbie with Python too, so I'm probably not the best one to offer suggestions, but at first glance it looks like you actually have the code to be executed in the conditions block. I'm not sure how that might negatively be effecting things, but it could be. What you might want to try is moving your code into the second set of brackets, and just put the required conditions into the first bracket.

Actually...on closer inspection, it looks like you put the check for the quest in first part of the "try" operation. If you're going to set it up this way, you would actually need to have two try operations...one to check if the quest is active, and then another one inside that one to check whether it's day or night. Does that make sense? The way it's set up, the quest has to be active for the bonuses to be added, but if it's daytime, that check fails and the penalties are applied regardless. Also, you don't have the (neq, "$g_attributes_raised", 0), in the "else_try" which means that those penalties are applied even if attributes aren't currently raised.

Try this code and see how it works for you (if I've understood what you're wanting, I think it will):
Code:
(1.0, 0, 0, [(check_quest_active, "qst_perk_insomniac"),],
     [			
            (try_begin),
	    (neq, "$g_attributes_raised", 1),
            (is_currently_night),
            (troop_raise_attribute, "trp_player",ca_strength,3),
            (troop_raise_attribute, "trp_player",ca_agility,3),
			(troop_raise_skill, "trp_player",skl_athletics,1),
			(troop_raise_skill, "trp_player",skl_ironflesh,1),
			(troop_raise_skill, "trp_player",skl_power_strike,1),
            (assign,"$g_attributes_raised", 1),
          (else_try),	
            (neq, "$g_attributes_raised", 0),
	    (neg|is_currently_night),
            (troop_raise_attribute, "trp_player",ca_strength,-4),
            (troop_raise_attribute, "trp_player",ca_agility,-4),
			(troop_raise_skill, "trp_player",skl_athletics,-1),
			(troop_raise_skill, "trp_player",skl_ironflesh,-1),
			(troop_raise_skill, "trp_player",skl_power_strike,-1),
            (assign,"$g_attributes_raised", 0),
          (try_end),
            ]),

Hope that works for you. Good luck with it!
 
Thanks, one thing you should watch out for in your code is the intelligence boost.
It grants a skill point, which can be used during the night, but if used makes the skill points a -1 during the day.

EDIT: How's this one look?
Code:
(1.0, 0, 0, [(check_quest_active, "qst_perk_city"),],
     [			
            (try_begin),
	    (neq, "$g_attributes_raised", 1),
            (party_is_in_any_town,0),
            (troop_raise_attribute, "trp_player",ca_charisma,6),
			(troop_raise_skill, "trp_player",skl_trade,6),
            (assign,"$g_attributes_raised", 1),
          (else_try),	
            (neq, "$g_attributes_raised", 0),
	    (neg|party_is_in_any_town,0),
            (troop_raise_attribute, "trp_player",ca_charisma,-7),
			(troop_raise_skill, "trp_player",skl_trade,-7),
            (assign,"$g_attributes_raised", 0),
          (try_end),
            ]),
 
Hey, I like that man! That's cool. Thanks for sharing.

And good point about the Intelligence boost. I hadn't even thought of that. I was thinking of it more as a physical boost, but had applied it just to the attributes for testing purposes, so I'll definitely change that. I actually really like what you did with raising Ironflesh, Athletics, and Power Strike. I may do something more along those lines for my game too. Thanks for that.

I had an idea today that I've been toying around with. Instead of making me choose one perk at the beginning of the game, I thought it might be cool to be able to upgrade each of the perks as I progress. So if I chose the Insomniac perk at the beginning of the game, I'd get +1 to certain attributes/skills...then say, at level 5 or so, I could upgrade the Insomniac perk to get a +2 to those attributes/skills, or choose one of the other perks. It would be slower progress, and some of the perks I have set up would be either useless at higher levels or ridiculously powerful...but I think I'm liking that idea.
 
I loved Fallout II's perk system, all the starting ones had repercussions and the later one's just kept getting better and better.

I might should show the fallout mod team this way, they'll probably appreciate it.
 
Yeah, Fallout was one of the greatest series of all time, in my opinion (not including Fallout 3...I liked that one, but Bethesda just didn't do the series justice). I haven't checked out the Fallout mod for M&B, but it's an interesting idea...might give it a look to see what they've done if it's available for download already. Haha, in all honesty though, even though these perks might seem similar, that really is not the direction I was trying to take with this mod I'm working on. I guess that just naturally happens though, when you've played a game that did things so perfectly.
 
Oh, you now how I have a higher negative than positive?
Terrible idea, now that I think of it, It will eventually tear down the character's stats to zero.

Make them the same absolute, or a tad smaller.
 
Cool. Happy I was at least able to give people some ideas.

Haha, and I never thought about those penalties eventually eating away your stats, but I guess that's right.

I've tinkered with this for the past couple of days, and I settled on the idea of allowing all Perks to be upgraded as the game progresses. My numbers probably aren't right yet (don't think the perks are balanced at all), and my code is probably very amateurish (don't point and laugh), but I wanted to share what I have anyway. If you read my original post, you'll definitely notice some differences...and I don't blame you if you don't want to look through the whole thing. I'm just hoping that maybe someone will get some use out of it, or be able to give me some suggestions.

So, let's start with the global variables I've assigned at the game_start script in module_scripts:

Code:
#CHAD edit
	(assign,"$g_attributes_raised", 0), #Needed if character has Insomniac perk
	(assign,"$g_perk_points",0), #Perk upgrade points. When this is at 1 or above, you can upgrade a Perk
	(assign,"$perk_bonus_swift_learner",3), # % Bonus to XP per Perk rating - ex: Swift Learner 1 grants 3% bonus XP
	(assign,"$perk_bonus_weapons_adept",3), # Bonus points to Weapon Proficiencies per point of Weapons Adept
	(assign,"$perk_bonus_fortune_seeker",5), # % Bonus to Money per point of Fortune Seeker

Then, we'll need the Perk descriptions (module_strings):

Code:
#CHAD EDIT
  ("perk_swift_learner_description", "Whether they are mistakes or successes, you learn from you experiences more quickly than a typical person. Each level of this perk grants you an additional 3% Experience Points whenever a quest is completed."),
  ("perk_weapons_adept_description", "You show exceptional potential with any weapon you pick up. For every point in this Perk, you automatically increase all Weapon Proficiencies by 3 points whenever you level up. (Note: The higher your Weapons Proficiencies, the harder they are to upgrade.)"),
  ("perk_scholar_description", "Some call you a bookworm, but that has never been an insult in your eyes. You have learned to pick up subtle details in your studying, which a casual reader might have missed. Every level of this perk grants you an additional bonus point whenever you finish a book."), 
  ("perk_fortune_seeker_description", "Cheat, steal, or negotiate, you always manage to come out of any situation with a few extra coins. Each level of this perk grants you 5% more Denars whenever money is earned."),
  ("perk_insomniac_description", "You have a natural affinity for the night. For each level of this perk, you receive one bonus point to Strength, Agility, Power Strike, Power Draw, Power Throw, and Athletics when the sun is down."),

Next, module_game_menus alteration to allow for Perk choice at character creation:

Code:
#CHAD EDIT
  ("start_mod_2",0,
    "Choose one perk, which will modify the way your character advances as you play the game.",
    "none",
    [(assign,"$perk_swift_learner",0),
     (assign,"$perk_weapons_adept",0),
     (assign,"$perk_scholar",0),
     (assign,"$perk_fortune_seeker",0),
     (assign,"$perk_insomniac",0),
     (assign,"$character_level_up",2),], #The character's next level: A trigger when check for when this level is reached, and apply bonuses for the Weapons Adept perk, if it has been taken.
    [
      ("swift_learner",[],"Swift Learner: Gains XP more quickly",
        [
	  (assign,"$perk_swift_learner",1),
	  (assign,"$perk_next_upgrade",3), #This is the next level at which you can upgrade your Perks
	  (jump_to_menu,"mnu_start_mod_3"),
	]
       ),

       ("weapons_adept",[],"Weapon Adept: Gains bonuses to Weapon Proficiencies with each level",
        [
	  (assign,"$perk_weapons_adept",1),
	  (assign,"$perk_next_upgrade",3),
	  (jump_to_menu,"mnu_start_mod_3"),
	]
       ),

       ("scholar",[],"Scholar: Receives bonuses whenever a book is read",
        [
	  (assign,"$perk_scholar",1),
	  (assign,"$perk_next_upgrade",3),
	  (jump_to_menu,"mnu_start_mod_3"),
	]
       ),

       ("fortune_seeker",[],"Fortune Seeker: Gains money more quickly",
        [
	  (assign,"$perk_fortune_seeker",1),
	  (assign,"$perk_next_upgrade",3),
	  (jump_to_menu,"mnu_start_mod_3"),
	]
       ),

       ("insomniac",[],"Insomniac: Attributes are increased at night.",
        [
	  (val_add,"$perk_insomniac",1),
	  (assign,"$perk_next_upgrade",3),
	  (jump_to_menu,"mnu_start_mod_3"),
		]
       ),

     ]
   ),

module_game_menus code to allow for viewing Perks (in the camp menu):

Code:
#CHAD EDIT for viewing Perks
("camp_view_perks",0,"Below is a list of all available Perks. Click on the name of any Perk to view its details.",
	"none",
	[
	 (assign, reg1, "$perk_swift_learner"),
	 (assign, reg2, "$perk_weapons_adept"),
	 (assign, reg3, "$perk_scholar"),
	 (assign, reg4, "$perk_fortune_seeker"),
	 (assign, reg5, "$perk_insomniac"),
	],
	[
		("swift_learner",[],"Swift Learner (Current Level: {reg1})",
			[
			 (assign, "$cur_perk", 1),
			 (assign, reg10, "$perk_swift_learner"),
			 (str_store_string, s1, "str_perk_swift_learner_description"),
			 (jump_to_menu, "mnu_camp_upgrade_perks"),
			]
		),
		("weapons_adept",[],"Weapons Adept (Current Level: {reg2})",
			[
			 (assign, "$cur_perk", 2),
			 (assign, reg10, "$perk_weapons_adept"),
			 (str_store_string, s1, "str_perk_weapons_adept_description"),
			 (jump_to_menu, "mnu_camp_upgrade_perks"),
			]
		),
		("scholar",[],"Scholar (Current Level: {reg3})",
			[
			 (assign, "$cur_perk", 3),
			 (assign, reg10, "$perk_scholar"),
			 (str_store_string, s1, "str_perk_scholar_description"),
			 (jump_to_menu, "mnu_camp_upgrade_perks"),
			]
		),
		("fortune_seeker",[],"Fortune Seeker (Current Level: {reg4})",
			[
			 (assign, "$cur_perk", 4),
			 (assign, reg10, "$perk_fortune_seeker"),
			 (str_store_string, s1, "str_perk_fortune_seeker_description"),
			 (jump_to_menu, "mnu_camp_upgrade_perks"),
			]
		),
		("insomniac",[],"Insomniac (Current Level: {reg5})",
			[
			 (assign, "$cur_perk", 5),
			 (assign, reg10, "$perk_insomniac"),
			 (str_store_string, s1, "str_perk_insomniac_description"),
			 (jump_to_menu, "mnu_camp_upgrade_perks"),
			]
		),
		
		("back",[],"Back to Camp Menu...",
			[
			 (jump_to_menu, "mnu_camp"),
			]
		),
	]
),

And to upgrade the Perks (still in module_game_menus):

Code:
#CHAD EDIT for perk upgrade
("camp_upgrade_perks",0,"{s1}",
	"none",
	[],
	[
			("upgrade",[(ge,"$g_perk_points",1),],"Upgrade this Perk (Current Level: {reg10})", #If the character has at least one Perk Point, give the option to upgrade
			[
				(try_begin),
					(eq, "$cur_perk", 1),
					(val_add,"$perk_swift_learner",1),
					(val_sub,"$g_perk_points",1),
					(display_message, "@Swift Learner Perk has been upgraded."),
					(jump_to_menu, "mnu_camp_view_perks"),
				(else_try),
					(eq, "$cur_perk", 2),
					(val_add,"$perk_weapons_adept",1),
					(val_sub,"$g_perk_points",1),
					(display_message, "@Weapons Adept Perk has been upgraded."),
					(jump_to_menu, "mnu_camp_view_perks"),
				(else_try),
					(eq, "$cur_perk", 3),
					(val_add,"$perk_scholar",1),
					(val_sub,"$g_perk_points",1),
					(display_message, "@Scholar Perk has been upgraded."),
					(jump_to_menu, "mnu_camp_view_perks"),
				(else_try),
					(eq, "$cur_perk", 4),
					(val_add,"$perk_fortune_seeker",1),
					(val_sub,"$g_perk_points",1),
					(display_message, "@Fortune Seeker Perk has been upgraded."),
					(jump_to_menu, "mnu_camp_view_perks"),
				(else_try),
					(eq, "$cur_perk", 5),
					(val_add,"$perk_insomniac",1),
					(val_sub,"$g_perk_points",1),
					(display_message, "@Insomniac Perk has been upgraded."),
					(jump_to_menu, "mnu_camp_view_perks"),					
				(try_end),
			]
			),
		("back",[],"Back to Perks list...",
		[
			(jump_to_menu, "mnu_camp_view_perks"),
		]
		),
	]
),

In module_triggers:
Code:
#CHAD edit to check for Insomniac perk
		(1.0, 0, 0, [(ge,"$perk_insomniac",1)], [
		    (assign,":insomniac_bonus","$perk_insomniac"),
		    (try_begin),
		    (neq, "$g_attributes_raised", 1),
		    (is_currently_night),		    
		    (troop_raise_attribute, "trp_player",ca_strength,":insomniac_bonus"),
		    (troop_raise_attribute, "trp_player",ca_agility,":insomniac_bonus"),
		    (troop_raise_skill,"trp_player",skl_power_draw,":insomniac_bonus"),
			(troop_raise_skill,"trp_player",skl_power_throw,":insomniac_bonus"),
			(troop_raise_skill,"trp_player",skl_power_strike,":insomniac_bonus"),
			(troop_raise_skill,"trp_player",skl_athletics,":insomniac_bonus"),
		    (assign,"$g_attributes_raised", 1),
		  (else_try),
		    (neq, "$g_attributes_raised", 0),
		    (neg|is_currently_night),
		    (val_sub,":insomniac_bonus","$perk_insomniac"),
		    (val_sub,":insomniac_bonus","$perk_insomniac"),
		    (troop_raise_attribute, "trp_player",ca_strength,":insomniac_bonus"),
		    (troop_raise_attribute, "trp_player",ca_agility,":insomniac_bonus"),
		    (troop_raise_skill,"trp_player",skl_power_draw,":insomniac_bonus"),
			(troop_raise_skill,"trp_player",skl_power_throw,":insomniac_bonus"),
			(troop_raise_skill,"trp_player",skl_power_strike,":insomniac_bonus"),
			(troop_raise_skill,"trp_player",skl_athletics,":insomniac_bonus"),
		    (assign,"$g_attributes_raised", 0),
		  (try_end),
		    ]),

#CHAD - Has character leveled up?
(0.1, 0, 0, [
				(store_character_level,":cur_level","trp_player"),
				(ge,":cur_level","$character_level_up"),
			],
			[ #Then let's give him/her some WP points, if the Weapons Adept Perk has been taken.
				(try_begin),
				(ge,"$perk_weapons_adept",1),
				(store_mul,":weapons_adept_bonus","$perk_weapons_adept","$perk_bonus_weapons_adept"), #Multiply the Perk rating by the bonus 
					(troop_raise_proficiency,"trp_player",wpt_one_handed_weapon,":weapons_adept_bonus"),
					(troop_raise_proficiency,"trp_player",wpt_two_handed_weapon,":weapons_adept_bonus"),
					(troop_raise_proficiency,"trp_player",wpt_polearm,":weapons_adept_bonus"),
					(troop_raise_proficiency,"trp_player",wpt_archery,":weapons_adept_bonus"),
					(troop_raise_proficiency,"trp_player",wpt_crossbow,":weapons_adept_bonus"),
					(troop_raise_proficiency,"trp_player",wpt_throwing,":weapons_adept_bonus"),
					(display_message, "@Your weapon proficiencies have been increased.",0xFF00FF00),
				(try_end),
				(store_character_level,":cur_level","trp_player"),
				(store_add,":next_level",":cur_level",1),
				(assign,"$character_level_up",":next_level"), #Update $character_level_up so we can tell when he/she levels up again
			]
),
			
			
#CHAD - Time to upgrade a perk?
(0.1, 0, 0, [
		(store_character_level, ":cur_level", "trp_player"),
		(ge,":cur_level","$perk_next_upgrade"),
	    ],
	    [
		(val_add,"$g_perk_points",1), #Add a perk point, so that we can upgrade a perk
		(val_add,"$perk_next_upgrade",3), #Add 3, because we gain a perk point every 3 levels
		(display_message, "@You may now upgrade one of your perks from the Camp menu.",0xFF00FF00),
		(play_sound,"snd_man_victory"),
	    ]
),

module_scripts to add bonus XP and Money, if those perks are upgraded:
Code:
#script_troop_add_gold
  # INPUT: arg1 = troop_no, arg2 = amount
  # OUTPUT: none
  ("troop_add_gold",
    [(store_script_param, ":troop_no", 1),
     (store_script_param, ":amount", 2),
	#CHAD EDIT
	(try_begin),
		(eq,":troop_no","trp_player"),
		(try_begin),
			(ge,"$perk_fortune_seeker",1), #Has Fortune Seeker been taken?
			(store_mul, ":perk_bonus", "$perk_fortune_seeker", "$perk_bonus_fortune_seeker"),
			(val_add, ":perk_bonus", 100),
			(val_div,":amount",100),
			(val_mul,":amount",":perk_bonus"), #Then add the bonus
		(try_end),
	(try_end),
	#CHAD EDIT END
     (troop_add_gold, ":troop_no", ":amount"),
     (try_begin),
       (eq, ":troop_no", "trp_player"),
       (play_sound, "snd_money_received"),
     (try_end),
     ]),     

#CHAD EDIT
#script_chad_troop_add_xp
("chad_troop_add_xp",
	[(store_script_param, ":amount", 1),
	 (store_script_param, ":troop_no", 2),
		(try_begin),
			(eq,":troop_no","trp_player"),
			(try_begin),
				(ge,"$perk_swift_learner",1), #Swift Learner taken?
				(store_mul, ":perk_bonus", "$perk_swift_learner", "$perk_bonus_swift_learner"),
				(val_add, ":perk_bonus", 100),
				(val_div,":amount",100),
				(val_mul,":amount",":perk_bonus"), #Then add the bonus
			(try_end),
		(try_end),
	(add_xp_to_troop, ":amount", ":troop_no"), 
	]
),
#CHAD EDIT END
#script_chad_add_xp_as_reward
("chad_add_xp_as_reward",
	[(store_script_param, ":amount", 1),
		(try_begin),
				(ge,"$perk_swift_learner",1),
				(store_mul, ":perk_bonus", "$perk_swift_learner", "$perk_bonus_swift_learner"),
				(val_add, ":perk_bonus", 100),
				(val_div,":amount",100),
				(val_mul,":amount",":perk_bonus"),
		(try_end),
		(add_xp_as_reward, ":amount"),
	]
),

For the above scripts to work, you have to replace all instances of add_xp_to_troop with call_script, "script_chad_troop_add_xp", and replace all instances of add_xp_as_reward with call_script, "script_chad_add_xp_as_reward"

Then, finally, this one in module_simple_triggers, if the character is reading a book:
Code:
#CHAD EDIT for Scholar perk
	(assign,":book_reward",1), #Books always reward at least 1 point
	(try_begin),
		(ge,"$perk_scholar",1), #If the character has the Scholar perk...
		(val_add,":book_reward","$perk_scholar"), #We add the perk rating to the book reward
	(try_end),

       (try_begin),
         (eq, "$g_player_reading_book", "itm_book_tactics"),
         (troop_raise_skill, "trp_player", "skl_tactics", ":book_reward"),
         (str_store_string, s2, "@ Your tactics skill has increased."),
       (else_try),
         (eq, "$g_player_reading_book", "itm_book_persuasion"),
         (troop_raise_skill, "trp_player", "skl_persuasion", ":book_reward"),
         (str_store_string, s2, "@ Your persuasion skill has increased."),
       (else_try),
         (eq, "$g_player_reading_book", "itm_book_leadership"),
         (troop_raise_skill, "trp_player", "skl_leadership", ":book_reward"),
         (str_store_string, s2, "@ Your leadership skill has increased."),
       (else_try),
         (eq, "$g_player_reading_book", "itm_book_intelligence"),
         (troop_raise_attribute, "trp_player", ca_intelligence, ":book_reward"),
         (str_store_string, s2, "@ Your intelligence has increased."),
       (else_try),
         (eq, "$g_player_reading_book", "itm_book_trade"),
         (troop_raise_skill, "trp_player", "skl_trade", ":book_reward"),
         (str_store_string, s2, "@ Your trade skill has increased by."),
       (else_try),
         (eq, "$g_player_reading_book", "itm_book_weapon_mastery"),
         (troop_raise_skill, "trp_player", "skl_weapon_master", ":book_reward"),
         (str_store_string, s2, "@ Your weapon master skill has increased."),
       (else_try),
         (eq, "$g_player_reading_book", "itm_book_engineering"),
         (troop_raise_skill, "trp_player", "skl_engineer", ":book_reward"),
         (str_store_string, s2, "@ Your engineer skill has increased."),
       (try_end),
       (dialog_box, "@You have finished reading {s1}.{s2}", "@Book Read"),
       (assign, "$g_player_reading_book", 0),
       ]),

And...I think that may be it. Questions? Comments? Pointers? Suggestions? Insults? Kicks? Slaps?

Edit: to clarify which section was for module_triggers and which was for module_simple_triggers.
 
Back
Top Bottom