• isWeldedTo() colour changing
    1 replies, posted
hmm... I have a problem bcz when I want to change colour of all entities welded to a plate on which e2 is placed, it changes color only of the plate. To make it more Clear: [code] entity():isWeldedTo(2):setColor(255,255,255,0) entity():isWeldedTo(3):setColor(255,255,255,0) entity():isWeldedTo(4):setColor(255,255,255,0) [/code]
1: Post the whole code. 2: You ARE aware that the color it's setting it to is (255,255,255), which won't change a prop's color if it hasn't already been colored, right? 3: A better alternative to isWeldedTo() to get all entities welded to a plate is to use E:getConstraints(), then loop through that and change color. Here's an example: [code] @name Color Changer @inputs Change @persist Base:entity Props:array interval(20) #Set Entities Base = entity():isConstrainedTo(1) Props = Base:getConstraints() #Cloak if(Change & ~Change) { for(Cycle = 1, Props:count()) { # holoCreate(1,entity():pos(),vec(1000,1000,1000),ang(0,0,0), vec(0,0,0)) Props[Cycle,entity]:setColor(255,0,0,0) # ATTENTION! THIS IS THE COLoR YOU WANT IT TO BE wHEN THIS IS "ON" } } if(!Change & ~Change) { for(Cycle = 1, Props:count()) { # holoCreate(1,entity():pos(),vec(100,100,100),ang(0,0,0), vec(0,0,0)) Props[Cycle,entity]:setColor(255,255,255,0) # ATTENTION! THIS IS THE COLoR YOU WANT IT TO BE wHEN THIS IS "OFF" timer("Unbox",1000) } } [/code]
Sorry, you need to Log In to post a reply to this thread.