I’ll be brief)
For example I have a sword, I spawn it in the game (as reference) and I want to enchant it. Please give advice on how to do this?)
If I enchant the main actor of the sword - all the swords will spawn enchanted.
So where to get reference on it?)
if you want to affect a specific actor then you need to get a reference to it, to do that however we will need more information. for example is the sword a currently equipped item? if it is then you could probably reference it through the character since the character should know whats equipped. what kind of game are you making? if its a mouse and keyboard style then you could use a click event to select the sword. or are you working in widgets to do all this? if thats the case then theres other ways to handle it.
basically tell is a bit about your game and its setup so we can understand the context of what your going for. we can be more specific in a answer if we have more details. beyond that it goes back to the standard answer of you get references though variables, overlaps, traces, etc.
i would make a main class and leave it just core code and then make a child to that actor and change each child to represent a different class like fire ice electric maybe make a structure to hold all the main code that way when you spawn in realtime you just go back and set the class and pull all info that way if you would like further details on how to do this i will be happy to email you a example and you can look over or use it. but Don’t touch main actor make a child to the main…
so kk, let it be crafting system.
I craft sword (spawn it in game) and then i can to chose enchantment to it (let it be “fire”). After pushing “craft” button - my fire sword is added to inventory, so i can equip it and unequip. it pretty simple.
Trouble is when i trying to craft another sword, - it already have setups of “fire” sword (because i’m using enchantment on main actor sword, not on it’s reference in game)
Also i have tryed to reset my sword to defaults method, but this way enchantment gone, from already enchanted sword.
With another words if i have 10 swords in game and if i’l enchant 1 of them with fire - they all became fire swords. So how to operate with only one of them?)
i’l try it, ty.
child actor - it can be useful here
Now 12/31, 23:55
And i made it! ))
Solution was “invisible socket” method
so after i craft weapon i made script to locate it to special socket in characters skeleton, and set it invisible. also made icon/button in inventory to wear/unwear this weapon (means make it visible and locate to hands and back)
This way i’m not touching “Main weapon actor”, just operating with already crafted items
Ty all for support!
And happy new year!)
Anyway, i think there is more correct method to do this.
To be clear about what it all - remember “Lineage-2”. For example u have 2 same swords (same are child actors), one of them u enchant, and now it “sword+1”. Another sword still without enchanting.
How to make this?
Solved, ty a lot for help