discussion about presentations, sniper zoom, helmet cam, etc...

Users who are viewing this thread

Rize

Sergeant Knight at Arms
I don't know what i did wrong, but when i pressed the key that i assigned to show the presentation, nothing happened. Then when i went to module_presentations and changed the mesh it was supposed to load into mesh_load_window, it worked perfectly.
How exactly must the mesh be in order for the presentation to "accept" it?
 

HokieBT

Grandmaster Knight
M&BWB
This is still a work in progress, but this is what i did so far.....

Texture & BRF
Texture Tab - create a transparent texture, save as DXT5 if its semi-transparent
Material Tab - shader (simple_shader) and flags (134217985)
Mesh Tab - create a 2d mesh that uses that material

module_meshes.py
Code:
  ("helmet_view_stormtrooper", 0, "helmet_view_stormtrooper", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("helmet_view_mandalorian", 0, "helmet_view_mandalorian", 0, 0, 0, 0, 0, 0, 1, 1, 1),

module_presentations.py

Code:
("helmet_view", prsntf_read_only, 0, [		#must use prsntf_read_only or you cannot attack
	(ti_on_presentation_load,
		[
		(presentation_set_duration, 999999),
		
		#(troop_get_inventory_slot,":item_id","trp_player",":slot_no"),
		(troop_get_inventory_slot,":item_id","$g_player_troop", 4),	#$g_player_troop is because  custom commander is integrated, 4 = ek_head
		(try_begin),
			(eq, ":item_id", "itm_imperial_stormtrooper_helmet"),
			(create_mesh_overlay, reg1, "mesh_helmet_view_stormtrooper"),
		(else_try),
			(create_mesh_overlay, reg1, "mesh_helmet_view_mandalorian"),
		(try_end),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, 0),
        (overlay_set_position, reg1, pos1),	
		]),
	(ti_on_presentation_run,
       		[
			(try_begin),
				(le, "$helmet_view", 0),
		        (presentation_set_duration, 0),
	        (try_end),
        	]),	
]),

module_mission_templates.py
- add this code to the top and then add it to any mission templates you want it usable in
Code:
common_helmet_view = (0, 0, 0, [
	(key_clicked, key_v)
	],
	[
		(get_player_agent_no, ":player_agent"),
		(agent_is_alive, ":player_agent"),
		
		(try_begin),
			(le, "$helmet_view", 0),	#incase this variable isn't set yet
			(assign, "$helmet_view", 1),
			(start_presentation, "prsnt_helmet_view"),
		(else_try),
			(assign, "$helmet_view", 0),
		(try_end),
	])

optional - module_scripts.py
- I added the following to game_get_item_extra_text
Code:
(else_try),
		(this_or_next|eq, ":item_no", "itm_imperial_stormtrooper_helmet"),
                (eq, ":item_no", "itm_mandalorian_soldier_helmet"),
                (eq, ":extra_text_id", 0),
                (set_result_string, "@Press 'V' to enable Helmet View"),
                (set_trigger_result, 0x00ff7f), #Green text
 

Rize

Sergeant Knight at Arms
Thanks, that was really helpful, and it'll probably be to all the modders who want helmet vision. I hope i'll be able to expand this in my own way but i'm not so sure  :razz:
 

Rize

Sergeant Knight at Arms
Import a native one into wings3d or create a cube and delete all faces except one.
 

bjorne.

Sergeant Knight
Well you could bind the helmet vio with the "R" button. So when you press "R" ýou both enter helmet mode and first person mode.
 

Rize

Sergeant Knight at Arms
yeah but if you leave a scene in first person you enter the next scene in first person, then if you press R you'll have helmet vision in third person
 

FrisianDude

Archduke
M&BWB
Maybe the helmet vision is bindable to a different key? That way people that don't feel like using it, don't have to, even in first person, and you could turn it off if it accidently turns up in third person. (Would it turn up on the map, though?:???:)
 

Rize

Sergeant Knight at Arms
Not one the map because it's a mission template, but that way it won't add a different challenge to mods that use it.

And how do i make a transparent texture, i make a transparent bmp in photoshop and then convert it into dds but it's white in-game.  :???:
 

jik

Knight
Use alpha channel for transparency.

I'm wondering if you can test at the begining of the mission where the camera is set.  If it's set to 1st person, turn on the presentation.  This would then leave the button toggle to work right.
 

Rize

Sergeant Knight at Arms
****.. they said tga and png support transparency, but it's the same thing, and i have no idea how to add an alpha channel, unless i save directly as a dds, in which case it doesn't recognize the texture.

Now does anyone know a way to move the health bar and ammo around?

Edit: Well, dds works, but only the background is transparent, i made a 60% transparent orange and it shows up 100% opaque  :mad:
 

jik

Knight
Rize said:
****.. they said tga and png support transparency, but it's the same thing, and i have no idea how to add an alpha channel, unless i save directly as a dds, in which case it doesn't recognize the texture.

Now does anyone know a way to move the health bar and ammo around?

Edit: Well, dds works, but only the background is transparent, i made a 60% transparent orange and it shows up 100% opaque  :mad:

You need to be working with a proper graphics program (such as Photoshop) that handles transperancies.  Also the DDS needs to be saved in DXT5 format.
 

Rize

Sergeant Knight at Arms
Done and done, but this is still how it looks, the ones on the top right hand side are transparent in photoshop...
51335525.jpg


Edit: Oh, nevermind, it's transparent in-game  :mrgreen:
 

Rize

Sergeant Knight at Arms
Hey, how do you make a scope kind of zoom work. I have this presentation and mission template but it only shows the scope mesh for 0.1 seconds and then never shows it again until reloading the game.

presentation
Code:
   ("zoom_presentation", prsntf_read_only, 0, [
     (ti_on_presentation_load,
        [
        (presentation_set_duration, 1),
       
       (try_begin),
        (troop_has_item_equipped, "trp_player","itm_crossbow"),
        (create_mesh_overlay, reg1, "mesh_shotgun_scope"),
       (else_try),
        (presentation_set_duration, 0),
       (try_end),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, 0),
        (overlay_set_position, reg1, pos1),   
       ]),
     (ti_on_presentation_run,
             [
         (try_begin),
            (le, "$scope_zoom", 0),
              (presentation_set_duration, 0),
           (try_end),
           ]), 

mission template
Code:
common_scope_zoom = (0.9, 0, 0, [
   (key_is_down, key_q)],
   [
     (get_player_agent_no, ":player_agent"),
     (agent_is_alive, ":player_agent"),
      
         (le, "$scope_zoom", 0),   #incase this variable isn't set yet
         (assign, "$scope_zoom", 1),
         (start_presentation, "prsnt_zoom_presentation"),
     ])
 

HokieBT

Grandmaster Knight
M&BWB
looking quickly you may need to add a (neg|game_key_is_down,gk_zoom), to your presentation run.  Here's my code if you want to poke through it....

mission_templates
Code:
common_zoom_view = (0, 0, 0, [
		(game_key_is_down, gk_zoom)
	],
	[
		(get_player_agent_no, ":player_agent"),
		(agent_is_alive, ":player_agent"),
		(start_presentation, "prsnt_zoom_view"),
	])


presentations
Code:
add this to the top if you want to use the code below
#SW - added for zoom_view functionality
from header_items import *


("zoom_view", prsntf_read_only, 0, [		#must use prsntf_read_only or you cannot attack
	(ti_on_presentation_load,
		[
		(presentation_set_duration, 999999),
		
		(assign, ":view", 0),
		(get_player_agent_no, ":player_agent"),
		(agent_get_wielded_item, ":item_handone", ":player_agent", 0),
		#(agent_get_wielded_item, ":item_handtwo", ":player_agent", 1),
		(try_begin),
			(eq, ":item_handone", -1),
			(assign, ":view", 1),	#use binoculars
		(else_try),
			#(ge, ":item_handone", 0),
			(item_get_type, ":item_type_handone", ":item_handone"),
			(try_begin),
				(this_or_next|eq, ":item_type_handone", itp_type_one_handed_wpn),
				(this_or_next|eq, ":item_type_handone", itp_type_two_handed_wpn),
				(this_or_next|eq, ":item_type_handone", itp_type_bow),
				(eq, ":item_type_handone", itp_type_polearm),
				(assign, ":view", 1),	#use binoculars
			(else_try),
				(eq, ":item_type_handone", itp_type_crossbow),
				(assign, ":view", 2),	#use scope
			(else_try),
				(assign, ":view", 0),	#pistol, other, don't do anything
			(try_end),
		(try_end),

		(try_begin),
			(eq, ":view", 1),
			(create_mesh_overlay, reg1, "mesh_binocular_display"),
			(position_set_x, pos1, 0),
			(position_set_y, pos1, 0),
			(overlay_set_position, reg1, pos1),	
		(else_try),
			(eq, ":view", 2),
			(create_mesh_overlay, reg1, "mesh_scope_display"),
			(position_set_x, pos1, 0),
			(position_set_y, pos1, 0),
			(overlay_set_position, reg1, pos1),			
		(try_end),
		
		]),
	(ti_on_presentation_run,
       		[
			(neg|game_key_is_down,gk_zoom),
			#(assign, "$zoom_view", 0),
			(presentation_set_duration, 0),
        	]),	
]),
 
Top Bottom