Skip to content

Trying to get CustomMonsterModel NodeFactory<NCreatureVisuals>/CustomVisualPath to work. #104

@SyraLessThanThree

Description

@SyraLessThanThree

The only way i could get an enemy to load from a single image (with no scene) was this.

public override NCreatureVisuals? CreateCustomVisuals() {
    return NodeFactory<NCreatureVisuals>.CreateFromResource(ResourceLoader.Load("res://CreatureModTemplate/images/scary_stickman.png"));
}

Im not sure whats intended so i guess im using this issue just as an advice thread/bug report to compile/fix it, and understand it to later put it into a Tutorial.

Here are other ways i tried (that i remember).

//ERROR: System.Exception: Node factory for NCreatureVisuals does not support generation from resource type String
public override NCreatureVisuals? CreateCustomVisuals() {
    return NodeFactory<NCreatureVisuals>.CreateFromResource("res://CreatureModTemplate/images/scary_stickman.png");
}

//System.InvalidCastException: Unable to cast object of type 'Godot.CompressedTexture2D' to type 'Godot.PackedScene'
public override string? CustomVisualPath => ResourceLoader.Load("res://CreatureModTemplate/images/scary_stickman.png").ResourcePath;

//ERROR: System.InvalidCastException: Unable to cast object of type 'Godot.CompressedTexture2D' to type 'Godot.PackedScene'.
public override string? CustomVisualPath => "res://CreatureModTemplate/images/scary_stickman.png";

Also generally ive seen

ERROR: Cannot open file 'res://scenes/creature_visuals/creaturemodtemplate-static_stickman.tscn'.
ERROR: Error loading resource: 'res://scenes/creature_visuals/creaturemodtemplate-static_stickman.tscn'.

Which i assume are just "pass-through" errors, but i thought i would mention them here.

https://github.com/SyraLessThanThree/CreatureModTemplate
(if someone wants full rights to that repo just so we can collaboratively tinker lmk)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions