Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I have a problem where I can't get the engine to access the directory that contains the textures. I'm using as base the externally loading texture script that is available on the Ambiera website, and I want to modify it to be able to specify which directory will be used to load the textures. I have minimal scripting knowledge, the only thing I know is to edit an existing script and create some variables, so I'm stuck editing that script. I've already managed to create a new option to decide where the textures directory will be, I've also already created the variable (I believe), and I also took the opportunity to reduce the names of other properties. If anyone can help me, I am extremely grateful Original script: /* Modified script: /* Oh, and when I open the game, I get a message saying that it was not possible to set the material property because there are a wrong amount of parameters. (It occurs when I add the variable "dir" to the option "ccbSetSceneNodeMaterialProperty", on line 21). If the image doesn't appear, this is the link to see it: https://prnt.sc/1bwgmnj |
||||
|
well as per the above code you using an extra parameters in Line 21, that might be the reason it is not working. You added the var "dir" as an extra parameter, you need to replace it with tex, but then it will not load the texture because it is just a string value. by the way, to load textures from a directory you don't need to modify the script just put the directory path along with the texture name in your "texture to load " string parameter in the action. for example, in your editor, you added the above unmodified original action to a behavior, and suppose there is a texture in a folder named "data" then you simply put "data/texture.png" in your texture to load, now it will load the texture from that directory if it exists in the project folder. hope that helps. |
||||
|
Omg, i'm very dumb, hahaha. Thx bro, you saved me. On my game the player has nightmares, so the textures has to change when a trigger activates, and some of these triggers are to change the textures. Again, thanks for the help :D |
||||
|
How would you specify the second texture in the model? For example, texture: 'sam/grey.jpg' works for the first texture but how do I access the second texture? |
||||
|
@barry, go to irredit/irrlicht properties and you will see 4 textures slot in the materials property there. You can then attach upto 4 textures in there, but they won't work if your material doesn't support multiple textures. It depends on your material type. |
||||
|
I can see the textures in the model but cant figure out how to access the different texture layers from the script. |
||||
|
@Barry, I don't know what you are trying to achieve and what are you doing in the script. In order to get the second texture of a mode via script you can use the below command: var s = ccbGetSceneNodeFromName("cubeMesh1"); it will print the name of the second texture assigned to your cubeMesh1, you can assign second texture to the cubemesh with the help of irredit/irrlicht properties. Hope that helps :) |
||||
|
Thanks! |
|