Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Can some one show me what I am doing wrong here: /* its not working or showing the texture, if there is a better / easier way of doing it let me know. But I need to be able to do it dynamically, not through the editor actions. |
||||
|
the problem with AI code is you still need to be able to read the code to understand if problems occur. do yourself a favor and learn the basics of JS and read CC's JS API. that said, maybe try copying and pasting the entire JS API documentation into the AI you are using and try again, step by step. first get it to properly print a string to CC's console using print() instead of console.log(). then move onto more advanced stuff. good luck. |
||||
|
A simple response was all that was needed. Trying to talk down on me for using ai for one behavior when everyone uses ai... And more advanced stuff really... I built the entire VR platform CopperCube will now use for EXE and Webgl... what have you done??? Ill wait... Im new to the exe platform I used only webgl for years so excuse me if i get some of the calls wrong.... |
||||
|
@archangel, if you give a more detailed description what scene node setup you want to use and what you want to achieve with it in detail, I will try to help. |
||||
|
Thank you @hadoken. But Nevermind Im just going to switch back to using overlays since I got that working on the platform now. I was using plane meshes for the inventory on this one. But i already know what to do with overlays so im good, |
||||
|
Here is a slightly modified version of the original script, which can serve as a very rough starting point for a limited, minimal "item storage system". Warning: My experience with JavaScript and CopperCube is also limited and minimal. I briefly tested the modified script with the Windows target: it seems to "work". Basic scene layout: - 1 camera -> Free flying camera - 4 planes -> representing the 4 default inventory slots: slot1, slot2, slot3, slot4 - 1 cube "my_item" -> example item object -> behavior: "When clicked on this do something" -> executes the "Add an item to ..." action (ItemNode: my_item, ItemImage: testitem.png, SlotCount: 4) Additional Notes: - Script filename: "action_add_item_to_inventory.js" - As suggested by user "guest", calls to "console.log" have been translated into calls to "print" - The number of default "inventory slots" has been reduced from 16 to 4 - Scheme of CopperCube variables used by the script: "slot1_item", "slot2_item", ..., "slotX_item"
Parameters of the action: - "ItemNode" = scene node, game-world object that represents the item to be added to the inventory - "ItemImage" = relative path to a texture file; will be displayed on the "inventory slot" plane - "SlotCount" = number of "inventory slots" IMPORTANT: The filename in ItemImage must point to a valid texture file in the project / game directory (relative path). Example path: "imagedir\\testitem.png" - If you want to add more "inventory slots", adjust the SlotCount-parameter and place additional plane objects with appropriate names ("slot5", "slot6", "slot7", etc.) Ideas for further d |
||||
|
Continuation of the previous post: Ideas for further development: - After adding the item to the inventory, "deactivate" the item-object in the game world - Add a label (2D overlay) to the item slots that displays the name of the currently selected item - Add actions for specific events that can be triggered by the script: Inventory full, Item picked up / not picked up - Add a function to select specific inventory slots and trigger item-usage - Add a function to drop items from selected slots - And so on... Thanks to the original author/publisher who made this script available. If there are any major errors in the modified script or in my descriptions, I would appreciate it if more experienced users would point them out. |
||||
|
|