Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Modding Questions: negative-weight items, among other things  (Read 1071 times)

Impending Doom

  • Bay Watcher
  • has gone stark raving mad!
    • View Profile
Modding Questions: negative-weight items, among other things
« on: November 11, 2008, 11:55:13 pm »

In my current modding project, I've run into a bit of a snag: I'm currently trying to create a unit that can be assigned to a squad in order to give 'fire support' in the form of one of many powerful new ranged weapons, but need a way to keep them from being used by every single soldier in the player's army. My original idea was to create a new trainable creature with the ability to equip items. This, of course, didn't work out as I expected. So I've come up with a new idea, but would like some clarification first:

If I were to, say, create a 'steam repeater cannon' with an extremely high weight and equip it to a dwarf, could I then give that dwarf a 'clockwork exo-suit' piece of armor with a negative weight to offset the weight of the weapon?
Logged
Quote from: Robert A.Heinlein
Violence, naked force, has settled more issues in history than has any other factor, and the contrary opinion, that violence has never solved anything, is wishful thinking at its worst.

Greiger

  • Bay Watcher
  • Reptilian Illuminati member. Keep it secret.
    • View Profile
Re: Modding Questions: negative-weight items, among other things
« Reply #1 on: November 12, 2008, 12:18:03 am »

Honestly I never tried anything like that.  It might work, it might not.  So I say experiment.

P.S. Remember to note in great detail any explosions, dismemberments, or world ending physics laws breaking open a portal to the DF dimension making GCS real and craving world domination, that happen during the scientific process.
« Last Edit: November 12, 2008, 12:20:38 am by Greiger »
Logged
Disclaimer: Not responsible for dwarven deaths from the use or misuse of this post.
Quote
I don't need friends!! I've got knives!!!

Dhargk

  • Bay Watcher
  • Free hugs
    • View Profile
Re: Modding Questions: negative-weight items, among other things
« Reply #2 on: November 12, 2008, 09:41:30 pm »

The only way to find out is to try it. I'm not entirely sure if DF even supports negative numbers so a number of things could happen.

The weight could be ignored because it isn't a valid number for it, so you'd get objects with default or zero weight.

The negative could be completely ignored and you'd get whatever the number is in positive weight.

The negative number could register and work perfectly

Or quite possibly the integer could be incapable of being negative and underflow to something around 214,000,000,000 (if I remember that right)

Once that's been figured out, if the wiki's to be believed, you've got the problem of a dwarf's Armor User skill. It says that the Armor User skill, in Adventure mode at least, reduces the effective weight of your armor. That would no doubt mess with the negative weight in many weird, unwanted ways.
Logged

Fenrir

  • Bay Watcher
  • The Monstrous Wolf
    • View Profile
Re: Modding Questions: negative-weight items, among other things
« Reply #3 on: November 12, 2008, 09:52:51 pm »

Please share your findings!
Logged

Squeegy

  • Bay Watcher
  • I don't really have any answers for you.
    • View Profile
Re: Modding Questions: negative-weight items, among other things
« Reply #4 on: November 12, 2008, 10:34:10 pm »

The only way to find out is to try it. I'm not entirely sure if DF even supports negative numbers so a number of things could happen.

The weight could be ignored because it isn't a valid number for it, so you'd get objects with default or zero weight.

The negative could be completely ignored and you'd get whatever the number is in positive weight.

The negative number could register and work perfectly

Or quite possibly the integer could be incapable of being negative and underflow to something around 214,000,000,000 (if I remember that right)

Once that's been figured out, if the wiki's to be believed, you've got the problem of a dwarf's Armor User skill. It says that the Armor User skill, in Adventure mode at least, reduces the effective weight of your armor. That would no doubt mess with the negative weight in many weird, unwanted ways.

More something like 65535. I think that's the max.
« Last Edit: November 13, 2008, 09:15:09 pm by Squeegy »
Logged
I think I'm an alright guy. I just wanna live until I gotta die. I know I'm not perfect, but God knows I try.
Kobold Name Generator
⚔Dueling Blades⚔
Fertile Lands
The Emerald Isles

Dhargk

  • Bay Watcher
  • Free hugs
    • View Profile
Re: Modding Questions: negative-weight items, among other things
« Reply #5 on: November 12, 2008, 10:40:55 pm »

The only way to find out is to try it. I'm not entirely sure if DF even supports negative numbers so a number of things could happen.

The weight could be ignored because it isn't a valid number for it, so you'd get objects with default or zero weight.

The negative could be completely ignored and you'd get whatever the number is in positive weight.

The negative number could register and work perfectly

Or quite possibly the integer could be incapable of being negative and underflow to something around 214,000,000,000 (if I remember that right)

Once that's been figured out, if the wiki's to be believed, you've got the problem of a dwarf's Armor User skill. It says that the Armor User skill, in Adventure mode at least, reduces the effective weight of your armor. That would no doubt mess with the negative weight in many weird, unwanted ways.
More something like 65535. I think that's the max.


Really it depends on what type of integer it is and whether it is signed or unsigned. I figured it wouldn't be 16-bit since I know the value of some items can go above 65535 (HFS artifacts and such) so I assumed it was 32-bit, which would actually have a maximum of 4,294,967,295 if it was incapable of negatives.
Logged

Squeegy

  • Bay Watcher
  • I don't really have any answers for you.
    • View Profile
Re: Modding Questions: negative-weight items, among other things
« Reply #6 on: November 12, 2008, 10:53:57 pm »

I meant things like happiness, embark points, etc. Not value.
Logged
I think I'm an alright guy. I just wanna live until I gotta die. I know I'm not perfect, but God knows I try.
Kobold Name Generator
⚔Dueling Blades⚔
Fertile Lands
The Emerald Isles

Dhargk

  • Bay Watcher
  • Free hugs
    • View Profile
Re: Modding Questions: negative-weight items, among other things
« Reply #7 on: November 12, 2008, 10:55:31 pm »

You could be right, but it made sense to me for the integer for weight to be the same type as the one for value.

Either way, 65,535 or 4,294,967,295, it's still absurdly heavy.
Logged

Impending Doom

  • Bay Watcher
  • has gone stark raving mad!
    • View Profile
Re: Modding Questions: negative-weight items, among other things
« Reply #8 on: November 13, 2008, 07:14:16 pm »

Aww, no dice lads. The exo-suit's weight just defaults to 1 Dorfpound.

'twas quite funny, though, to be lugging around a <<+colossal copper chaingun+>> and moving so slowly that everybody else is a blur, yet still be able to shred them with a single +bigass iron shell+.

"WE MAKE GREAT TEAM!!"
Logged
Quote from: Robert A.Heinlein
Violence, naked force, has settled more issues in history than has any other factor, and the contrary opinion, that violence has never solved anything, is wishful thinking at its worst.

penguinofhonor

  • Bay Watcher
  • Minister of Love
    • View Profile
Re: Modding Questions: negative-weight items, among other things
« Reply #9 on: November 13, 2008, 08:35:27 pm »

That's how you make sure that they aren't abused. Make them real slow. The armor would just be used on other dwarves to completely de-burden the other ones and make them lightning fast.
Logged