Peripheral vision for moving guards.


Recommended Posts

Hey guys, Ithink I'm trying to do it every half of year or so but not persistent enough.
There was a thing in a last early access build, when guards were using theire peripheral vision on patrol and were better in detecting targets and it was quite interseting. Did anyone thought about modding it back? I just can't even understand where code for things like that.

Link to comment
Share on other sites

The function is defined as simengine:moveUnit in engine.lua.

You could create a dummy object and add TRG_UNIT_WARP_PRE to it. You'd need a function that is called upon sim creation. mainframe.init is probably the simplest option.

local triggerObject = {
	onTrigger = function( self, sim, evType, evData )
		if evType == simdefs.TRG_UNIT_WARP_PRE and evData.unit:getBrain() then
			evData.unit:getBrain():getSenses():checkPeripheralVision()
			sim:processReactions(evData.unit)
		end
	end
}

local oldinit = mainframe.init

mainframe.init = function( sim )
	local obj = util.tcopy(triggerObject)
	sim:addTrigger(simdefs.TRG_UNIT_WARP_PRE,obj)
	return oldinit( sim )
end

 

Link to comment
Share on other sites

Hmmm, now I should ask you what is dummy object actually, did we can add an objects, etc, I'm afraid that if I ask you that, I'll need to ask you about next one something, then next, then next. And is it possible to work as workshop mod or require to merge original files. What a frustrational topic.

Link to comment
Share on other sites

The dummy object can be any table. Unlike sim events (which are passed to the boardrig and the relevant unitrig) triggers are passed to the object you pass to sim:addTrigger.

I guess we can add new classes if that's what you're wondering. I don't know what you'd need it for that you can't accomplish with simunit.

This is possible to do on a workshop mod. I use a similar dummy object for Advanced Guard Protocol (not the released version, a version that is in development)

Link to comment
Share on other sites

46 minutes ago, Cyberboy2000 said:

I guess we can add new classes if that's what you're wondering. I don't know what you'd need it for that you can't accomplish with simunit.

You think I'm smarter than I am. I don't know terminogy. I have no idea how to use simunit or why, have no idea what you mean by classes, and I have no idea what object is, beside game objects, like idk, props or agents or whatever that probably not an objects but called whatever differently.

Any table? Like lua table or like any wooden table on a level? >_<
If second, idk, could it be in a new ability code?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.