Jump to content
AeghtyAteKees

Change an item's name and icon [index] in-game?

Recommended Posts

To my knowledge , it's not doable with events, it's doable with scripts but it's a bit complicated because you need to add additional data to the save file.

 

I think it would be better if you made two items and you get one version if the switch is on,the other version if the switch is off.

And at the moment you activate the switch ,you remove the item from the inventory and replace it with the same number of the other item

Share this post


Link to post
Share on other sites

I normally would, but in the unfortunately specific scenario I've ended up in, I need many more than two variants. It's doable, for sure, I was just trying to save database space if it were possible. Thanks!

 

Although: I did mange to figure out the naming half. Found a nifty script that permits text codes in database names, descriptions, etc. So I just set a variable to a string and named the item \v[n]. Wish there was something as easy to do about the icon!

Edited by AeghtyAteKees

Share this post


Link to post
Share on other sites

Send me the script you are using ,modifying it to also being able to change icons shouldn't be too complicated.

Share this post


Link to post
Share on other sites

The script you gave me a link to works way differently than what I imagined so it threw me off at first but looking at it again,it gave me an idea for a solution.

 

Try this script:

 

https://www.dropbox.com/s/tdp27yi7osyh8bu/icon_to_variable.rb?dl=0

 

It let you choose some icon_indexes that instead of being drawn directly are redirected to the value of a specific variable

For example this

192 => 1,

means that the icon index 192 (RTP icon for potio)n will be redirected to draw the the icon whose index is equal to variable 1

Share this post


Link to post
Share on other sites

I really appreciate it! This works fine with the default menu, displaying the correct icon(s) I set. However, some scripts apparently store the icon index and don't update it (considering it was never meant to change), such as Modern Algebra's "Hover Alerts" and Xail's "Icon Item Menu". I suppose it may be my best option to make many different items for the icon changes I need? (Ugh.)

 

However, I do still need to figure out how to change the name of an item. How can I access that data? Would that even require a script?

Edited by AeghtyAteKees

Share this post


Link to post
Share on other sites

@chungsie : yes but no, it would work but it wouldn't be saved
 
@AeghtyAteKees
Have you tried putting my script above the scripts that show trouble,it changes the basic icon drawing so it should work
 

I normally would, but in the unfortunately specific scenario I've ended up in, I need many more than two variants. It's doable, for sure, I was just trying to save database space if it were possible. Thanks!

Although: I did mange to figure out the naming half. Found a nifty script that permits text codes in database names, descriptions, etc. So I just set a variable to a string and named the item \v[n]. Wish there was something as easy to do about the icon!


Also why the naming half doesn't work anymore?

Share this post


Link to post
Share on other sites

I mean, my roundabout naming is still working, which is fine. I wasn't aware that directly changing the name of the actual item wouldn't be saved, but that's okay. I can keep doing what I've been.

 

As for the icon, here are the scripts in question if you could maybe find why they don't update properly.

 

Xail Icon Item Menu

Modern Algebra Hover Alerts

 

Other scripts, such as Modern Algebra's ATS, allows icons to be drawn into the message window, and that appears to be working.

Also, in Xail's Icon Item Menu, the icon is properly updated in the help window, just not in the item list.

 

So it kinda seems like it isn't an issue with your script. Haha.

 

Thank you!

Share this post


Link to post
Share on other sites

Those scripts use their own icon methods so it wasn't redirected 

 

add this script below the two scripts you mentionned

class Window_ItemList_Icon < Window_ItemList

	alias icon_to_variable_draw_item_icon draw_item_icon
	def draw_item_icon(icon_index, x, y, enabled = true)
		if Icon_Change::IconToVariable[icon_index]
			index = $game_variables[Icon_Change::IconToVariable[icon_index]]
		else
			index = icon_index
		end
		icon_to_variable_draw_item_icon(index, x, y, enabled = true)
	end
	
end

class Sprite_HoverAlert < Sprite_Base

	alias icon_to_variable_maha_draw_icon maha_draw_icon
	def maha_draw_icon(icon_index, x, y)
		if Icon_Change::IconToVariable[icon_index]
			index = $game_variables[Icon_Change::IconToVariable[icon_index]]
		else
			index = icon_index
		end
		maha_draw_icon(index, x, y)
	end
	
	alias icon_to_variable_maha_draw_icon_with_hue maha_draw_icon_with_hue
	def maha_draw_icon_with_hue(icon_index, x, y, enabled = true)
		if Icon_Change::IconToVariable[icon_index]
			index = $game_variables[Icon_Change::IconToVariable[icon_index]]
		else
			index = icon_index
		end
		icon_to_variable_maha_draw_icon_with_hue(index, x, y, enabled = true)
	end
	
end

That's why I said it's complicated ,you can simply change the item database in-game but saving and loading the changes is very troublesome .
That's also why I thought changing icons should be easy if you can already change the name. I thought the script you mentionned already have a way to save/load changes in the item database 

Edited by Shiggy

Share this post


Link to post
Share on other sites

I did a few mistakes try this instead

class Window_ItemList_Icon < Window_ItemList

	alias icon_to_variable_draw_item_icon draw_item_icon
	def draw_item_icon(icon_index, x, y, enabled = true)
		if Icon_Change::IconToVariable[icon_index]
			index = $game_variables[Icon_Change::IconToVariable[icon_index]]
		else
			index = icon_index
		end
		icon_to_variable_draw_item_icon(index, x, y, enabled = true)
	end
	
end

class Sprite_HoverAlert < Sprite_Base

	alias icon_to_variable_maha_draw_icon maha_draw_icon
	def maha_draw_icon(icon_index, x, y)
		if Icon_Change::IconToVariable[icon_index]
			index = $game_variables[Icon_Change::IconToVariable[icon_index]]
		else
			index = icon_index
		end
		maha_draw_icon(index, x, y)
	end
	
	alias icon_to_variable_maha_draw_icon_with_hue maha_draw_icon_with_hue
	def maha_draw_icon_with_hue(icon_index, icon_hue, x, y)
		if Icon_Change::IconToVariable[icon_index]
			index = $game_variables[Icon_Change::IconToVariable[icon_index]]
		else
			index = icon_index
		end
		maha_draw_icon_with_hue(icon_index, icon_hue, x, y)
	end
	
end

Share this post


Link to post
Share on other sites

Still getting the error.

 

EDIT: The error doesn't occur from the hover alert script being installed, but rather being used (via a "comment" command).

 

Thank you for working with me.

Edited by AeghtyAteKees

Share this post


Link to post
Share on other sites

Try changing this 

maha_draw_icon(index, x, y)

into

icon_to_variable_maha_draw_icon(index, x, y)

 

and

maha_draw_icon_with_hue(icon_index, icon_hue, x, y)

into

icon_to_variable_maha_draw_icon_with_hue(index, icon_hue, x, y)

Share this post


Link to post
Share on other sites
class Window_ItemList_Icon < Window_ItemList

	alias icon_to_variable_draw_item_icon draw_item_icon
	def draw_item_icon(icon_index, x, y, enabled = true)
		if Icon_Change::IconToVariable[icon_index]
			index = $game_variables[Icon_Change::IconToVariable[icon_index]]
		else
			index = icon_index
		end
		icon_to_variable_draw_item_icon(index, x, y, enabled = true)
	end
	
end

class Sprite_HoverAlert < Sprite_Base

	alias icon_to_variable_maha_draw_icon maha_draw_icon
	def maha_draw_icon(icon_index, x, y)
		if Icon_Change::IconToVariable[icon_index]
			index = $game_variables[Icon_Change::IconToVariable[icon_index]]
		else
			index = icon_index
		end
		icon_to_variable_maha_draw_icon(index, x, y)
	end
	
	alias icon_to_variable_maha_draw_icon_with_hue maha_draw_icon_with_hue
	def maha_draw_icon_with_hue(icon_index, icon_hue, x, y)
		if Icon_Change::IconToVariable[icon_index]
			index = $game_variables[Icon_Change::IconToVariable[icon_index]]
		else
			index = icon_index
		end
		icon_to_variable_maha_draw_icon_with_hue(icon_index, icon_hue, x, y)
	end
	
end

In the last script I gave you ,it should be like the above example

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×