ID:2365830
 
(See the best response by Kaiochao.)
Trying to explain what I can't solve
/obj/parent
var/datum/parent/objs_datum = null

/obj/parent/child1
/datum/parent/child1/objs_datum = null


I am in need of help on the question, of how to redefine a type of variable.

Basically, a parent has variable objs_datum, it's type is /datum/parent, I need the child of the object, to have objs_datum type be set to /datum/parent/child1
You can't. Once the type has been set, it's set.

You should be setting the type to the lowest level interface possible.
The thing is. The lowest level interface doesn't have the variables I use later in the code. So, the solution would be just giving the parent all the variables it's just child has? Code is as follows by the way basically:
/datum/playing_cards
var/name_card = ""

/datum/playing_cards/advanced
var/card_number = ""

/obj/item/toy/play_cards
var/datum/playing_cards/card_info

/obj/item/toy/play_cards/advanced
/datum/playing_cards/card_info

/obj/item/toy/play_cards/examine()
usr << "[card_info.name_card]"

/obj/item/toy/play_cards/advanced/examine()
usr << "[card_info.name_card] #[card_info.card_number]"


I mean, oh well.
In most cases, where you are running into this issue, you are designing data structures poorly.

Without more information about what you are trying to do, I can't offer any advice on adjusting your thinking.
In response to Luduk
Best response
In that case, I would set it up so the text shown when a card is examined is given by the card datum. That way, anything specific to child types can be included through overrides.

For example:
card_info
var
name

proc
GetDescription()
return name

card_info/advanced
var
number

GetDescription()
return "[..()] #[number]"

obj/item/toy/play_card
var
card_info/card_info

examine()
usr << card_info.GetDescription()