TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   rq character generator functions (http://www.talkphp.com/absolute-beginners/5269-rq-character-generator-functions.html)

nefus 02-16-2010 12:14 AM

rq character generator functions
 
Hey gang, I tried to ask this question probably two months ago but I know for a fact that my question probably made no sense at all. So here I go again for try number 2. :-)

I'd like to build a basic character generator that allows players to make a few selections and build a character or npc for their runequest game. For those who care, I'm using the MRQ2 edition.

As a person with limited programming ability I'd like to build functions for things like Common Skill Bonuses. Let me give you two examples from the book.

Barbarian: +30% to Culture(Own) and Lore(Regional). +10% to Athletics and Resilience. +5% to Brawn, Perception, Ride and Stealth.

Now... that seems pretty straight forward until you look at one of the other common skill selections like this one from Nomads: 10% to either Brawn, Drive, Ride or Swim.

Like Barbarians, the Nomads have a few free skill bonuses and then you are forced to make a selection to top it off.

As a neophyte programmer I might try something like this for the Barbarian.

Code:

function barbarian_skills_one(){
    $background = array("Culture(Own)"=>'30', "Lore(Regional)"=>'30',
    "Resilience"=>'10', "Athletics"=>'10', "Brawn"=>'5', "Perception"=>'5',
    "Stealth"=>'5', "Ride"=>'5');
    return $background;
        }

How would I add the selection to the function? Should I add a special variable in the function that I look for to see if there is a second function that has selections in it? Should I wave a dead chicken over my keyboard and hope for some fancy voodoo?:-P

Aaron 02-26-2010 10:20 AM

In php5, you can just change the function you use to call it.

PHP Code:

foreach ($barbarian as &$barb) {
    if (
$barb['strength'] != NULL){
       
chooseAttribute('strength');



Hightower 02-26-2010 03:31 PM

Quote:

Originally Posted by nefus (Post 29986)
I know for a fact that my question probably made no sense at all

Hmmm that's contradicting.....


All times are GMT. The time now is 03:23 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0