DrMechano

Any good way to have a playable dead character?

13 posts in this topic

Simply put, one idea I have for a party member is a ghost character - whose HP will always be zero, and will be immune to all revival magic/items. They'll be unable to take damage in battle or be targeted by enemies (due to being incorporeal and all), but can still use some moves of their own that don't involve direct physical contact - such as scaring enemies, that sort of thing. 

 

However, by default party members with 0 HP cannot be controlled in battle. So I'm wondering if there's any workaround I can use here, to make this idea work?

Share this post


Link to post
Share on other sites

I wonder what would happen if they had NaN HP? I have no idea if that would work, but NaN is a special floating point value that is often kind of ignored in calculations. Technically it' mostly for 'undefined' floats like 0.0/0.0 and stuff like that. Not sure how it work with comparisons though, but logically a NaN should fail all less then/greater then tests and never be equal to any number I guess.

 

Would probobly be easier just to use the immortal state and fiddle with the code to let you control a party member with 0 hp though.

Edited by Kayzee

Share this post


Link to post
Share on other sites
4 hours ago, Kayzee said:

Would probobly be easier just to use the immortal state and fiddle with the code to let you control a party member with 0 hp though.

Yeah, I'm just not sure how to do that. I'm kind of a novice with code-fiddling, unfortunately.

 

Sounds like it might be doable though!

Share this post


Link to post
Share on other sites
16 hours ago, Kayzee said:

I wonder what would happen if they had NaN HP? I have no idea if that would work, but NaN is a special floating point value that is often kind of ignored in calculations.

 

Please tell me this is a joke.

 

I'm sure even you can guess what would happen when the code starts looking for a number to calculate damage or display something and doesn't find what it's meant to. Give you a hint - it's the exact same thing that happens when you drive a car looking for paved road and there's a streetpole in front of it instead.

 

But I am almost certain you knew that, so I'm calling this out now as either trolling or a really bad attempt at a joke.

 

On 10/10/2017 at 10:27 AM, DrMechano said:

Yeah, I'm just not sure how to do that. I'm kind of a novice with code-fiddling, unfortunately.

 

Sounds like it might be doable though!

 

When I first saw this thread, I originally didn't post in here because I thought you'd soon figure out how to do it on your own.

 

And now you have Killozappit trolling you and that other pinocchio-nosed animal telling you do circus dances and jump through hoops for what I can only assume is their own schadenfreude-style sadistic pleasure. And you apparently haven't even tried to find a way to do it on your own, which makes me sort of question why I'm even bothering to post on this since I'm not sure you're very invested if you're going straight to asking for help without trying first.

 

On the other hand I also wanna give the benefit of the doubt to everyone here and believe that they are NOT actually trying to troll you, but instead genuinely believe in the misguided advice they're dishing out. Which is not really much better, to be honest, because that says something else all by itself. But that's why I'm going to post anyway, despite my many misgivings.

 

First, let us start by banishing this BIG FAT LIE:

 

On 10/10/2017 at 10:27 AM, DrMechano said:

However, by default party members with 0 HP cannot be controlled in battle.

 

**** man, really? This one sentence told me you didn't try (or at least, not very hard anyway). It is absolutely, 100% possible for a party member with 0 HP to be controlled in battle.

 

Try it yourself. Give them complete immunity (State Resist, not State Rate) to Knockout/Death, which by default should be State 0001 on the list, unless you've been messing around with the code. Then run a battle test. And then drop their HP to 0 (Change HP, -9999 Entire Party, Allow Knockout).

 

Wow. Magic.

 

After that, all you need to do is make sure their target rate is zero and their recovery multiplier is zero and as long as you don't use any event command or script call to bump up their HP it won't ever be able to go above zero. And I shouldn't need to tell you how to set those parameters because it should be obvious just by playing around with the engine. Especially the target rate thing, you shouldn't have needed to mention that one at all.

Edited by Traverse

Share this post


Link to post
Share on other sites

Geez, what's got you so upset? I don't use MV really, so I wasn't sure if an immortal state would work or not. As for my idea of using NaN, I was mostly musing, but I am not saying to replace a number with a string or something. NaN is a normal float same as any other like 0.43623 or whatever. It's a special value designed to take the place of a number in calculations. That's what it's for. NaN + 1 is NaN. NaN - 1 is NaN. NaN * 2 is NaN. Any calculation with a NaN gets you a NaN. You convert NaN to a string, you get "NaN". This is something expressly added to the floating point standard to do exactly what I am suggesting it for. Admittingly this assumes automatic conversion between integer and float, but I think Javascript does that. Don't assume I am speaking nonsense because you don't understand what I am saying and are too lazy to actually read how NaN works.

 

Is it the best way to do it? Probably not. And yeah, throwing a NaN in unexpected places might possibly make all sorts of bugs. But really, again, I was just musing about it. Mostly because I think it would be a kind of clever hack and the idea amuses me. I never seriously expected it to be the best solution, and I even said as much.

Edited by Kayzee

Share this post


Link to post
Share on other sites
12 hours ago, Kayzee said:

NaN is a normal float same as any other like 0.43623 or whatever. It's a special value designed to take the place of a number in calculations.

 

I do not know who told you this, but you may want to be more careful about who or what you listen to.

 

In Javascript, a Number is a specific data type and Not-A-Number means any data type that isn't one. There is no "float" or "integer" in Javascript Numbers, this is not Java where you get to choose between a 16-bit Short, 32-bit Int or 64-bit Long, there is only the Number data type, which is always 64-bit floating. And in Javascript NaN refers to anything that is NOT a Number and thus cannot ever "take the place of a number". The output of Javascript's own isNaN() function is very telling about this.

 

I don't think I need to say that any function looking for a Number data type is going to throw a hissy fit if it gets some other data type instead.

Edited by Traverse

Share this post


Link to post
Share on other sites

Sigh... No see... We are talking about different things. A NaN is not a value that is not a Number datatype, a NaN is a special value for floating point numbers. Floating point numbers have three special values that are returned for some operations: Infinity -Infinity and NaN. NaN is expressly for operations that return values that are undefined (like 0/0) or imaginary/complex (like the square root of -1), and can also be used as placeholder values or to signal exceptions.

 

I guess it can be confusing, another doc for the isNaN function even says:

 

Quote

Since the very earliest versions of the isNaN function specification, its behavior for non-numeric arguments has been confusing. When the argument to the isNaN function is not of type Number, the value is first coerced to a Number. The resulting value is then tested to determine whether it is NaN. Thus for non-numbers that when coerced to numeric type result in a valid non-NaN numeric value (notably the empty string and boolean primitives, which when coerced give numeric values zero or one), the "false" returned value may be unexpected; the empty string, for example, is surely "not a number." The confusion stems from the fact that the term, "not a number", has a specific meaning for numbers represented as IEEE-754 floating-point values. The function should be interpreted as answering the question, "is this value, when coerced to a numeric value, an IEEE-754 'Not A Number' value?"

 

Anyway I don't want to argue about this, it was dumb to even bring it up.

Edited by Kayzee

Share this post


Link to post
Share on other sites
39 minutes ago, Kayzee said:

Sigh... No see... a NaN is a Number data type.

 

No matter how much you might want to call the color black a different shade of white, they are different things. You can say "all you have to do is adjust the HSV luminosity" and this turns white into black in your image editor, but this does not make them the same. You can say a transparent image file is still technically an image, but this doesn't stop there from being absolutely nothing to look at.

 

You can think of NaN and Infinity values as "specially flagged Number data types" if you want, but the bottom line is that the usual operators the rest of the code uses to process those values are looking for Numbers that are NOT flagged as NaN. Your fixation on insisting that NaN can replace a Number ignores the whole point of the NaN flag to begin with - that they are there to exclude the value from being treated as a proper Number by everything else.

 

Hell, when it comes down to it, everything in programming has a numerical representation on account of it all being data anyway so if you want to look at it that way then everything is a number. Which knowing helps you all of zilch when it really comes down to it.

 

Let me use an analogy to describe how I see the situation: you telling this guy to replace the HP value with an "NaN-flagged Number" is like telling a thirsty man to DRINK HOUSEHOLD BLEACH because, hell, it's got some water content in it after all. Sure, there might be a few problems with the chlorine, but eh semantics. It's still a water-based liquid solution. Anyway, we can always filter out the chlorine in advance, right? MAKES COMPLETE SENSE RIGHT?

 

You would have to forgive me if this kind of thing sounds an awful lot like trolling, even if you could, yes, technically speaking, actually filter out the chlorine to get some tiny amount of drinkable water out of the stuff.

Edited by Traverse

Share this post


Link to post
Share on other sites

You are mixing up Number as a datatype and number as a concept though. NaNs are of the datatype Number, but are not numbers in concept. Floating point math should happily accept NaNs, because it's designed to happily accept NaNs. That's the whole reason they exist, to let you deal with strange values of math operations and help programmers code special exception traps or plug in undefined variables to see how they propagate. Will there be bugs with suddenly introducing NaNs where they arn't expected? Maybe. But I expect they will be more subtle bugs rather then outright crashes if so. Like what if there is a skill that does damage based on your HP and it's set to NaN? Ooops it will do NaN damage, which will give the enemy NaN HP, and so on. I don't know. But according to everything I have ever read about NaNs, they are valid floating point values and they do not cause errors unless it's expressly a signaling NaN designed to throw an exception.

 

Look, this is dumb. I admitted it was a dumb thing to bring up. It was just a funny programmer musing because I was curious if it would work even if I am not sure I really expect it too. But I had my reasons for thinking it might.

Edited by Kayzee

Share this post


Link to post
Share on other sites
8 minutes ago, Kayzee said:

But according to everything I have ever read about NaNs, they are valid floating point values and they do not cause errors unless it's expressly a signaling NaN designed to throw an exception.

 

I conflate Number the data type with number as a concept because the data type was implemented as a representation of the concept. That's the whole point of high-level programming languages that abstract the ugly stuff into a more human-recognisable form.

 

You on the other hand, are conflating "happily acceptable" from a programming-language perspective with "happily acceptable" from an already-built game engine ala RMMV perspective. NaN may be a perfectly good "substitute" for a numerical value in a programming language, but the code base in MV does not find it so and I don't know why you'd be talking about programming in general when this is a very specific MV related question.

 

Yes, it could very well work. There is no question of this, JavaScript is an actual programming language. It could be implemented. You would have to modify the engine to accept NaN "numbers" in it, but it could be done because TECHNICALLY NaN is an acceptable kind of Number. It can't replace non-NaN numbers outright, but you can write functions to handle it. You would have to jump through an enormous number of hoops to do it. Like filtering the chlorine out of bleach to get drinking water.

Edited by Traverse

Share this post


Link to post
Share on other sites

Just don't forget, every high level language is implemented with low level details. Abstraction is great, but it doesn't really get rid of the 'ugly stuff', just polishes out the rough edges. There are times when the abstractions hide what is really going on.

 

Anyway, I am not sure if it would require as much special case code as you think, but whatever. It's not worth arguing over. I am curious what would happen though, if things break how they break exactly. But we have derailed the thread enough.

Edited by Kayzee

Share this post


Link to post
Share on other sites
On 10/12/2017 at 2:45 AM, Traverse said:

Try it yourself. Give them complete immunity (State Resist, not State Rate) to Knockout/Death, which by default should be State 0001 on the list, unless you've been messing around with the code. Then run a battle test. And then drop their HP to 0 (Change HP, -9999 Entire Party, Allow Knockout).

 

Wow. Magic.

 

After that, all you need to do is make sure their target rate is zero and their recovery multiplier is zero and as long as you don't use any event command or script call to bump up their HP it won't ever be able to go above zero. And I shouldn't need to tell you how to set those parameters because it should be obvious just by playing around with the engine. Especially the target rate thing, you shouldn't have needed to mention that one at all.

Ah, thank you.

 

I must have been doing something wrong, sorry for the trouble. I really do appreciate the help.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.