ID:156711
 
So my items are easily destroyable, and I know that something like Health=455555556656565656 would make them nigh indestructible, but it would be hell to add that health to all of those turfs, so is there a way to give all turfs a certain health?
Why is everything attackable? Do Swords and Shields and such really need health?
AnimeBeyond wrote:
So my items are easily destroyable, and I know that something like Health=455555556656565656 would make them nigh indestructible, but it would be hell to add that health to all of those turfs, so is there a way to give all turfs a certain health?

Well, if you mean *all* turfs...

// guessing your code is like this
atom
var/health

// so do this:
turf
health = 9001 // ITS OVER 9000!!!

turf
door // /turf/door's health is 10, because it's overridden here
icon_state = "door"
health = 10
grass // grass's health is 9001, because it inherits it from /turf
icon_state = "grass"
water // water's is 9001 too
icon_state = "water"


Unless you specifically override things lower, you can set variables and things on the parent type and it will automatically be inherited by its children.

Also, instead of making things nigh indestructible with huge amounts of health, if you want it so they can't be destroyed, then just make it so they can't be destroyed. Have a variable like 'invulnerable' or something, and check for it in your damage code. If an atom can't be destroyed, then don't let it take any damage.
You're much better off marking certain things as unbreakable. Relying on a magically large number really isn't a very good idea, design-wise.

Lummox JR
In response to Moonlight Memento
Moonlight Memento wrote:
Why is everything attackable? Do Swords and Shields and such really need health?

Agree, just add a durability for items, only mobs in my opinion should have 'health' for structures, decay :/
In response to Wolfnova
Wolfnova wrote:
Moonlight Memento wrote:
Why is everything attackable? Do Swords and Shields and such really need health?

Agree, just add a durability for items, only mobs in my opinion should have 'health' for structures, decay :/

Health for items would work exactly like durability, so if you already have a health var for atoms, it'd be a waste adding another car called 'durability' instead of health specially for turfs/objs...
In response to Enic
Enic wrote:
Wolfnova wrote:
Moonlight Memento wrote:
Why is everything attackable? Do Swords and Shields and such really need health?

Agree, just add a durability for items, only mobs in my opinion should have 'health' for structures, decay :/

Health for items would work exactly like durability, so if you already have a health var for atoms, it'd be a waste adding another car called 'durability' instead of health specially for turfs/objs...

Organisation.. not a waste, saves time whenever you want to change anything.. instead of changing all the items, or change the health var, and it in turn changing everything, including char health, if same var, you just change 'durability' instead of health...
In response to Enic
Instead of doing a damage calculation, you would just be checking whether a variable was true or false.
In response to Lummox JR
Thanks for the help everyone, even a newb coder like me had to facepalm at how easy it was to fix.
In response to Enic
If you are worrying about design wise, isn't it even poorer design to assign them to a class of objects that doesn't need them, in this case, turf obj and area rather than just assigning them to one that does?
In response to Enic
Is there anything you have against having a health var for mobs and durability (which is asinine because it reminds me of Final Fantasy Legends 2 where they were really expensive and you barely made enough money to rebuy it before it broke) for weapons/objs?
In response to Moonlight Memento
Do I have to? I just said that it'd be a waste of putting another var if you could use the one named 'health' that already exist for the exactly same purpose.
In response to Enic
It's not that much of a waste. It's more of a waste to give something a health var (which would be all objs in your case) if it has no purpose for it, when only mobs and certain kinds of objs (weapons/armors) need to have a similar variable.
In response to Moonlight Memento
I don't see how a var named something else would effect the codings except by the var being named something completely different.
In response to Enic
That's... not really in response to what I just said in the previous post?
In response to Moonlight Memento
That's what I were talking about. You suddenly just changed it into something that wasn't in response to mine
In response to Enic
What Moonlight means is, there is no need to give a variable to every atom if the majority of them will not use it.
atom
var/health
//All objects, turfs and mobs have the "health" variable


This will give everything "Health", which is rather pointless if only a select number of atoms will actually use it.

obj
Destructable
var/health

Sword
//All destructable objects have the "health" variable

Shield


Rock
//The Rock does is not Destructable
//so it does not need the "health" variable


I have only used objects in this example. This lets you define which items will use the Health variable and which will not. So "Swords" and "Shields" can take damage, but "Rocks" can not.
In response to Danny Roe
Danny Roe wrote:
What Moonlight means is, there is no need to give a variable to every atom if the majority of them will not use

I know. But that's not what I were talking about.
In response to Enic
Enic wrote:
Danny Roe wrote:
What Moonlight means is, there is no need to give a variable to every atom if the majority of them will not use

I know. But that's not what I were talking about.

Do I have to? I just said that it'd be a waste of putting another var if you could use the one named 'health' that already exist for the exactly same purpose.

That health var wouldn't exist on that object if that were true.
In response to Pirion
Pirion wrote:
Enic wrote:
Danny Roe wrote:
What Moonlight means is, there is no need to give a variable to every atom if the majority of them will not use

I know. But that's not what I were talking about.

Do I have to? I just said that it'd be a waste of putting another var if you could use the one named 'health' that already exist for the exactly same purpose.

That health var wouldn't exist on that object if that were true.

I'm talking about health vars that already exists in whatever you need it in