"G_Scripting: trigger has unknown name"


(Diego) #1

This is a basic target script trigger similar to the doors in battery.

I know that my target script trigger is working correctly because when I activate the func_invisible_user it will trigger the tank_lock_trigger switch routine and print out the announcement text.

However, the console tells me that the name “tank_lock” is unknown and won’t run the rest of the script for my switch. Now, I may be old, but I’m not blind yet. It’s in there. Any ideas why the tank_lock_trigger scriptblock can’t see the tank_lock scriptblock?

I’m using this exact same scripting setup for a switchable door and that one is working perfectly fine. I tried using a different name for my scriptblock but the console wouldn’t see that one either. And I’ve already checked for missing “{}” thingys.


// ================================================
// Tank Lock Switch
// ================================================
tank_lock_trigger
{
	trigger switch
	{
		wm_announce "^3Triggering the Tank Lock Script!"
		trigger tank_lock switch
	}
}


tank_lock
{
	spawn
	{
		accum 1 set 0
		accum 2 set 3 // 0 = locks unlocked  1 = locks locked	2 = locks disabled	3 = locks empty
		setstate tank_blocks invisible	
	}

	trigger switch
	{
		accum 1 abort_if_equal 1
		accum 2 trigger_if_equal 0 tank_lock lock
		accum 2 trigger_if_equal 1 tank_lock unlock
		accum 2 trigger_if_equal 2 tank_lock failed
		accum 2 trigger_if_equal 3 tank_lock empty
	}
	
	trigger lock
	{
		accum 1 abort_if_equal 1
		accum 1 set 1
		wm_announce "^1Tank Repair Locks engaged!"
		trigger tank_lock_switch up
		playsound sound/movers/switches/butn2.wav
		wait 200
		playsound sound/movers/doors/door5_locked.wav
		setstate tank_blocks default
		accum 2 set 2
		accum 1 set 0
		resetscript
	}

	trigger unlock
	{
		accum 1 abort_if_equal 1
		accum 1 set 1
		wm_announce "^2Tank Repair Locks released. Repairs Complete!"
		trigger tank_lock_switch down	
		playsound sound/movers/switches/butn2.wav
		wait 200
		playsound sound/movers/doors/door5_locked.wav
		setstate tank_blocks invisible
		accum 2 set 3
		accum 1 set 0
		resetscript
	}
	
	trigger failed
	{
		accum 1 abort_if_equal 1
		accum 1 set 1
		wm_announce "^3Tank Repair Locks cannot be released until repairs are complete!"
		playsound sound/movers/switches/switch_01.wav
		accum 2 set 2
		accum 1 set 0
		resetscript
	}
	
	trigger empty
	{
		accum 1 abort_if_equal 1
		accum 1 set 1
		wm_announce "^3Error: No tank to repair."
		playsound sound/movers/switches/switch_01.wav
		accum 2 set 3
		accum 1 set 0
		resetscript
	}
	
	trigger enable
	{
		accum 1 abort_if_equal 1
		accum 1 set 1
		accum 2 set 0
		accum 1 set 0
		resetscript
	}

	trigger release
	{
		accum 1 abort_if_equal 1
		accum 1 set 1
		accum 2 set 1
		accum 1 set 0
		resetscript
	}
}

tank_lock_switch
{
	spawn
	{
	}
	
	trigger up
	{
		gotomarker tank_lock_switch_up 60 wait
	}

	trigger down
	{
		gotomarker tank_lock_switch_dn 60 wait
	}

}


(S14Y3R) #2

Yea I’ve had that before, it drove me nuts for a month. It happens when your scriptblock doesn’t have a related entity ingame. You can’t just create a new block in script, the game won’t see it.
So, either use another target_script_trigger with a null target key, or make a small/tiny script_mover out of sight with targetname/scriptname tank_lock

gl.


(Diego) #3

I woke up this morning with the same thought in mind. I had an entity called tank_blocks that was a func_static entity. I just switched that one to a script_mover and renamed it to tank_lock and everything is working fine now.

That’s what I get for trying to script at 5 am. Thanks for the help.