Scripting question!


(Drakir) #1

I have a question about scripting.
I have a func_static and a misc_gamemodell i want to hide at the begining of the game.

And then getting it to show at a certain state.

So i have added this to my game_manager.

// Set Gastanks not visible at start
setstate airtank1_body 	invisible
setstate airtank1 	invisible

But the game tells me that it cant find any entity that corresponds to that script call.

So that makes me wonder if i am using the wrong entitys to call this scripting upon or what could cause this to not work.


(hummer) #2

Do you have the targetname in the misc_gamemodel set to airtank1_body? Also, don’t use func statics. Use a script_mover instead. func_statics tend to be buggy when turned invisible, etc.

Also, you could give your mover and gamemodel scriptnames (the same value as the targetname) and create a section in the script for your objects… then just turn them off in the spawn section of their script.


(Drakir) #3

Well i have booth scriptname and targetname set to the same call.

Will try to change the static to mover instead!


(G0-Gerbil) #4

Entities can sometimes take a few cycles of the game engine to register properly - have you tried chucking in a ‘wait 200’ before them?
Also, I gave up on func_statics, and simply changed them to script_movers.


(neotic) #5

I have a similar problem; I thought I’d just use this thread instead of a new one.

I have a func_explosion that works nicely. For the broken walls that will be angled to look as if there was an explosion, I made an .ase model from brushes to fit perfectly in there. Now I am trying to insert that model in once the func_explosion as been blown.

My script looks like this; at the moment. I’ve been toying with it for the last 40 minutes it seems.


garage_wall
{
		spawn
		{
			wait 200
			constructible_class 3
			wait 200
			setstate bustedwall invisible
		}
	
		death
		{	
		wm_announce "^1*Axis have breached the Garage!^7"
		
		wm_objective_status 1 1 2
		wm_objective_status 1 0 1
			
			wait 200
			setstate bustedwall default		
		}
}

In this instance, it’s obvious that I tried to tie the model into the script_mover itself. However, neither the model nor the clip brushes appear after the dynamite goes off.

Next, I tried to separate them and made a script_mover only for clip brushes and gave a misc_gamemodel a targetname/scriptname. That too did not work.

As I began writing this post I thought that maybe they key would be to in the death sequence have it trigger another script rather than setstate. So I made another script that setstate in a separate section. Trying this only left me baffled with a error “No spawn point found�.

I feel like a real dumbass, I thought I was starting to understand scripts just a lil bit ago after I got most of my tank working and all the explosions working! Gah!

Thanks in advance!


(neotic) #6

Also, when it describes model2… what does it mean by the area of the clip solic brush? Does that mean thats where the origins will start for the model? Will the clip brush (not clip people)?


(Mean Mr. Mustard) #7

Do you have a script block for ‘bustedwall’ - is it spawned? You might be trying to setstate it before it has spawned itself.

When it was a script_mover did you have an origin brush as part of the mover? If not, then it shows up halfway between (0,0,0) and the location in the .map file (I don’t know why, it just does … or that is what I read). I do not think an .ase model works as a misc_gamemodel - but I could be wrong. And I think you cannot use setstate on a misc_model (or it doesn’t work).

I would have just used the brushwork and an origin, made a script_mover and setstate of that. (but I’m lazy :wink: )


(MadJack) #8

I know you can use a script_mover and have a model/model.ase as I used that with my flak when I started making my demo map. So, it might work with a gamemodel though I’ve never tried it.


(neotic) #9

Thanks for the feedback! I’ll play it safe and make them brushes since I still have them and try the rest. Yeah I did have a script block and all, I just assumed that gamemodels could work like that. Mmh, okay… keep this posted so any fools like me can see this. =x


(neotic) #10

Okay, I am about to go insane. I made the explosive frame, brushes and also made sure they were a script_mover with a origin brush. The script and targetnames are “bustedwall”.

I tried this first block script:

garage_wall 
{ 
      spawn 
      { 
         wait 200 
         constructible_class 3
         trigger self setup
      }
       
      trigger setup
	  {
		setstate bustedwall invisible
	  }
	    
      death 
      {    
	      wm_announce "^1*Axis have breached the Garage!^7" 
	       
	      wm_objective_status 1 1 2 
	      wm_objective_status 1 0 1 
	      wait 200
	      trigger self blow    
      }
      
      trigger blow
	  {		
		wait 100
		setstate bustedwall default
	  }
}

Am I close? I don’t know. It doesn’t work.

Then I tried this:

garage_wall 
{ 
      spawn 
      { 
         wait 200 
         constructible_class 3
      }
	    
      death 
      {    
	      wm_announce "^1*Axis have breached the Garage!^7" 
	       
	      wm_objective_status 1 1 2 
	      wm_objective_status 1 0 1 
	      wait 200
	      trigger blown_door blow    
      }
}

blown_door
{
	spawn
	{
		wait 200
		setstate bustedwall invisible
	}

	trigger blow
	{
		setstate bustedwall default
	}
}

That didn’t work either. I tried a few others but after being frustrated for so long I tend to forget exactly what else there was. What is goin on here? I can do this stuff easy as long as its a constructible, but thats not very fitting here.

Thanks… in advance… again. :bored:


(neotic) #11

Hey I fixed it! Hurray; heres the winning combonation if anyone comes across needing script_movers tied to their func_explosions.

garage_wall 
{ 
      spawn 
      { 
         wait 200 
         constructible_class 3
         
         trigger garage_wall setup
      }
      
      trigger setup
	  {
		 setstate broken_wall invisible
      }
	    
      death 
      {    
	      setstate broken_wall default
	      wait 200
	      wm_announce "^1*Axis have breached the Garage!^7" 
	       
	      wm_objective_status 1 1 2 
	      wm_objective_status 1 0 1	          
      }
}

(MadJack) #12

Reading your post made me remember that, sometimes you can’t use the object’s own scriptblock to setstate it so you have to reference it by another one. That happened to me a couple of months back and I didn’t remember it. Now I hope it’ll stick in my little head :smiley:


(neotic) #13

I have found one problem though. The following script works partially. You will notice that this is set for a satchel explosion but only a TNT will actually blow it up. Use the satchel and nothing happens at all. Use TNT and it blows the func_explosive and triggers the script_mover correctly.

Any ideas why it is being so difficult?

front_rubble
{
	spawn
	{
		wait 200
		constructible_class 2
			
		trigger front_rubble setup
	}
		
	trigger setup
	{
		 setstate front_rubble_dmg invisible
    }
	
	death
	{
		setstate front_rubble_dmg default	
		wm_announce "^1*Axis have cleared the rubble!^7"
	
	}
}

(MadJack) #14

Looks ok. Check if there’s not a second front_rubble in the script? Or maybe you have a pk3 of that map and afaik it would override that one.

Wild shots in the dark though.