Modme Forums

Trigger that makes a prefab appear and disappear.

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


ModmeBot:

Thread By: Yasser143
Is there a way for me to make my prefab model, disappear when the player holds F on it, and make it appear somewhere else in my map?


ModmeBot:

Reply By: natesmithzombies
Prefabs aren't scriptable by themselves. You need to make everything in the prefab a script_model or a script_brushmodel. Depending on how many things you have in your prefab this could be a bad idea as there is a limit to the amount of entities, aka script_models/brushmodels, you can have in the game at one time. If it is <5 I wouldn't think it is an issue. There are multiple ways to go about doing it though if you decide to take that route


ModmeBot:

Reply By: Yasser143
Yea its going to be 2 only, and if i cant do prefabs, what about models?


ModmeBot:

Reply By: Blink-420

Yasser143Yea its going to be 2 only, and if i cant do prefabs, what about models?


Would need to be a script_model like he said


ModmeBot:

Reply By: Yasser143
But he still didn't explain how to make the "script_brushmodel" disappear/ appear.


ModmeBot:

Reply By: natesmithzombies
This should do what you need. Read through the code for the proper targetnames and thread this in your mapname.gsc

function hide_and_show()
{
	level endon( "intermission" ); 

	models = GetEntArray( "hide_show_model", "targetname" ); 
	trig = GetEnt( "hide_show_trig", "targetname" ); 
	trig SetCursorHint( "HINT_NOICON" );
	trig SetHintString( "Press and Hold ^3&amp;&amp;1^7 to Hide Models" ); 

	foreach( model in models )
		model.is_visible = true; 

	while(1)
	{		
		trig waittill( "trigger", player ); 
		foreach( model in models )
		{
			if( model.is_visible )
			{
				model hide(); 
				model.is_visible = false; 
				wait(2); 
				trig SetHintString( "Press and Hold ^3&amp;&amp;1^7 to Show Models" ); 
			}
			
			else if( !model.is_visible )
			{
				model show(); 
				model.is_visible = true; 
				wait(2); 
				trig SetHintString( "Press and Hold ^3&amp;&amp;1^7 to Hide Models" ); 
			}
		}
	}
}


ModmeBot:

Reply By: Yasser143

natesmithzombiesThis should do what you need. Read through the code for the proper targetnames and thread this in your mapname.gsc



Thx Nate for the script, but i was asking for one that made the script_model disappear from one location and appears in another location. Not one that makes the script_model disappear and reappear in the same location. Also wanted one that removes the trigger when used once time, so basically you cant use the trigger anymore after one use. I understand if u are to busy to help me.


ModmeBot:

Reply By: natesmithzombies

Yasser143
natesmithzombiesThis should do what you need. Read through the code for the proper targetnames and thread this in your mapname.gsc



Thx Nate for the script, but i was asking for one that made the script_model disappear from one location and appears in another location. Not one that makes the script_model disappear and reappear in the same location. Also wanted one that removes the trigger when used once time, so basically you cant use the trigger anymore after one use. I understand if u are to busy to help me.


I will have time this weekend. I can make and release an entire script as other users might find it useful to have something like this too. So I have some questions before I make it:

1) Do you want the meteor loop sound to play on the trigger while it is waiting to be used?

2) Do you want the order to randomize?

3) What reward do you want after triggering it?

4) How do you want it to be triggered? Use? Touch? Shoot?

It wont take me long. I just can't do it without being at my home computer and me being home is all too rare anymore lol


ModmeBot:

Reply By: Yasser143

natesmithzombies
Yasser143
natesmithzombiesThis should do what you need. Read through the code for the proper targetnames and thread this in your mapname.gsc



Thx Nate for the script, but i was asking for one that made the script_model disappear from one location and appears in another location. Not one that makes the script_model disappear and reappear in the same location. Also wanted one that removes the trigger when used once time, so basically you cant use the trigger anymore after one use. I understand if u are to busy to help me.


I will have time this weekend. I can make and release an entire script as other users might find it useful to have something like this too. So I have some questions before I make it:

1) Do you want the meteor loop sound to play on the trigger while it is waiting to be used?

2) Do you want the order to randomize?

3) What reward do you want after triggering it?

4) How do you want it to be triggered? Use? Touch? Shoot?

It wont take me long. I just can't do it without being at my home computer and me being home is all too rare anymore lol


1.No, could make a meteor noise when picked up.

2.No

3.No reward (But if possible, when reappeared at the other location, the model is like a soul chest and at the end lets you pick up the model after completion).

4. Use (a hidden trigger so players don't see the icon to pick it up).

Sorry if Im asking for too much.


ModmeBot:

Reply By: Yasser143

natesmithzombies
Yasser143
natesmithzombiesThis should do what you need. Read through the code for the proper targetnames and thread this in your mapname.gsc



Thx Nate for the script, but i was asking for one that made the script_model disappear from one location and appears in another location. Not one that makes the script_model disappear and reappear in the same location. Also wanted one that removes the trigger when used once time, so basically you cant use the trigger anymore after one use. I understand if u are to busy to help me.


I will have time this weekend. I can make and release an entire script as other users might find it useful to have something like this too. So I have some questions before I make it:

1) Do you want the meteor loop sound to play on the trigger while it is waiting to be used?

2) Do you want the order to randomize?

3) What reward do you want after triggering it?

4) How do you want it to be triggered? Use? Touch? Shoot?

It wont take me long. I just can't do it without being at my home computer and me being home is all too rare anymore lol




Just waiting on an update on the script Nate...