Game Development Community

I remember seeing a post for..

by Vince Gee · in Torque Game Engine · 04/30/2005 (5:04 pm) · 14 replies

Hey all,

I remember seeing a post somewhere on how to change max damage points for different players.

Basically, I want to have each logged in player to have their own maxdamage etc based on decisions they made at character creation time. I remember seeing a post somewhere on this but I can't seem to find it. Anyone have it bookmarked?

Vince

#1
04/30/2005 (6:53 pm)
Never mind, I figured out what I wanted to do w/ giving different players different amounts of hit points :) it was simple and didn't effect all the other players! weeeee

Vince
#2
04/30/2005 (7:13 pm)
Would you mind posting how you did it? I'm sure lots of other Torque users could use that information.
#3
04/30/2005 (7:41 pm)
Yes please do, I have found a way of doing it, but it's not very elegant.
#4
04/30/2005 (7:58 pm)
You can have a few diff datablocks (one for each type of player that your decision making code come up with) and switch them in/before game
www.garagegames.com/mg/forums/result.thread.php?qt=21501
#5
04/30/2005 (8:40 pm)
Never mind, I figured out what I wanted to do w/ giving different players different amounts of hit points :) it was simple and didn't effect all the other players! weeeee

Vince
#6
04/30/2005 (8:42 pm)
The method will be documented in the resource I'm writing for persistent player/skills/attributes and inventory. I've documented it all quite well. I should be done the resource in a few weeks.

Vince
#7
04/30/2005 (9:12 pm)
I seen that other post that you found a way.
It was just a link for other who came across this thread to see.

Ill be looking forward to your resource too.
#8
04/30/2005 (9:22 pm)
My solution was to move the MaxDamage declaration out of the PlayerData datablock and into the player creation function, in game.cs
%player.MaxDamage = %MaxDamage;
#9
05/01/2005 (12:40 pm)
Yeah but once the datablock is created I thought you couldn't change it. I.E. the player levels, you want to increase thier max damage due tot he fact that they are higher level. Wouldn't you have to destroy their existing player and make a new one? I looked into this route when I was experimenting and it just didn't seem to work for me.
#10
05/01/2005 (12:52 pm)
As Dreamer said, just move the max damage out of the datablock, and into the player class itself.
#11
05/01/2005 (12:53 pm)
@Vince:

Awesome. Although my project won't need such a feature, that sounds like a great resource.
#12
05/01/2005 (1:40 pm)
It wound up being a litte more complicated after doing some tests, but the actual code to make it work properly is here...

http://www.garagegames.com/mg/forums/result.thread.php?qt=29616
#13
05/01/2005 (5:11 pm)
Ok, my solution was a tad simpler, the way I did it was set the max damage in the datablock to 1,000,000. Then I have an object that tracks what everyone's REAL maxdamage is. Put in a script change that did a check if their damage was over their max damage and if it was I would add the 1,000,000 to their max damage.

Then, I relayed changes to a players max damage to the clients(using lists like your inventory mod uses) when ever max damage changed for a client and it would adjust the displaying of it correctly.

My goal was not to alter the core engine as much as it was to modify scripts and add ons.

@Dreamer - Of course, I think your solution is very impressive, and I've loved your resources!

And, I've noticed you've released alot of resources, and I wouldn't mind your opinion on something. My first resource is going to be alot of code, I am documenting every step and writing user manuals (For server stuff). Do you think it might be a tad to much to push out as 1 resource?

Vince
#14
05/01/2005 (5:59 pm)
Yes probably so, but it all really depends on how many new concepts you try to introduce at once. If you look at my resources you will notice that each concept has been released as it's own resource, and when something is modified from an older resource I include it in the new one, with an explaination as to why, I modified it that way.

Also if I see multiple ways of achieving the same goal I always try to opt for the simplest route. I have found most people don't actually read the resource, they just want to add files, and have it automagically work. This wasn't what I wanted, I wanted people to HAVE to read the code and the resource to make it work, that way they could see why I'm doing things the way I do them, which at least to some people may seem a bit odd :) Thats why none of my resources actually include downloadable drop in code samples of my own making.

You may however choose to do things as you see fit, and BTW thanks for the compliments. :)