XML:ONLV: Difference between revisions

749 bytes added ,  26 February 2013
m
no edit summary
(examining the recognition of broken glass (env) objects in level 1 TCTF training)
mNo edit summary
Line 103: Line 103:
  env_show 9 1
  env_show 9 1
  env_show 9 0
  env_show 9 0
EdT demonstrate [http://youtu.be/Em6wa5JTQNM here] env_show. The objects do have collision.
The last original level (syndicate mountain compound) has a big dish platform that can be made hidden. Obviously, such objects/areas can be made to have pathfinding too.
=====breakable objects with BSL recognition=====
Broken env objects can be recognized by bsl command ''env_broken (ID_1, ID_N)''. However, this whole thing require additional things to make use of it.
An example is the training level. Let's determines how we can set such thing up.
First we need a TV like in level 1.
        <TRGV Id="11495">
            <Header>
                <Flags>Locked</Flags>
                <Position>-714.6615 -298 -555.2073</Position>
                <Rotation>0 0 0</Rotation>
            </Header>
            <OSD>
                <Name>tv75</Name>
                <Scripts>
                    <Entry></Entry>
                    <Inside>targets_gone</Inside>
                    <Exit></Exit>
                </Scripts>
                <Teams>255</Teams>
                <Size>400 31 270</Size>
                <TriggerVolumeId>75</TriggerVolumeId>
                <ParentId>0</ParentId>
                <Notes></Notes>
                <Flags>PlayerOnly</Flags>
            </OSD>
        </TRGV>
Now we need the the BSL code.
var int inside_target_function;
func void enter_target_function(void)
{
    dprint enter_target_function
    inside_target_function = 1;
}
func void exit_target_function(void)
{
    dprint exit_target_function
    inside_target_function = 0;
}
func void targets_are_not_gone(void)
{
# CB: turn off the trigger volume and sleep for a second
# so as not to cause hideous performance loss
trigvolume_enable tv75 0
sleep 60
trigvolume_enable tv75 1
}
func void targets_gone(string ai_name)
{
if(inside_target_function eq 0)
{
enter_target_function() # catch other "targets_gone" functions to let them do nothing
var int num_broken = env_broken(3001, 3018);
# if you only one target use scheme: env_broke(3001, 3001)
if (num_broken eq 18)
{
targets_are_gone();
}
if (num_broken < 18)
{
targets_are_not_gone(); # to set check interval to one second
}
exit_target_function
}
}
func targets_are_not_gone
{
trigvolume_enable tv75 0
# [...]
}
;Explanation:
Player enters the TV, "targets_gone" gets triggered. The variable "inside_target_function" should be 0 be default, so we are entering now the first if statement. Next, we can assume that the player didn't destroy all glass objects, so "num_broken" will be less than 18: "targets_are_not_gone" gets triggered.
The TV function "targets_gone" would be triggered every frame but "targets_are_not_gone" decrease the check interval: The TV gets deactivated for 60 frames. Then the TV becomes enabled again and will start anew until all glass objects got destroyed or Player left the TV.
Unnecessary "targets_gone" functions will do nothing because "inside_target_function" was set to 1 by the first one.
"targets_are_not_gone" eventually disables the TV to prevent memory overflow, the function contains also all things "[...]" that you want to happen after the glass target broke.
=====texture exchange=====
Not tested.
source: ([[OBD:IDXA_AKEV_2]])
BSL command [[BSL:PC_vs._Mac_Comparison_(table)|supported]] by PC and Mac:
: env_texswap ID texture
Might be useful to switch on/off static and animated textures. (News screen: running or off or smashed. Lava stream: flowing or stagnating or cooled down. Etc.)




Line 553: Line 664:


: Okay, i see, another thing to wait for. Will test the physics.xml a bit during weekend. [[User:Paradox-01|paradox-01]] 12:08, 6 June 2012 (CEST)
: Okay, i see, another thing to wait for. Will test the physics.xml a bit during weekend. [[User:Paradox-01|paradox-01]] 12:08, 6 June 2012 (CEST)
===breakable glass with BSL recognition===
Not tested.
BSL command:
: env_broken (ID_1, ID_N)
It's used in the training level and determines if glass got shot through or not. How do we set such things up?
Let's examine the original setup.
        <TRGV Id="11495">
            <Header>
                <Flags>Locked</Flags>
                <Position>-714.6615 -298 -555.2073</Position>
                <Rotation>0 0 0</Rotation>
            </Header>
            <OSD>
                <Name>tv75</Name>
                <Scripts>
                    <Entry></Entry>
                    <Inside>targets_gone</Inside>
                    <Exit></Exit>
                </Scripts>
                <Teams>255</Teams>
                <Size>400 31 270</Size>
                <TriggerVolumeId>75</TriggerVolumeId>
                <ParentId>0</ParentId>
                <Notes></Notes>
                <Flags>PlayerOnly</Flags>
            </OSD>
        </TRGV>
Player enters the TV, "targets_gone" gets triggered. The variable "inside_target_function" should be 0 be default, so we are entering now the first if statement. Next, we can assume that the player didn't destroy all glass objects, so "num_broken" will be less than 18: "targets_are_not_gone" gets triggered.
The TV function "targets_gone" would be triggered every frame but "targets_are_not_gone" decrease the check interval: The TV gets deactivated for 60 frames. Then the TV becomes enabled again and will start anew until all glass objects got destroyed or Player left the TV.
Unnecessary "targets_gone" functions will do nothing because "inside_target_function" was set to 1 by the first one.
func void enter_target_function(void)
{
    dprint enter_target_function
    inside_target_function = 1;
}
func void exit_target_function(void)
{
    dprint exit_target_function
    inside_target_function = 0;
}
func void targets_are_not_gone(void)
{
# CB: turn off the trigger volume and sleep for a second
# so as not to cause hideous performance loss
trigvolume_enable tv75 0
sleep 60
trigvolume_enable tv75 1
}
func void targets_gone(string ai_name)
{
if(inside_target_function eq 0)
{
enter_target_function() # catch other "targets_gone" functions to let them do nothing
var int num_broken = env_broken(3001, 3018);
if (num_broken eq 18)
{
targets_are_gone();
}
if (num_broken < 18)
{
targets_are_not_gone(); # to set check interval to one second
}
exit_target_function
}
}
===texture exchange===
Not tested.
([[OBD:IDXA_AKEV_2]])
BSL command [[BSL:PC_vs._Mac_Comparison_(table)|supported]] by PC and Mac:
: env_texswap ID texture
Might be useful to switch on/off static and animated textures. (News screen: running or off or smashed. Lava stream: flowing or stagnating or cooled down. Etc.)




8,452

edits