Sniper rifle lens opening effect

#1
Excuse me, I have read the official weapon script documentation, but there are many parameters that do not describe the specific meaning.I now want to do the sniper rifle lens opening effect, when I click the right mouse button, the screen will become the sniper lens view, release the right mouse button, it will return to the original screen.Can I do this by adjusting zoomnode's parameters?If not, can you tell me the right way?thank you

Re: Sniper rifle lens opening effect

#2
How far are you with the setup?
The best thing you can probably do is, extract the following from the scripts.pak
\scripts\Scripts\Entities\Items\XML\Weapons\Rifle.xml (extract with e.g: 7zip)
Rename it and use it as a base.
You will need to change at least a few things like

from:

Code: Select all

<item name="Rifle" class="Weapon" category="primary" priority="2" weaponParams="1">
to:

Code: Select all

<item name="SniperRifle" class="Weapon" category="primary" priority="2" weaponParams="1">

from:

Code: Select all

<param name="display_name" value="@mp_eRifle" />
to:

Code: Select all

<param name="display_name" value="@mp_eSniperRifle" />


Replace the Geometry:

Code: Select all

<geometry>
<!-- In this case we load our animated first person weapon in the firstperson slot and a static mesh in the thirdperson one (for third person view, or pickups) -->
<firstperson name="Objects/weapons/rifle/rifle_fp.cdf" angles="0,0,0" position="0,0,0" />
<thirdperson name="Objects/weapons/rifle/rifle_tp.cgf" angles="0,0,0" useStreaming="0" GAME="MP"/>
<thirdperson name="Objects/weapons/rifle/rifle_tp.cgf" angles="0,0,0" GAME="SP"/>
</geometry>


Then in localization\english_xml.pak\english_xml\text_ui_items.xml (extract it with e.g 7zip)
add just under the Rifle

Code: Select all

<Row ss:StyleID="s72">
<Cell ss:Index="2" ss:StyleID="s75"><Data ss:Type="String">mp_eSniperRifle</Data></Cell>
<Cell><Data ss:Type="String">Sniper Rifle</Data></Cell>
<Cell><Data ss:Type="String">Sniper Rifle</Data></Cell>
</Row>
Then change the other values like
rate, recoil, ammo etc.

Use the technical documentation for the weapon scripts:
https://docs.cryengine.com/display/SDKD ... on+Scripts

The Rifle has already got a "sniper" mode so you can use that one by having the correct attachment on.

You can change the sniper scope to be on there by default

Code: Select all

<accessory name="SniperScope" zoommode="sniper" category="scope" default="1" exclusive="1" >
make sure to delete default="1" from iron sight.
(Something doesn't work as it should and as a result it's not working atm, will forward to relevant
department for future fix)

Workaround to attach and detach Sniper Scope:
Image

CTRL + V directly in flowgraph

Code: Select all

<Graph Description="" Group="asd2">
<Nodes>
<Node Id="5" Class="Weapon:Accessory" pos="576,396,0">
<Inputs entityId="0" Weapon="SniperRifle" Accessory="SniperScope"/>
</Node>
<Node Id="7" Class="Actor:LocalPlayer" pos="576,360,0">
<Inputs />
</Node>
<Node Id="11" Class="Debug:InputKey" pos="-414,180,0">
<Inputs entityId="0" Key="t" NonDevMode="0"/>
</Node>
<Node Id="13" Class="Logic:Sequentializer" pos="378,414,0">
<Inputs Closed="0" Reverse="0"/>
</Node>
<Node Id="15" Class="Game:WeaponSensor" pos="-180,180,0">
<Inputs entityId="0"/>
</Node>
<Node Id="17" Class="Actor:LocalPlayer" pos="-180,144,0">
<Inputs />
</Node>
<Node Id="19" Class="String:Compare" pos="144,378,0">
<Inputs A="" B="SniperRifle" IgnoreCase="1"/>
</Node>
<Node Id="20" Name="attach_button" Class="_comment" pos="-414,162,0"/>
<Node Id="21" Name="check_if_sniper_rifle_is_in_hand" Class="_comment" pos="144,360,0"/>
</Nodes>
<Edges>
<Edge nodeIn="5" nodeOut="7" portIn="entityId" portOut="entityId" enabled="1"/>
<Edge nodeIn="15" nodeOut="11" portIn="Get" portOut="Pressed" enabled="1"/>
<Edge nodeIn="5" nodeOut="13" portIn="Attach" portOut="Out1" enabled="1"/>
<Edge nodeIn="5" nodeOut="13" portIn="Detach" portOut="Out2" enabled="1"/>
<Edge nodeIn="19" nodeOut="15" portIn="A" portOut="WeaponName" enabled="1"/>
<Edge nodeIn="19" nodeOut="15" portIn="Compare" portOut="WeaponName" enabled="1"/>
<Edge nodeIn="15" nodeOut="17" portIn="entityId" portOut="entityId" enabled="1"/>
<Edge nodeIn="13" nodeOut="19" portIn="In" portOut="True" enabled="1"/>
</Edges>
</Graph>
Here you can fine tune your sniper:

Code: Select all

<zoommode name="sniper" type="Scope" enabled="0">
<stereo>
<param name="eyeDistance" value="0.002" />
<param name="convergenceDistance" value="0.25" />
</stereo>
<aimLookParams>
<param name="fp_offset" value="-0.058505, 0.041042, -0.026284" />
<param name="fp_rot_offset" value="-0.000684, 1.385298, -0.013418" />
<param name="zoom_transition_angle" value="28.647889757" />
<param name="look_offset" value="0.5,0.25" />
<param name="horiz_look_rot" value="0.0,-1.0,-1.5" />
<param name="vert_look_rot" value="0.0,0.0,0.0" />
<param name="strafe_offset" value="0.0, 0.0, 0.0" />
<param name="side_strafe_rot" value="0.0, 0.0, 0.0" />
<param name="front_strafe_rot" value="0.0, 0.0, 0.0" />
<param name="idle_speed" value="0.5" />
<param name="idle_magnitude" value="0.0" />
<param name="run_speed" value="0.75" />
<param name="run_magnitude" value="0.05" />
</aimLookParams>
<zoom>
<param name="suffix" value="sniper" />
<param name="suffixAG" value="_iron" />
<param name="iron" value="scope_" />
<param name="target_snap_enabled" value="0" />
<param name="dof" value="1" />
<param name="dof_focusMin" value="1.0" />
<param name="dof_focusMax" value="200.0" />
<param name="dof_focusLimit" value="500.0" />
<param name="dof_mask" value="textures/weapons/sniper_blurmask.dds" />
<param name="dof_shoulderMinZ" value="0.17" />
<param name="dof_shoulderMinZScale" value="2.0" />
<param name="dof_minZ" value="0.25" />
<param name="dof_minZScale" value="1.0" />
<param name="zoom_in_time" value="0.4" GAME="SP"/>
<param name="zoom_in_time" value="0.25" GAME="MP"/>
<param name="zoom_out_time" value="0.25" />
<param name="zoom_out_delay" value="0.15" GAME="SP"/>
<param name="scope_mode" value="1" />
<param name="scope_nearFov" value="6" />
<param name="hide_weapon" value="1" />
<param name="muzzle_flash_scale" value="0.4" GAME="MP"/>
<stages>
<stage value="8" rotationSpeedScale="0.5" GAME="SP" />
<stage value="16" rotationSpeedScale="0.25" GAME="SP" />
<stage value="4.0" rotationSpeedScale="1.0" GAME="MP"/>
<stage value="12.0" rotationSpeedScale="0.33" GAME="MP"/>
</stages>
</zoom>
<!-- You can also group entire blocks for GAME mode settings -->
<zoomSway GAME="SP">
<param name="maxX" value="0.009" />
<param name="maxY" value="0.012" />
<param name="stabilizeTime" value="2" />
<param name="minScale" value="0.25" />
<param name="crouchScale" value="0.25"/>
<param name="holdBreathScale" value="0.1" />
<param name="holdBreathTime" value="0.5" />
</zoomSway>
<zoomSway GAME="MP">
<param name="maxX" value="0.003" />
<param name="maxY" value="0.0035" />
<param name="stabilizeTime" value="1.0"/>
<param name="minScale" value="0.1"/>
<param name="crouchScale" value="0.25"/>
</zoomSway>
<spreadMod>
<param name="max_mod" value="0.25" GAME="SP"/>
<param name="max_mod" value="0.5" GAME="MP"/>
<param name="attack_mod" value="1.0" GAME="SP"/>
<param name="attack_mod" value="0.0" GAME="MP"/>
<param name="decay_mod" value="0.1"/>
<param name="end_decay_mod" value="0.1" />
<param name="speed_m_mod" value="0.25" GAME="SP"/>
<param name="speed_m_mod" value="0.5" GAME="MP"/>
<param name="min_mod" value="0.1" GAME="SP"/>
<param name="min_mod" value="0.1" GAME="MP"/>
<param name="rotation_m_mod" value="0.25" GAME="SP"/>
<param name="spread_crouch_m_mod" value="0.75" GAME="SP"/>
<param name="spread_crouch_m_mod" value="1.0" GAME="MP"/>
<param name="spread_jump_m_mod" value="1.0"/>
<param name="spread_slide_m_mod" value="1.0"/>
<param name="spread_holdBreathActive_m_mod" value="0.1" GAME="SP"/>
<param name="spread_holdBreathActive_m_mod" value="1.0" GAME="MP"/>
<param name="speed_holdBreathActive_m_mod" value="1.0" GAME="MP"/>
</spreadMod>
<recoilMod>
<param name="max_recoil_mod" value="1.0" />
<param name="first_attack_mod" value="1.0" GAME="SP"/>
<param name="first_attack_mod" value="0.85" GAME="MP"/>
<param name="attack_mod" value="1.0" />
<param name="decay_mod" value="1.5" GAME="SP"/>
<param name="decay_mod" value="1.0" GAME="MP"/>
<param name="end_decay_mod" value="1.0"/>
<param name="impulse_mod" value="1.0"/>
<param name="maxx_mod" value="0.75"/>
<param name="maxx_mod" value="1.0"/>
<param name="angular_impulse_mod" value="1.0" />
<param name="back_impulse_mod" value="1.0" />
<param name="recoil_crouch_m_mod" value="0.75" GAME="SP"/>
<param name="recoil_crouch_m_mod" value="1.0" GAME="MP"/>
<param name="recoil_jump_m_mod" value="1.0" />
<param name="recoil_holdBreathActive_m_mod" value="1.25" GAME="SP"/>
<param name="recoil_holdBreathActive_m_mod" value="1.0" GAME="MP"/>
</recoilMod>
<scope>
<param name="dark_in_time" value="0.15" />
<param name="dark_out_time" value="0.025" />
</scope>
</zoommode>
The following guide might be a bit outdated, but the core functionality should still be intact:
https://docs.cryengine.com/display/SDKD ... +Scripting

Who is online

Users browsing this forum: No registered users and 2 guests