Instance in an Instance - trigger_catapult problem [SOLVED]
Quote from albian on May 30, 2015, 2:06 pmI'm creating a map with a few chambers and I'm making each chamber a func_instance to make it easier to mange and test. In one of the chambers I'm using a trigger_catapult that is, itself, part of an instance. When I use the trigger_catapult instance in a "normal" map it works fine. But when it's in a chamber that's an instance in a bigger map, then the trigger catapult does not recognize it's target.
That's a very convolutated way of explaning the problem which is a lot easy to demonstrate so I've attached a couple of files which shows the problem. The files are:
trigger_instance.vmf - this is a simple instance which contains a trigger_catapult and a func_instance_parms for the target name and the player/object speeds.
this_works.vmf - which is a room with two of the trigger_instance's and, as the name implies, it works.
then there's:
not_working.vmf - where I've just created a map with a single func_instance (calling up this_works.vmf) and, you've guesssed it, it's not working.
There's obviously some inner-workings of instances that I'm missing - any help would be much appreciated.
I'm creating a map with a few chambers and I'm making each chamber a func_instance to make it easier to mange and test. In one of the chambers I'm using a trigger_catapult that is, itself, part of an instance. When I use the trigger_catapult instance in a "normal" map it works fine. But when it's in a chamber that's an instance in a bigger map, then the trigger catapult does not recognize it's target.
That's a very convolutated way of explaning the problem which is a lot easy to demonstrate so I've attached a couple of files which shows the problem. The files are:
trigger_instance.vmf - this is a simple instance which contains a trigger_catapult and a func_instance_parms for the target name and the player/object speeds.
this_works.vmf - which is a room with two of the trigger_instance's and, as the name implies, it works.
then there's:
not_working.vmf - where I've just created a map with a single func_instance (calling up this_works.vmf) and, you've guesssed it, it's not working.
There's obviously some inner-workings of instances that I'm missing - any help would be much appreciated.
Quote from josepezdj on June 1, 2015, 4:13 amHave you tried giving a name to the catapult func_instance inside your bigger map? try it, even if you aren't sending any direct output to that instance.
I am not in front of my computer atm, so I can't check out...
Have you tried giving a name to the catapult func_instance inside your bigger map? try it, even if you aren't sending any direct output to that instance.
I am not in front of my computer atm, so I can't check out...
Quote from albian on June 1, 2015, 4:09 pmI think everything is named. Starting with the trigger_catapult instance (trigger_instance.vmf), the trigger_catapult is named cat_xx. The following settings of the trigger_catapult are used for the func_param:
"launchTarget" "$target"
"physicsSpeed" "$ObjectSpeed"
"playerSpeed" "$PlayerSpeed"Then in the this_works.vmf file then I've put two copies of the trigger_instance.vmf instance and named them
catapult_1
catapult_2and I've set the launchTarget parameter to target
and put two info_target's named:
catapult_1-target
catapult_2-target(Oh, and there's an info_player_start and a cube to bounce between the two catapults.)
So, when the this_works.vmf is run, it all works fine.
But when I create the other map (not_working.vmf) with a func_instance calling up this_works.vmf then it doesn't work.
It's obviously something to do with how the compiler handles entity names within instances.
On the Working with Instance page:
https://developer.valvesoftware.com/wik ... _instances
it says:
If an entity in an instance has it's targetname set to a replaceable parameter field, any I/O in your map must target the entity's final instance collapsed name. During the VBPS process, all of your instances are gathered and collapsed into your map, and the names of any entities within those instances have their names altered. The renaming system works as follows (assuming the "Entity Name Fix Up" is set to "Prefix (default)":
(value of your map's func_instance "Fix Up Name")-(instance entity's targetname)
This is why the targets names as catapult_1-target and catapult_2-target works.
However, I can't work out what would happen if there's an instance within an instance. It's obvious that when this is done, the trigger_catapults are not recognising the catapult_1-target and catapult_2-target
In the first set of files I posted, I did not give a fix-up name to the this_works.vmt instance in the not_working.vmf file. I tried giving it a fix-up name (chamber) and it makes no difference (updated files attached to this post).
I think everything is named. Starting with the trigger_catapult instance (trigger_instance.vmf), the trigger_catapult is named cat_xx. The following settings of the trigger_catapult are used for the func_param:
"launchTarget" "$target"
"physicsSpeed" "$ObjectSpeed"
"playerSpeed" "$PlayerSpeed"
Then in the this_works.vmf file then I've put two copies of the trigger_instance.vmf instance and named them
catapult_1
catapult_2
and I've set the launchTarget parameter to target
and put two info_target's named:
catapult_1-target
catapult_2-target
(Oh, and there's an info_player_start and a cube to bounce between the two catapults.)
So, when the this_works.vmf is run, it all works fine.
But when I create the other map (not_working.vmf) with a func_instance calling up this_works.vmf then it doesn't work.
It's obviously something to do with how the compiler handles entity names within instances.
On the Working with Instance page:
https://developer.valvesoftware.com/wik ... _instances
it says:
If an entity in an instance has it's targetname set to a replaceable parameter field, any I/O in your map must target the entity's final instance collapsed name. During the VBPS process, all of your instances are gathered and collapsed into your map, and the names of any entities within those instances have their names altered. The renaming system works as follows (assuming the "Entity Name Fix Up" is set to "Prefix (default)":
(value of your map's func_instance "Fix Up Name")-(instance entity's targetname)
This is why the targets names as catapult_1-target and catapult_2-target works.
However, I can't work out what would happen if there's an instance within an instance. It's obvious that when this is done, the trigger_catapults are not recognising the catapult_1-target and catapult_2-target
In the first set of files I posted, I did not give a fix-up name to the this_works.vmt instance in the not_working.vmf file. I tried giving it a fix-up name (chamber) and it makes no difference (updated files attached to this post).
Quote from albian on June 2, 2015, 4:13 pmOK, I've sorted it - and I don't think it looks very elegant.
I decomiled the "not-working" map and discovered the following.
If I have a catapult-trigger in an instance called, say, cat_x with a launch target set to "target" and place this instance in a chamber and then make that chamber an instance in a larger map and gave it a fix-up name of "chamber". The info-target that is put into "chamber" has to be given the name:
cat_x-chamber-target
This is very messy. If I have a number of the instances containing the trigger-catapult in the chamber instance - and use the chamber instance in a bigger map - then if I change the chamber instance fix up name, all the trigger target names within that instance will have to be changed.
OK, I've sorted it - and I don't think it looks very elegant.
I decomiled the "not-working" map and discovered the following.
If I have a catapult-trigger in an instance called, say, cat_x with a launch target set to "target" and place this instance in a chamber and then make that chamber an instance in a larger map and gave it a fix-up name of "chamber". The info-target that is put into "chamber" has to be given the name:
cat_x-chamber-target
This is very messy. If I have a number of the instances containing the trigger-catapult in the chamber instance - and use the chamber instance in a bigger map - then if I change the chamber instance fix up name, all the trigger target names within that instance will have to be changed.
Quote from albian on June 3, 2015, 1:58 amOK, here's another OK. I've sorted it again and there is an elegant solution (I knew there had to be).
The problem I was having was because I was setting the "Launch target" parameter of the trigger_catapult via a func_instance_parm. This is what was causing the problem (since it appears prefixes are being added to the parameter).
If the "Launch target" parameter is hard set with just the string "target" then all is fine. You can just then set the target names to cat_instance_name-target and you can "cascade" instances and all the prefixes work OK.
Probably telling you all what you know already, but it's been a learning experience for me and I hope you don't mind me sharing - it's just part of my therapy!
OK, here's another OK. I've sorted it again and there is an elegant solution (I knew there had to be).
The problem I was having was because I was setting the "Launch target" parameter of the trigger_catapult via a func_instance_parm. This is what was causing the problem (since it appears prefixes are being added to the parameter).
If the "Launch target" parameter is hard set with just the string "target" then all is fine. You can just then set the target names to cat_instance_name-target and you can "cascade" instances and all the prefixes work OK.
Probably telling you all what you know already, but it's been a learning experience for me and I hope you don't mind me sharing - it's just part of my therapy!