XML:BINA/OBJC/TRGV: Difference between revisions
Script 10k (talk | contribs) m (updated picture to link to wiki instead of external source) |
Script 10k (talk | contribs) (string comparison bug in TVs) |
||
Line 175: | Line 175: | ||
|} | |} | ||
===BSL bugs and workarounds=== | |||
====String comparison bug==== | |||
Trigger volumes can call bsl functions. This function can receive a string variable which contains the character name that triggered the trigger volume. | |||
Unfortunately seems there are a bug when comparing this string parameter with another string variable in the BSL. Even if the trigger volume string and the other string are equal when you compare them in BSL it always returns false. | |||
To reproduce the bug you can open "warehouse_level_scripts.bsl" in "EnvWarehouse" folder and replace the '''t65''' function by this one (make a backup of the file first): | |||
func void t65(string ai_name) | |||
{ | |||
var string testVar = "char_0"; | |||
dmsg(testVar); | |||
dmsg("char_0"); | |||
dmsg(ai_name); | |||
sleep(100); | |||
if(testVar eq "char_0"){ | |||
dmsg("regular string comparison works!"); | |||
} | |||
else{ | |||
dmsg("regular string comparison failed!"); | |||
} | |||
if(ai_name eq "char_0"){ | |||
dmsg("trigger volume string comparison worked!"); | |||
} | |||
else{ | |||
dmsg("trigger volume string comparison failed!"); | |||
} | |||
dprint t65 | |||
if(d6 eq 0) | |||
{ | |||
message xdoorislocked | |||
dprint door_is_locked | |||
} | |||
} | |||
Load savepoint 1 in chapter 1 and move the character until the door. This function will be triggered. What is the output that you expect? "trigger volume string comparison worked!" right? Wrong it will print "trigger volume string comparison failed!" even though both string variables have the same value. | |||
[[Image:Trigger_volume_string_comparison_bug.jpg|300px]] | |||
=====Possible workarounds===== | |||
If you need to detect few characters and if all of these are from different teams you can clone the trigger volume one time for each character and call different functions one for each team. This way you make sure you know which character triggered the trigger volume since each character has a unique team and a unique trigger volume function. | |||
===Mod Tool addon=== | ===Mod Tool addon=== |
Revision as of 13:41, 29 July 2017
TRGV : Trigger Volumes (TVs) | ||
---|---|---|
XML
AKEV << Other file types >> CONS TMBD << Other BINA >> ONIE TRIG << Other OBJC >> SNDG |
general information
- BINACJBOTrigger Volume.oni is level specific. (It can be found in AE/AEInstaller/vanilla/levelX_Final.dat)
- The XML code on this page is based on onisplit v0.9.61.0
BSL support
show trigger activity
- debug_triggers = 1 shows tv event and what character enters, stays inside or leaves
Resetting the trigger volume
- trigvolume_reset (string tv_name) resets the TV to its preset state. The primary use of this is to re-enable "entry", "inside" or "exit" calls once the TV has been triggered (only necessary if the respective trigger-only-once flags are set of course). Note that some or all the TV functions are disabled at level load, you'll have to enable them manually after resetting the TV.
Removing corpses
- trigvolume_corpse (integer tv_id) removes all corpses inside the specified trigger volume.
file structure
<?xml version="1.0" encoding="utf-8"?> <Oni> <Objects> [...] </Objects> </Oni>
[...] means at least one trigger volume. Paste all tv data into there (this includes <TRGV Id="..."> and </TRGV> tag).
example
<TRGV Id="7383"> <Header> <Flags>Locked</Flags> <Position>-651.5666 -298 -633.4166</Position> <Rotation>0 0 0</Rotation> </Header> <OSD> <Name>trigger_volume_46</Name> <Scripts> <Entry>train_block2</Entry> <Inside></Inside> <Exit>block_path</Exit> </Scripts> <Teams>255</Teams> <Size>46 31 46</Size> <TriggerVolumeId>46</TriggerVolumeId> <ParentId>0</ParentId> <Notes></Notes> <Flags>PlayerOnly</Flags> </OSD> </TRGV>
start + size = end - 651.5666 + 46 = -605.5666 = x_blue_line_end - 298 + 31 = -267 = y_blue_line_end - 633.4166 + 46 = -587.4166 = z_blue_line_end
tags
tag | type | description |
---|---|---|
<?xml version="1.0" encoding="utf-8"?> | float, flag | Don't change this. |
<Oni> | - | XML root node |
<TRGV Id="..."> | integer | You can also use <TRGV> without the id parameter. |
<Header> | - | |
<Flags> | flag | Used in the past. |
<Position> | float x3 | TV is spawned at this xyz-position |
<Rotation> | float x3 | TV has this xyz-rotation (in degrees) |
<OSD> | - | |
<Name> | string | can have up to 63 characters |
<Scripts> | - | BSL functions; each can have up to 32 characters |
<Entry> | string | called up when character enters the TV |
<Inside> | string | called while character is inside the TV
This one is triggered at every frame (60 times per second) unless the trigger-only-once flag is set. Continuous triggering is typically needed for fire or gas damage. |
<Exit> | string | called up when character leaves the TV |
<Teams> | flags |
Every combination is possible. E.g.:
|
<Size> | float x3 | volume |
<TriggerVolumeId> | integer | used by BSL command "trigvolume_corpse ID" |
<ParentId> | integer | not used ? |
<Notes> | string | space for 128 characters |
<Flags> | flags |
|
BSL bugs and workarounds
String comparison bug
Trigger volumes can call bsl functions. This function can receive a string variable which contains the character name that triggered the trigger volume.
Unfortunately seems there are a bug when comparing this string parameter with another string variable in the BSL. Even if the trigger volume string and the other string are equal when you compare them in BSL it always returns false.
To reproduce the bug you can open "warehouse_level_scripts.bsl" in "EnvWarehouse" folder and replace the t65 function by this one (make a backup of the file first):
func void t65(string ai_name) { var string testVar = "char_0"; dmsg(testVar); dmsg("char_0"); dmsg(ai_name); sleep(100); if(testVar eq "char_0"){ dmsg("regular string comparison works!"); } else{ dmsg("regular string comparison failed!"); } if(ai_name eq "char_0"){ dmsg("trigger volume string comparison worked!"); } else{ dmsg("trigger volume string comparison failed!"); } dprint t65 if(d6 eq 0) { message xdoorislocked dprint door_is_locked } }
Load savepoint 1 in chapter 1 and move the character until the door. This function will be triggered. What is the output that you expect? "trigger volume string comparison worked!" right? Wrong it will print "trigger volume string comparison failed!" even though both string variables have the same value.
Possible workarounds
If you need to detect few characters and if all of these are from different teams you can clone the trigger volume one time for each character and call different functions one for each team. This way you make sure you know which character triggered the trigger volume since each character has a unique team and a unique trigger volume function.
Mod Tool addon
With OniTools.xsiaddon you can drag'n'drop BINACJBOTrigger Volume.oni into the viewport.
Add or remove TVs, edit position and rotation as if they were real objects. Change size by moving the polygons.
When ready, export the data as BINACJBOTrigger Volume.xml to a folder of your choice.