Page MenuHomeFeedback Tracker

Interact Action UI Error
Assigned, UrgentPublic

Description

I'm trying to setup an item with two ActionSingleUseBase actions. One of the actions is ActionTogglePlaceObject, which is vanilla; the other action ,ActionReadNote, is for reading an item in hand. The issue i'm having is allowing both the actions to be present for the item UI. I set the ActionReadNote to inherit from ActionSingleUseBase and overrode the GetInputType method to return InteractActionInput, and overrode HasTarget to be false. This allowed me to have an action with the configured interact action key and the single use key, F and Left click. But the ActionReadNote action only shows up when I'm targeting the an item of the same type that I added it to, the ActionCondition is only for item in hand and not target.

Here's an example video https://streamable.com/68hbc
if you need any addition information i can provide it, i know this might be a terrible explanation.

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General

Event Timeline

Geez changed the task status from New to Assigned.Thu, Jan 30, 12:21 PM
Geez added a subscriber: Geez.

Hello OfficialWardog.
I think your problem might be condition components. It should look something like this:

	override void CreateConditionComponents()  
	{	
		m_ConditionItem = new CCINonRuined;
		m_ConditionTarget = new CCTNone;
	}

Also, try adding these overrides. Not every single one might be nescessary in your case, but it can't hurt to have them in there:

override bool HasTarget()
	{
		return false;
	}
	bool UseMainItem()
	{
		return true;
	}
	bool MainItemAlwaysInHands()
	{
		return true;
	}

Regards,
Geez

OfficialWardog added a comment.EditedThu, Jan 30, 4:56 PM

This is the original action script, I haven't changed it. But UseMainItem and MainItemAlwaysInHands is part of 1.07, I've yet to test the changes to actions there, but I'll check to see if it makes any difference.

class ActionReadNote : ActionSingleUseBase
{
        void ActionReadNote()
	{
		m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_VIEWNOTE;
		m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_PRONE;
                m_FullBody = true;
	}

	override void CreateConditionComponents()
	{
		m_ConditionItem = new CCINonRuined();
		m_ConditionTarget = new CCTNone();
	}

	override typename GetInputType()
	{
		return InteractActionInput;
	}

	override bool HasTarget()
	{
		return false;
	}

	override string GetText()
	{
		return "#read";
	}

	override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
	{
		if (item && item.IsInherited(WrittenNote))
		{
			if (!player.IsPlacingLocal())
				return true;
		}

		return false;
	}
}