Modme Forums

Move multiple brushmodels

Game Modding | Call of Duty: Black Ops 3 | Scripting


ModmeBot:

Thread By: eDeK
How i can move many brushmodels in an loop with the same targetname and the same movement?

while(1)
        {
            muro_uno MoveZ(230,5);
            wait 45;
            muro_uno MoveZ(-230,5);
            wait 5;     
        }   


ModmeBot:

Reply By: mathfag

brushes = GetEntArray([name],"targetname"); //ARRAY
foreach(brush in brushes)
	{
	brush MoveTo(<point>,<time>,[acceleration time],[deceleration time]); //might want to use moveZ or MoveX or whatever because this makes them all go to the same spot
	IPrintLnBold("moved brush");	
	}</time></point>


ModmeBot:

Reply By: eDeK

mathfag
brushes = GetEntArray([name],"targetname"); //ARRAY foreach(brush in brushes) { brush MoveTo(<point>,<time>,[acceleration time],[deceleration time]); //might want to use moveZ or MoveX or whatever because this makes them all go to the same spot IPrintLnBold("moved brush"); }

Im trying it but only 1 brushmodel move perfect, the second brushmodel dont move, i dont know what im doing wrong.
function walls() 
{     
	brushes = GetEntArray("murouno","targetname"); 

	foreach(brush in brushes)
	{
	    while(1)
            {	    	
	    	brush MoveZ(230,5);
                wait 45;
                brush MoveZ(-230,5);
                wait 10; 
            }            
        }
}
</time></point>


ModmeBot:

Reply By: Abnormal202

eDeK
mathfag brushes = GetEntArray([name],"targetname"); //ARRAY foreach(brush in brushes) { brush MoveTo(<point>,<time>,[acceleration time],[deceleration time]); //might want to use moveZ or MoveX or whatever because this makes them all go to the same spot IPrintLnBold("moved brush"); } Im trying it but only 1 brushmodel move perfect, the second brushmodel dont move, i dont know what im doing wrong. function walls() { brushes = GetEntArray("murouno","targetname"); foreach(brush in brushes) { while(1) { brush MoveZ(230,5); wait 45; brush MoveZ(-230,5); wait 10; } } }

There is no need for that while there, that will essentially prevent the foreach from ever touching a brush other than the first one in the array. Also I assume you want all brushes to move at once? in which case you will need two foreach loops because otherwise every brush will complete the two movements before the next one starts.
function walls() 
{     
	brushes = GetEntArray("murouno","targetname"); 

	foreach(brush in brushes)
	{    	
	    brush MoveZ(230,5);          
        }
        wait 45;
        foreach(brush in brushes)
	{    	
            brush MoveZ(-230,5);          
        }
        wait 10;
}
If you want these actions to repeat continuously, then you could put a while around the whole thing; just not inside a foreach loop.</time></point>


ModmeBot:

Reply By: eDeK
Exact, now work perfect, thanks for the help guys.