OBD talk:BINA/PAR3: Difference between revisions

m
decorative decals, I was missing their 'intuitive' facing rules
m (decorative decals, I was missing their 'intuitive' facing rules)
Line 1,229: Line 1,229:
  86 Break Links To <BreakLink />
  86 Break Links To <BreakLink />
  -------------------------------------------------------------------------------------------------------------
  -------------------------------------------------------------------------------------------------------------
=how to set up decorative decals=
What are decals?
: Decals are images glued onto a wall or ground.
: They are used for additional level design and to show weapon damage on surroundings.
: The following steps will show you how to set up a piece of design (poster/warning sign/whatever) into a level.
==step 1 - extending the particle collection==
* [[OBD_talk:BINA/OBJC/PART|Particle collections]] are level specific.
* <Position> .. Choose a position for your decal.
: '''The maximal tolerance distance counts 10 units.''' Let's say the ground height (y) is 45 and the particle is spawned at 55 then this is the maximal tolerance; 56 wouldn't work.
: '''"chr_debug_characters = 1"''' helps you. But note that the y value is not the head's or pelvis' height, it is at the deepest point of your feet.
* <Rotation> .. '''see [[#decal_facing|"decal facing"]]'''
* <Class> .. this is your [[#step_2_-_creating_BINA3RAP_file|particle file]]
* <Tag> .. optional; '''used when you want to activate or deactivate decals or other particle via BSL'''
* <Flags> .. "not initially created" flag (2) or nothing (1; 4; 8)
* <XScale> .. Scaling of decal's X dimension on ''individual level'' (you can use the 3RAP's own scaling (<Scale>) for accumulative scaling (this would affect all decals in the collection))
        <Object Id="11291" Type="PART">
            <Header>
                <Flags>0</Flags>
                <Position>-988 65 1521</Position>
                <Rotation>270 180 0</Rotation>
            </Header>
            <OSD>
                [[#step_2_-_creating_BINA3RAP_file|<Class>]]'''<font color="#00AA00">decal_particle_name</font>'''</Class>
                [[#step_4_-_show_or_hide_decals_via_BSL|<Tag>]]'''<font color="#0000FF">decal_BSL_name</font>'''</Tag>
                <Flags>8</Flags>
                <Decal>
                    <XScale>20</XScale>
                    <YScale>20</YScale>
                </Decal>
            </OSD>
        </Object>
===decal facing===
: Place yourself towards the point where you want to have the decal, face it. It's important that your body stands accurate, not your head. Then type "chr_debug_characters = 1" into the developer console and you will know the facing. Write it down, compare with the right table and chose your xyz rotation.
'''wall decals'''
                      x    y    z
facing  0 degree: 270 |  0 |  0
facing  90 degree: 270 |  90 |  0
facing 180 degree: 270 | 180 |  0
facing 270 degree: 270 | 270 |  0
'''ground decals'''
                      x    y    z
facing  0 degree:  0 |  0 |  0
facing  90 degree:  0 |  90 |  0
facing 180 degree:  0 | 180 |  0
facing 270 degree:  0 | 270 |  0
==step 2 - creating BINA3RAP file==
* file name in this example: "'''BINA3RAP<font color="#00AA00">decal_particle_name</font>.xml'''"
* <Version> .. '''<font color="#FF0000">has to be the same version as your own onisplit, change it if necessary</font>
* <font color="#777777"><CollideWithChars> .. is ignored by decals</font>
* <HasDecalState>true .. is needed
* <DisplayType>Decal .. is needed
* <TexGeom> .. links to [[#step_3_-_creating_TXMP_file|TXMP file]]
* <font color="#777777"><Alpha> .. alpha level is ignored when TXMP has adaptiveAlpha flag</font>
* <font color="#777777"><Tint> .. is ignored by decals</font>
<?xml version="1.0" encoding="utf-8"?>
<Oni '''<font color="#FF0000">Version="0.9.41.0"</font>>'''
    <Particle Name="'''<font color="#00AA00">decal_particle_name</font>'''">
        <Options>
            <Lifetime>0</Lifetime>
            <DisableDetailLevel>Never</DisableDetailLevel>
            <Decorative>true</Decorative>
            <CollideWithWalls>false</CollideWithWalls>
            <CollideWithChars>false</CollideWithChars>
            <InitiallyHidden>false</InitiallyHidden>
            <DrawAsSky>false</DrawAsSky>
            <DontAttractThroughWalls>false</DontAttractThroughWalls>
            <ExpireOnCutscene>false</ExpireOnCutscene>
            <DieOnCutscene>false</DieOnCutscene>
            <LockPositionToLink>false</LockPositionToLink>
            <CollisionRadius>0</CollisionRadius>
            <AIDodgeRadius>0</AIDodgeRadius>
            <AIAlertRadius>0</AIAlertRadius>
            <FlyBySoundName />
        </Options>
        <Properties>
            <HasVelocity>false</HasVelocity>
            <HasOrientation>false</HasOrientation>
            <HasPositionOffset>false</HasPositionOffset>
            <HasAttachmentMatrix>false</HasAttachmentMatrix>
            <HasUnknown>false</HasUnknown>
            '''<HasDecalState>true</HasDecalState>'''
            <HasTextureStartTick>false</HasTextureStartTick>
            <HasTextureTick>false</HasTextureTick>
            <HasDamageOwner>false</HasDamageOwner>
            <HasContrailData>false</HasContrailData>
            <HasLensFlareState>false</HasLensFlareState>
            <HasAttractor>false</HasAttractor>
            <HasCollisionCache>false</HasCollisionCache>
        </Properties>
        <Appearance>
            '''<DisplayType>Decal</DisplayType>'''
            [[#step_3_-_creating_TXMP_file|<TexGeom>]]'''<font color="#AA00AA">animated_texture</font>'''</TexGeom>
            <Invisible>false</Invisible>
            <IsContrailEmitter>false</IsContrailEmitter>
            <ScaleToVelocity>false</ScaleToVelocity>
            <Scale>1</Scale>
            <UseSeparateYScale>false</UseSeparateYScale>
            <YScale>1</YScale>
            <Rotation>0</Rotation>
            <Alpha>1</Alpha>
            <XOffset>0</XOffset>
            <XShorten>0</XShorten>
            <UseSpecialTint>false</UseSpecialTint>
            <Tint>255 255 255</Tint>
            <FadeOutOnEdge>false</FadeOutOnEdge>
            <OneSidedEdgeFade>false</OneSidedEdgeFade>
            <EdgeFadeMin>0</EdgeFadeMin>
            <EdgeFadeMax>0.5</EdgeFadeMax>
            <MaxContrailDistance>0</MaxContrailDistance>
            <LensFlare>false</LensFlare>
            <LensFlareDistance>0</LensFlareDistance>
            <LensFlareFadeInFrames>0</LensFlareFadeInFrames>
            <LensFlareFadeOutFrames>0</LensFlareFadeOutFrames>
            <DecalFullBrightness>false</DecalFullBrightness>
            <MaxDecals>100</MaxDecals>
            <DecalFadeFrames>60</DecalFadeFrames>
            <DecalWrapAngle>60</DecalWrapAngle>
        </Appearance>
        <Attractor>
            <Target>None</Target>
            <Selector>Distance</Selector>
            <Class />
            <MaxDistance>150</MaxDistance>
            <MaxAngle>30</MaxAngle>
            <AngleSelectMin>3</AngleSelectMin>
            <AngleSelectMax>20</AngleSelectMax>
            <AngleSelectWeight>3</AngleSelectWeight>
        </Attractor>
        <Variables />
        <Emitters />
        <Events />
    </Particle>
</Oni>
==step 3 - creating TXMP file==
* file name in this example: "'''TXMP<font color="#AA00AA">animated_texture</font>.xml'''"
: Of cause the particle file doesn't has to contain an animated image. It's just meant to remind you that this possibility exist.
* <Version> .. '''<font color="#FF0000">has to be the same version as your own onisplit, change it if necessary</font>
{| border=0 cellspacing=20 cellpadding=0 align=right
|
[http://www.youtube.com/watch?v=ifHv5S-npqw&feature=channel_page http://i305.photobucket.com/albums/nn207/unknownfuture/Oni_Galore_Images/XML_modding/animated_decal.jpg]
|}
<?xml version="1.0" encoding="utf-8"?>
<Oni '''<font color="#FF0000">Version="0.9.41.0"</font>>'''
    <Texture>
        <Flags>HasMipMaps  AnimUseLocalTime  AnimBackToBack  AdditiveBlend</Flags>
        <Format>RGB555</Format>
        <Speed>4</Speed>
        <Image>TXMPanimated_tex_part_000.tga</Image>
        <Image>TXMPanimated_tex_part_001.tga</Image>
        <Image>TXMPanimated_tex_part_002.tga</Image>
        <Image>TXMPanimated_tex_part_003.tga</Image>
        <Image>TXMPanimated_tex_part_004.tga</Image>
        <Image>TXMPanimated_tex_part_005.tga</Image>
        <Image>TXMPanimated_tex_part_006.tga</Image>
        <Image>TXMPanimated_tex_part_007.tga</Image>
        <Image>TXMPanimated_tex_part_008.tga</Image>
        <Image>TXMPanimated_tex_part_009.tga</Image>
        <Image>TXMPanimated_tex_part_010.tga</Image>
    </Texture>
</Oni>
==step 4 - show or hide decals via BSL==
fork respawnable_decals in your main function
var bool first = 1;
func respawnable_decals
{
chr_debug_characters = 1
dmsg "( punch to hide a few decals now )"
### decal is already presented so we begin with stop function
fork kill_decal
}
func kill_decal
{
sleep 30
chr_wait_animtype 0 punch
dmsg "( punch detected; [r.deactivating decals now] )"
'''### has effect at all particle with chosen tag'''
### in the vid, obviously the two decals use the same tag
particle '''<font color="#0000FF">decal_BSL_name</font>''' kill
if (first eq 1)
{
dmsg "( kick to show a few decals now )"
first = 0;
sleep 60
}
fork create_decal
}
func create_decal
{
sleep 30
chr_wait_animtype 0 kick
dmsg "( kick detected; [b.activating decals now] )"
particle '''<font color="#0000FF">decal_BSL_name</font>''' create
fork kill_decal
}
8,189

edits