First off, thanks for the help so far. For those unfamiliar with the project - I have a Hero content type. I have added fields that reference different equipment slots, which are content types too. With the help of CleanCutRogue, I managed to create a computed field that adds the armor of all the equipment. So far, so good.

Here's my next challenge: let's say my Hero gains levels. Each new level can be associated with more equipment slots or skills or increases in hitpoints. If it was 5 levels, I could create 4 more content types and customize each one. However, if I would like the Hero to be able to advance 100 levels, what is the recommended approach?

I guess the answer will to create a custom module but I'll appreciate a few pointers as to the best way to tackle it.

Thanks in advance.

Comments

alan d.’s picture

It sounds like your starting a very interesting project.

Personally I'd be creating a custom module that defines a Hero type. This way you can easily add conditions on what assets the Hero has or is allowed at what level, etc. This avoids switching content types when all that you're doing is adding or removing limits. If you have multiple Hero types, a content type for each Hero type would minimize conditional checks. (For example a fighter and a wizard type.) Both can call shared routines to do common loads.

Doing this with CCK could make things harder in the long run, but others may flame me for that option.

Hope you showcase the project when your finished. :)


Alan Davison
www.caignwebs.com.au

Alan Davison
ajg112’s picture

I agree with Alan. I've not been using Drupal for long, but in the process of creating 3 modules I've learned a great deal. It's well worth the effort.

This is a good entry point:
http://drupal.org/node/508

The coding standards is worth a look too.
http://drupal.org/coding-standards

After that, the best thing to do is find a 'similar' module and read through the source.

Andy

krasimir’s picture

Thanks, it's as I've feared :)

Doing 100 levels times 3 hero archetypes looks like a very stupid idea, I just wanted to be sure before I plunge into the depths of Drupal module development.

alan d.’s picture

If you are going to use Drupal 5, I'd also recommend the book "Pro Drupal Development". This covers many of the node hooks and FAPI in easy to understand examples.

And http://api.drupal.org contains some example modules. http://api.drupal.org/api/search/5/example


Alan Davison
www.caignwebs.com.au

Alan Davison
krasimir’s picture

Thanks for the recommendation. I think I've read the chapter on modules but let's say I'm still working on that skill!