ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Programming and Scripting
forum topic indicator Need help with scripted behavior
person icon
2Deadly
Guest
Quote
2024-02-04 05:33:26

Hey guy's first and foremost thank you if you've come here to help, it is truely appreciated.
Okay so, i want to know if its possible to create a "scripted Behavior" that i can attach to an item, so that when the player clicks on the item the code will change the "Image" property of a 2d overlay node. to show a specific image. in example i click on an item named bow and the script will look for bow.png and add that to the 2d overlay "image" property. is this possible and how? thank you!

person icon
Guest
Guest
Quote
2024-02-04 08:30:03

Why not just hide a 2D Overlay with the bow image already attached to it and then just make it visible when you interact with the bow model?

person icon
2deadly
Guest
Quote
2024-02-04 16:33:31

Because that would be a very limited way of doing it and if my game has a million items, am I supposed to make a box for all of them… locks that slot for only that one item. I want to have a regular functioning inv like a classic mmorpg. I’m a beginner programmer so I get stuck but for a seasoned programmer this should be very easy it doesn’t sound too hard to do I just don’t know how to do it in coopercube since there’s only a way to change a texture but the overlays don’t use textures they have a image property and if I can only find out to how manipulate that property, it would be as easy as that

person icon
2deadly
Guest
Quote
2024-02-04 16:35:51

The option you propose I already know and how to do it. But imo it’s stupid and basic and lock that one slot into that one item only which is to say the least rudimentary.

person icon
Guest
Guest
Quote
2024-02-05 00:20:32

Read the documentation. Check out ccbSetSceneNodeProperty(). Look at the properties for the 2D Overlay. That's basic programming, eh? The idea that your game is going to have a million items gave me a chuckle. WOW has around 100,000 or so. Dream big, friend. Good luck.

person icon
just_in_case
Moderator
Quote
2024-02-06 18:46:51

There are many example projects lying in the community that loads the texture and apply it on 2D overlay.

There is a clone of age of empires somewhere that I created a few years ago, it uses somewhat similar technique to display hud items, maybe you can use that, but it is better to read the documentation than calling suggestion by other users stupid and all.


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |