"see" in some old scripts

greatguys1

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
60
Age
26
Location
Yes
In looking through deralia/innkeeper, and I see,
Code:
{
    repeatdelay 2

    if CANCHAT isnot 0
    see player 180

    callevent say_hi
    calleventtimed 20 chatreset 
}
What does "see" do?
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
Looking at the code, I'm actually not entirely sure. Certainly depreciated, as I don't think it's parsing the params, but it is accepting it, and always returning "2".

Originally, I think it was intended to act as a conditional - only continue if it saw a player within 180 units or degrees of vision (not sure which), but I'd have to look at some pre-Steam MS code to find out.

These days, all NPCs have 180 degrees of vision, as other settings tend to cause brain death. If you wanted a conditional where they'd only react upon seeing a character within a certain range, you'd use:
Code:
if $cansee(player,256)
(So as to not pass this line if it can't see a player within 256 units.)

Whenever $cansee() is invoked and true, it stores in ent_lastseen. Dun think the same is true of the "see" command.

If you wanted to restrict the FOV reaction to less than 180 degrees, you'd use a $within_cone2D() test after. Replace $cansee() with $get_tsphere() for 360 vision, followed by a cone test for 181-359.

Mind, $get_tsphere is more reliable than $cansee, and ignores walls, but also a lot more resource intensive - so the hunt cycle uses $cansee every think frame, while most "idle and waiting" NPC's use $get_tsphere or getplayers every full second or so.

Here's the odd code for it:
Code:
int CMSMonster::Script_ParseLine( CScript *Script, msstring_ref pszCommandLine, scriptcmd_t &Cmd )
{
	msstring CmdName = msstring(pszCommandLine).thru_char( SKIP_STR );
	if( !stricmp(CmdName.c_str(),	"see"	) )
	{
		Cmd.m_NewConditional = false;
		return 2;
	}

	return IScripted::Script_ParseLine( Script, pszCommandLine, Cmd );
}

"look" is a related depreciated command you might see here and there. Forces mob to store all enemy targets within 1024 units in a list which it doesn't really seem to use anymore.
 
Top