Modme Forums
Menu:

2 power switches

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


ModmeBot:

Thread By: Ahmed02354
Can I make 2 power switches each for another area?


ModmeBot:

Reply By: lightningplayz23

Ahmed02354
Can I make 2 power switches each for another area?

I wish I knew how but that would be cool!


ModmeBot:

Reply By: CaptainHT
Have two or more power switch prefabs, one switch in one zone, and another switch in another zone. Stamp both of the power switch prefabs. (Click prefab at the top and click "stamp.") Then add a Kvp, The property/ key needs to be "Script_int," while the value needs to be "power_zone." After you are done with this, have anything that requires power in your desired zone. After you have put your Perk or Pack a Punch machine in the desired zone, stamp the perk or pap. Then go to your perk machine or pack a punch and add a kvp. The same as before the property/key needs to be "Script_int," while the value needs to be "power_zone." Save then compile and run your map. Then you should have multiple power switches in your map.

P.S. I haven't tested, but you should have to put a variable after the "power_zone" for example: "power_zone_a" It should work. But you can experiment with this.


ModmeBot:

Reply By: SwanK
Please post results, I'm trying to do the same thing and have no idea how to do this.


ModmeBot:

Reply By: mathfag
Get 2 power switch prefabs and stamp them. Remove the structs (or you'll get client field mismatch). Change the targetnames of the triggers to elec_switch1 and elec_switch2. Change the handle models into a script_models and change their targetnames to elec_switch_handle1 and elec_switch_handle2. Copy paste this code in to your mapname.gsc


in function main(), under zm_usermap::main();

thread power();

At the bottom:
/////////////////////////POWER///////////////////////////////////
function power()
{
level.power1 = 0;
level.power2 = 0;

thread power1();
thread power2();

switch1 = GetEnt("elec_switch1","targetname");
switch1 SetHintString("Flip power switch");
switch1 SetCursorHint("HINT_NOICON");

switch2 = GetEnt("elec_switch2","targetname");
switch2 SetHintString("Flip power switch");
switch2 SetCursorHint("HINT_NOICON");
}


function power1()
{
switch1 = GetEnt("elec_switch1","targetname");
switch_handle1 = GetEnt("elec_switch_handle1","targetname");


while(1)
	{
	switch1 waittill("trigger", player);
	level.power1 = 1;
	thread power_done();
	switch_handle1 RotateRoll(-90,0.7,0.3,0.1);
	break;
	}

switch1 Delete();
}


function power2()
{
switch2 = GetEnt("elec_switch2","targetname");
switch_handle2 = GetEnt("elec_switch_handle2","targetname");

while(1)
	{
	switch2 waittill("trigger", player);
	level.power2 = 1;
	thread power_done();
	switch_handle2 RotateRoll(-90,0.7,0.3,0.1);
	break;
	}
	
switch2 Delete();
}


function power_done()
{

while(1)
	{
	self waittill(level.power1 >= 1 && level.power2 >= 1);
	if(level.power1 == 1 && level.power2 == 1)
	level flag::set("power_on");
	break;
	}

}
/////////////////////////POWER_END///////////////////////////////


ModmeBot:

Reply By: itznvy
Script works. Only issue, however it is small is that whenever you flip the switches for power they don't move up like they did before. My guess is because you said to remove the script_struct. +1 win.


ModmeBot:

Reply By: mathfag

itznvy
Script works. Only issue, however it is small is that whenever you flip the switches for power they don't move up like they did before. My guess is because you said to remove the script_struct. +1 win.

they do flip. maybe you forgot to change them to script_models


ModmeBot:

Reply By: itznvy

mathfag
itznvy Script works. Only issue, however it is small is that whenever you flip the switches for power they don't move up like they did before. My guess is because you said to remove the script_struct. +1 win. they do flip. maybe you forgot to change them to script_models

I made them script models i'll double check


ModmeBot:

Reply By: mathfag

itznvy
mathfag itznvy Script works. Only issue, however it is small is that whenever you flip the switches for power they don't move up like they did before. My guess is because you said to remove the script_struct. +1 win. they do flip. maybe you forgot to change them to script_models I made them script models i'll double check

sorry. i forgot to say that you need to give the handles targetnames: elec_switch_handle1 and elec_switch_handle2