Jump to content
PhoenixSoul

Victor's Passive States and notetag struggles (please send help!)

Recommended Posts

Okay, so what I am trying to do is have the state applied if certain equipment is used, like an Axe Mastery Passive Skill if an Axe is equipped. Thus far, I've been able to get it to work if there was anything equipped in the weapon slot, but not for checking if said weapon was an axe, in essence, the script giving the finger to wtype_ids and atype_ids (ha-ha, no specific checks for you-nah nah nah-nah nah). 🙄

Setup:
<passive state: 141>
a = equips[0] && equips[0].wtype_id; b =  equips[0]; [1].include?(a) && b
</passive state>

@Kayzee, dearest love would tell me that I'm making things too complicated again, but seriously...

Share this post


Link to post
Share on other sites

Okay first of all... what the heck? Sometimes I really want to know what you are thinking, cause that's obviously not going to work at all. Well okay, obviously to me, but I am kinda an expert. Still!

 

it should be:

self.equips[0] && self.equips[0].wtype_id == 1

 

or if you insist on using include? even though you are only checking for one thing:

self.equips[0] && [1].include?(self.equips[0].wtype_id)

 

The reason it wasn't recognizing wtype_id BTW is probably because you were using equips[0] and not self.equips[0] (because equips[0] could be interpreted as @equips[0] which is actually more or less the slot the item is in rather then the actual item). See, you have instance variables for classes which are private and methods which are public annnnd your eyes started glazing over somewhere between 'because' and 'you' in the first sentence of this paragraph didn't they? I can say anything I want now and the words will just flow in and out your head won't they? Maybe I can use that to send you subliminal hypnotizing messages! You are getting very sleepy... Listen to Kayzee! Kayzee knows best. Believe what she tells you. Now wake up and forget you ever read this. So you see sometimes you got to specify self to make sure Ruby doesn't get confused.

 

Edited by Kayzee

Share this post


Link to post
Share on other sites
On 11/8/2020 at 4:50 PM, PhoenixSoul said:

Okay, so what I am trying to do is have the state applied if certain equipment is used, like an Axe Mastery Passive Skill if an Axe is equipped. Thus far, I've been able to get it to work if there was anything equipped in the weapon slot, but not for checking if said weapon was an axe, in essence, the script giving the finger to wtype_ids and atype_ids (ha-ha, no specific checks for you-nah nah nah-nah nah). 🙄

Setup:
<passive state: 141>
a = equips[0] && equips[0].wtype_id; b =  equips[0]; [1].include?(a) && b
</passive state>

@Kayzee, dearest love would tell me that I'm making things too complicated again, but seriously...

 

Hey, a situation where I can help!

 

OK, so Kayzee had it right. Here's some other stuff I've been doing with it also.

 

To check if a character is equipped with a certain weapon type while also NOT using a shield (Doublehand):

<passive state: x>
self.equips[0].wtype_id == 1 && @equips[1].is_nil?;
</passive state>

Checking to see if the character is equipped with ANY weapon (could be used to create a bonus for a weapons master, but not benefit a bare-handed fighter)

<passive state: x>
!@equips[0].is_nil?;
</passive state>

Conversely, to check if a character is NOT equipped with a weapon (providing the state to a character who benefits from being bare-handed):

<passive state: x>
@equips[0].is_nil?;
</passive state>

You can probably also reference this if my syntax is right...

<passive state: x>
!@equips[0].is_nil? && self.equips[0].name == "Legendary Sword";
</passive state>

To create a state that only benefits the character when equipped with a specific weapon, by name, rather than using the ID (because it would be easier for you to read what it's doing rather than see numbers. This would ensure that the slot would have to first not be empty, then check for the equipped item's name.

 

Another one that I didn't test but should work...

<passive state: x>
self.skill_learn?(y);
</passive state>

Should check if a character has skill ID y learned, and thus return true (could be used to create a state that empowers a certain skill once it is learned)

Edited by Coolie
Syntax fix

Share this post


Link to post
Share on other sites

Thanks, dearest love @Kayzee; you're super helpful as always. I think being forced to be shut-in has me on edge and fried...

Will definitely be testing the self.skill_learn?(y) and will get back to you if that works or not, @Coolie. You were very helpful.

I compiled that into an .rb file so I can reference it later.

Addendum:

I tried the self.skill_learn?(y) and it does work.

Also:

[x,x,x].include?(y) is a great dynamic way to have more than one thing being checked for...

[160,161].include?(!self.skill_learn?);
(yes I was using this to check for if the skills were NOT learned)

Edited by PhoenixSoul
self.skill_learn?(y) == WORKS

Share this post


Link to post
Share on other sites
On 11/9/2020 at 5:36 PM, PhoenixSoul said:

[160,161].include?(!self.skill_learn?);

 

Have you actually tested this? That's not going to work at all. You have to give 'self.skill_learn?' something to check after all. Really 'include?' isn't useful for stuff like that., It's only good for when you want to check if a list includes a value. You can do this if you want to though:

[160,161].all?{|id| !self.skill_learn?(id)};

Which make sure all of the skills in the list are not learned, or you can use:

[160,161].none?{|id| self.skill_learn?(id)};

Which makes sure none of the skills are learned, which is the same as the 'all?' example without needing the '!' to reverse the check. Yet another way to do it is:

![160,161].any?{|id| self.skill_learn?(id)};

Which is basically checking if any of the skills in the list are learned and reversing that.

 

That's why 'all?', 'any?', and 'none?' are really useful! Also there is a 'one?' which checks if one and only one of a thing is true but that's less useful. Btw, the code between the '{}' braces are called Closures. Closures are a useful way of passing bits of code around. In these examples they are basically running whatever bit of code you want to check each member in the list with. The variable in between the two '|' characters is used as the current member it's checking.

 

Edited by Kayzee

Share this post


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

Have you actually tested this?

Yes; it worked! When I applied to making it so a state is not applied if either of those skills are learned, the state was not applied. By the by, I did mention that I tested this, not just come up with the idea. However... I'm certain that the methods you posted are more likely to be more efficient, or better in some way. I will be recording those in the .rb file as well.
I'm really grateful for the help; it'll definitely push me along the hill of skulls and broken bones that is...coding purg.

Share this post


Link to post
Share on other sites
5 hours ago, PhoenixSoul said:

Yes; it worked! When I applied to making it so a state is not applied if either of those skills are learned, the state was not applied. By the by, I did mention that I tested this, not just come up with the idea. However... I'm certain that the methods you posted are more likely to be more efficient, or better in some way. I will be recording those in the .rb file as well.
I'm really grateful for the help; it'll definitely push me along the hill of skulls and broken bones that is...coding purg.

 

Are you sure it worked? I mean yes, you are technically right, the passive would not be applied if either of those skills were learned, you got that right. But it also wouldn't be applied if neither of those skills were learned. Because it doesn't work. In fact it actually would give an error if the passive states script didn't outright ignore errors. I hate it when things do that, because it's really hard to figure out what's wrong without errors. Remember, I know you hate um, but errors are your friend!

 

Also: Coding purg? As in purgatory? I donno, sounds optimistic to me. Hills of skulls and broken bones sounds more along the lines of something you would find a bit lower down. ... Now I sorta want to map out my own coding Divine Comedy.

Edited by Kayzee

Share this post


Link to post
Share on other sites
On 11/11/2020 at 9:45 PM, Kayzee said:

Now I sorta want to map out my own coding Divine Comedy.

Think you should. I'd read it, lolz
 

On 11/11/2020 at 9:45 PM, Kayzee said:

Are you sure it worked? I mean yes, you are technically right, the passive would not be applied if either of those skills were learned, you got that right. But it also wouldn't be applied if neither of those skills were learned. Because it doesn't work. In fact it actually would give an error if the passive states script didn't outright ignore errors. I hate it when things do that, because it's really hard to figure out what's wrong without errors. Remember, I know you hate um, but errors are your friend!

I will be double-checking it, but I'm very sure. I'll be posting my results, when I get back to it.

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.

×