• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Legacy GM Replacing a sprite from a external file directory Problems



I am making a program to pose characters using a ragdoll setup and I have been trying to make it possible to replace a sprite for a body part from external image file directory.

.png 200x200

But when I replace say the left arm on one doll, all the left arms of all the other dolls change aswell!

I would like only the part I have selected to change, while keeping the other parts as the images I previously selected for them.

This is the basic code I am using


if id=global.selctall

if Held=true
if sprite_exists(me)
   var orspr = sprite_add(get_open_filename_ext("Image File|*.png;*","", working_directory, "Load A Part"),1,false,false,90,90);
I have also tried this.


if Held=true
var file;
file = get_open_filename_ext("Image File|*.png;*","", working_directory, "Load A Part");
if file != ""
I know the code is a bit rough but any help would be appreciated.

Replacing sprites to make multiple unique characters from externally drawn images


Forum Staff
To quote the manual:
https://docs.yoyogames.com/source/dadiospice/002_reference/game%20assets/sprites/sprite_assign.html said:
This function takes two previously created (or included) sprite indexes, and copies the image from one to the other. In this way you can copy (or "clone") one sprite into another index. Note that you cannot copy to a game resource. You have to have created the sprite to be copied to previously using the sprite_add or sprite_duplicate functions.
https://docs.yoyogames.com/source/dadiospice/002_reference/game%20assets/sprites/sprite_replace.html said:
This function works in almost the exact same manner as sprite_add, only instead of returning the index of the sprite you are importing, it overwrites a previously created sprite index. You must use a sprite index that has been created and stored in a variable using other functions like sprite_add or sprite_create_from_surface, and not one from the resource tree as you cannot replace built-in assets.