EXVA 3 Posted April 12, 2021 How would one go about making the element id one the 1 element Apply Stack while making the rest Multiplicative, The hashtags# are what replaces the Multiplying of Elemental resistance, thus they stack additively 25+25+25+25=100 I tried use a if statement such as if element_id = 1 However attempts like this failed in only making the it glitch out giving all elements the same boost of one or simply applied the Stacking overriding all elements at once. Which is what I'm trying to avoid, but there seems no way to designate a certain element. Mostly likely I'll have to choose one or the other sadly but this is the nature of coding! Game_Battlerbase def element_rate(element_id) features_pi(FEATURE_ELEMENT_RATE, element_id) #er = features_with_id(FEATURE_ELEMENT_RATE, element_id =1).inject(1.0) do |r, ft| #r += (ft.value - 1.0) #end #[er, 0].max #end end 1 Share this post Link to post Share on other sites
Kayzee 4,045 Posted April 13, 2021 Oh! First of all, you need to use 'element_id == 1' if you want to check if the element_id is 1. You see 'element_id = 1' will set element_id to 1 which is why it does that glitch. Gotta remember use '==' to check if something is equal, and '=' to set something to equal. This is a common mistake. Also pretty sure putting it in the inject like that will do what you want it to? Try this maybe? def element_rate(element_id) if element_id == 1 return features_sum(FEATURE_ELEMENT_RATE, element_id) end features_pi(FEATURE_ELEMENT_RATE, element_id) end Share this post Link to post Share on other sites
EXVA 3 Posted April 13, 2021 Thx for the ideas, I figure this out & it works using return. def element_rate(element_id) return features_pi(FEATURE_ELEMENT_RATE, element_id) unless element_id == 1 return er = features_with_id(FEATURE_ELEMENT_RATE, element_id).inject(1.0) do |r, ft| r += (ft.value - 1.0) end [er, 0].max end This lets element stack to 75+75+75+75 aka 25+25+25+25 to 100% Immune another+75 aka grants it absorbing, using a script not sure if that is default. While at the same time if you have another one of the elements they are %. This extends the functionally of the engine a bit more for those who need it. I'm currently using it on a Physical Element 1 which stacks for Defense against Counter Hits. AKA if you attack get countered instead of using the default armor formula it sends back Elemental 1 damage, thus you block that with a flat rate, judged by the type of armor you wear. Light armor maybe only grant a flat rate of 5% for each equipped. & so on, nothing to special. 1 Share this post Link to post Share on other sites