2010-08-22 13:13:17 +00:00
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
< !DOCTYPE funcs
SYSTEM '../../../clonk.dtd'>
2009-05-09 13:11:51 +00:00
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs >
2010-08-22 13:13:17 +00:00
<func >
<title > SetPlrView</title>
<category > Player</category>
<subcat > View</subcat>
<version > 4.6.5.0 CP</version>
<syntax >
<rtype > bool</rtype>
<params >
<param >
<type > int</type>
<name > player</name>
<desc > Player whose view distance to want to set.</desc>
</param>
<param >
<type > object</type>
<name > obj</name>
<desc > Object to which to want to set the view.</desc>
</param>
</params>
</syntax>
<desc > Centers a player's view to the specified object. The view will follow this object until the next player command.</desc>
<examples >
<example >
<code > local oFeind;
2009-05-09 13:11:51 +00:00
// TimerCall eines automatischen Aussichtsturms
protected func Timer()
{
// Bereits einen Feind gefunden?
<funclink > if</funclink> (!oFeind)
{
// Alarm schlagen?
<funclink > while</funclink> (oAlarm = <funclink > FindObject</funclink> (0, -100, -100, 200, 200, <funclink > OCF_CrewMember</funclink> (), 0, 0, 0, oAlarm))
<funclink > if</funclink> (<funclink > Hostile</funclink> (<funclink > GetOwner</funclink> (oAlarm), <funclink > GetOwner</funclink> ()))
{
// Ein feindlicher Clonk!
SetPlrView(<funclink > GetOwner</funclink> (), oAlarm);
2010-08-22 13:13:17 +00:00
<funclink > Sound</funclink> (" Bing" );
2009-05-09 13:11:51 +00:00
break;
}
}
else
{
<funclink > if</funclink> (<funclink > ObjectDistance</funclink> (oFeind) < 120)
{
2010-08-22 13:13:17 +00:00
// Noch einige ständige Effekte bei Alarm
<funclink > Sound</funclink> (" Bing" );
<funclink > Message</funclink> (" !!! FEIND !!!" );
2009-05-09 13:11:51 +00:00
}
else
{
// wenn er sich entfernt: Alarm beenden
oFeind = 0;
}
}
}
</code>
2010-08-22 13:13:17 +00:00
<text > Automatic watch tower: if an enemy clonk gets near the tower the player's view will be set to the attacker. Also, a sound is played and a message is popped up while the enemy is in range.</text>
</example>
</examples>
<related >
<funclink > GetPlrView</funclink>
<funclink > GetPlrViewMode</funclink>
<funclink > SetPlrViewRange</funclink>
<funclink > SetFoW</funclink>
</related>
</func>
<author > PeterW</author> <date > 2003-04</date>
2009-05-09 13:11:51 +00:00
</funcs>