ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Programming and Scripting
forum topic indicator Water/Lava Damage
person icon
chicoporter
Registered User
Quote
2025-01-27 16:38:35

I have a level that has lava in. I'd like to cause damage to anything that walks into or falls into the lava. Does it make sense to make a huge bullet with limited range and have it shoot from the water itself. It sort of works. Any suggestions?

person icon
hadoken
Registered User
Quote
2025-01-27 18:33:21

equip your player or npc with an "Every every seconds do something" behavior plus the following "execute Java Script" action code (change "cubeMesh1" & "my_lava_node" according to your case):


var node = ccbGetSceneNodeFromName("cubeMesh1");
var node_position = ccbGetSceneNodeProperty(node, "Position");

var my_lava_node = ccbGetSceneNodeFromName("my_lava_node");

var check_variable = ccbDoesLineCollideWithBoundingBoxOfSceneNode(my_lava_node, node_position.x, node_position.y, node_position.z, node_position.x, node_position.y + 1, node_position.z)

if(ccbDoesLineCollideWithBoundingBoxOfSceneNode(my_lava_node, node_position.x, node_position.y, node_position.z, node_position.x, node_position.y + 1, node_position.z)) ccbSetCopperCubeVariable("lava_check", 1);
else ccbSetCopperCubeVariable("lava_check", 0);

print("CopperCube variable <lava_check> = " + ccbGetCopperCubeVariable("lava_check"));


then check CopperCube variable (in this case "lava_check") also within an "Every every seconds do something" behavior to trigger damage or whatever


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 |