There is no spoon

Difference between revisions of "UE1:Authorizer"

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
m
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{classbox| [[Legacy:UT|UT]] :: [[Legacy:Actor_(UT)|Actor_(UT)]] >> [[Legacy:Triggers_(UT)|Triggers_(UT)]] >> Authorizer}}
 
{{classbox| [[Legacy:UT|UT]] :: [[Legacy:Actor_(UT)|Actor_(UT)]] >> [[Legacy:Triggers_(UT)|Triggers_(UT)]] >> Authorizer}}
  
This is very old script, I've created to Skaarj Evasion TC (RIP). As a base was used KeyMover tutorial from [http://chimeric.beyondunreal.com/tutorials/tut11.html Chimeric]. You can use it in your map and it works online. As a key can be used everything, but I suggest to use only inventory based keys.
+
This tutorial base on key mover tutorial from Chimeric site.  
 +
 
 +
When I use key Mover for the first time I thought that some things are impossible with this class. First of all it would be better to instead a mover place a [[Legacy:Trigger|Trigger]]. That's why I've made this class. Authorizer can be opened when player have specified key. We are able to destroy this key or turn to normal trigger after destroying key. Here is icon: @inline@auth.
  
 
<uscript>
 
<uscript>
Line 10: Line 12:
 
//=================================================
 
//=================================================
 
// by Raven
 
// by Raven
// http://turniej.unreal.pl/rp
+
// http://turniej.unreal.pl
 +
// http://tcn.unreal.pl
 
// for The Chosen One SP mod
 
// for The Chosen One SP mod
 
//=================================================
 
//=================================================
class Authorizer extends Trigger;
+
class Authorizer extends Triggers;
  
var() class KeyClass;
+
#exec TEXTURE IMPORT NAME=Authorizer FILE="textures\Icons\auth.bmp" GROUP=Icons LODSET=2
var() bool bDestroyKey;
+
 
var() bool bCheckKeyOnceOnly;
+
var() class keyclass;
var() bool bShowSuccessMessage;
+
var() bool DestroyKey;
var() bool bShowFailtureMessage;
+
var() bool NormalAfterDestroying;  
 +
var() bool ShowSuccessMessage;  
 +
var() bool ShowFailtureMessage;  
 
var() localized String SuccessMessage;  
 
var() localized String SuccessMessage;  
 
var() localized String FailtureMessage;  
 
var() localized String FailtureMessage;  
var bool bWasOpened;
+
var bool norm;
 +
var bool opened;  
  
 
replication
 
replication
 
{
 
{
 
// Variables the server should send to the client.
 
// Variables the server should send to the client.
reliable if( Role==ROLE_Authority )
+
reliable if( Role==ROLE_Authority ) opened, norm;
bWasOpened;
+
 
}
 
}
  
 
function Touch( actor Other )
 
function Touch( actor Other )
 
{
 
{
local Inventory key;
+
    local Inventory key;
local actor A;
+
    local actor A;
  
if (Other.IsA('Pawn') && KeyClass != none && !bWasOpened)
+
    // BroadcastMessage("Bumped by "$Other.Name);
{
+
key = Pawn(Other).FindInventoryType(KeyClass);
+
  
if (key != none && Event != '' && !bCheckKeyOnceOnly)
+
    // First check to make sure this is a Pawn, cause they are
foreach AllActors( class 'Actor', A, Event )
+
    // only things that have inventories (i think:), and then
A.Trigger( Other, Other.Instigator );
+
    // make sure we have a keyclass to check for.
 +
    if (Other.IsA('Pawn') && keyclass != NONE)
 +
    {
 +
      // BroadcastMessage("Other.Class: "$Other.Class$", keyclass: "$keyclass);
  
if(bDestroyKey)
+
      // Now we just use FindInventoryType() to see if they have
if(!bWasOpened) Pawn(Other).DeleteInventory(key);
+
      // a copy of our desired key in their inventory...
if(bCheckKeyOnceOnly)
+
      key = Pawn(Other).FindInventoryType(keyclass);
bWasOpened=true;
+
 
}
+
      // ...if so call the old foreach function and let the trigger
if(bWasOpened && Event != '')
+
      // do its thing.
foreach AllActors( class 'Actor', A, Event )
+
      if (key != NONE)
A.Trigger( Other, Other.Instigator );
+
      {
if(bShowSuccessMessage && PlayerPawn(Other) != none)
+
        // Broadcastmessage("Found key");
PlayerPawn(Other).ClientMessage(SuccessMessage);
+
        if( Event != '' ) // trigger all matching actors.
if(bShowFailtureMessage && !bWasOpened)
+
          foreach AllActors( class 'Actor', A, Event )
PlayerPawn(Other).ClientMessage(FailtureMessage);
+
          {
 +
            A.Trigger( Other, Other.Instigator );
 +
          }
 +
 
 +
        if(DestroyKey)    // if true will delete key from inventory!
 +
          if(!norm)
 +
            Pawn(Other).DeleteInventory(key);
 +
        if(NormalAfterDestroying) //trigger will act like normal trigger if true
 +
          norm=true;
 +
        opened=true; //door was opened
 +
      }
 +
      if(norm) //is normal trigger
 +
        if( Event != '' ) // trigger all matching actors.
 +
          foreach AllActors( class 'Actor', A, Event )
 +
          A.Trigger( Other, Other.Instigator );
 +
      if(ShowSuccessMessage)
 +
        BroadcastMessage(SuccessMessage);
 +
      if(ShowFailtureMessage)
 +
        if(!opened)
 +
        {
 +
          BroadcastMessage(FailtureMessage); // show Failure message when we don't have a key
 +
        }
 +
 
 +
      // ...otherwise just do nothing.
 +
      // else BroadcastMessage("Couldn't find key");
 +
    }
 
}
 
}
  
 
defaultproperties
 
defaultproperties
 
{
 
{
     bShowFailtureMessage=True
+
     ShowFailtureMessage=True
 
     SuccessMessage="Access granded."
 
     SuccessMessage="Access granded."
 
     FailtureMessage="You need a key to open this door."
 
     FailtureMessage="You need a key to open this door."
 +
    Texture=Texture'Authorizer.Icons.Authorizer'
 
}
 
}
 
 
</uscript>
 
</uscript>
  
 +
==Discussion==
 +
 +
'''sweavo:''' hmm, isn't this achievable with Triggers only?  I think this page is a candidate for outright deletion.  If not, can anyone identify what UT versions this is compatible with?
 +
 +
'''Raven:''' nope, it isn't. You have '''ClassProximityType''' in Trigger code, but it doesn't searches in Player's inventory. It's meant for UT'99.
 +
 +
----
 +
 +
[[:Category:Legacy Mapping]] <br />[[:Category:Legacy Custom Class]] <br />[[:Category:Legacy Tutorial]] \\
 
[[Category:Legacy Mapping|{{PAGENAME}}]]
 
[[Category:Legacy Mapping|{{PAGENAME}}]]
[[Category:Legacy Custom Class (UT)|{{PAGENAME}}]]
+
[[Category:Legacy Custom Class|{{PAGENAME}}]]
 +
[[Category:Legacy Tutorial|{{PAGENAME}}]]

Revision as of 12:28, 18 November 2007

The classbox template is only supposed to be used by the converted content imported into the Legacy: namespace. Consider adding descriptions to existing class pages instead.

This tutorial base on key mover tutorial from Chimeric site.

When I use key Mover for the first time I thought that some things are impossible with this class. First of all it would be better to instead a mover place a Trigger. That's why I've made this class. Authorizer can be opened when player have specified key. We are able to destroy this key or turn to normal trigger after destroying key. Here is icon: @inline@auth.

//=================================================
// Authorizer: This Trigger can replace
// KeyMover (as base I use KeyMover avidible
// form http://chimeric.beyondunreal.com/tutorials/tut11.html).
//=================================================
// by Raven
// http://turniej.unreal.pl
// http://tcn.unreal.pl
// for The Chosen One SP mod
//=================================================
class Authorizer extends Triggers;
 
#exec TEXTURE IMPORT NAME=Authorizer FILE="textures\Icons\auth.bmp" GROUP=Icons LODSET=2
 
var() class keyclass< SEMI >
var() bool DestroyKey;  
var() bool NormalAfterDestroying; 
var() bool ShowSuccessMessage; 
var() bool ShowFailtureMessage; 
var() localized String SuccessMessage; 
var() localized String FailtureMessage; 
var bool norm;
var bool opened; 
 
replication
{
	// Variables the server should send to the client.
	reliable if( Role==ROLE_Authority ) opened, norm;
}
 
function Touch( actor Other )
{
    local Inventory key;
    local actor A;
 
    // BroadcastMessage("Bumped by "$Other.Name);
 
    // First check to make sure this is a Pawn, cause they are
    // only things that have inventories (i think:), and then
    // make sure we have a keyclass to check for.
    if (Other.IsA('Pawn') && keyclass != NONE)
    {
       // BroadcastMessage("Other.Class: "$Other.Class$", keyclass: "$keyclass);
 
       // Now we just use FindInventoryType() to see if they have
       // a copy of our desired key in their inventory...
       key = Pawn(Other).FindInventoryType(keyclass);
 
       // ...if so call the old foreach function and let the trigger
       // do its thing.
       if (key != NONE)
       {
         // Broadcastmessage("Found key");
         if( Event != '' ) // trigger all matching actors.
          foreach AllActors( class 'Actor', A, Event )
          {
            A.Trigger( Other, Other.Instigator );
          }
 
         if(DestroyKey)    // if true will delete key from inventory!
           if(!norm)
             Pawn(Other).DeleteInventory(key);
         if(NormalAfterDestroying) //trigger will act like normal trigger if true
           norm=true;
         opened=true; //door was opened
       }
       if(norm) //is normal trigger
         if( Event != '' ) // trigger all matching actors.
          foreach AllActors( class 'Actor', A, Event )
           A.Trigger( Other, Other.Instigator );
       if(ShowSuccessMessage)
         BroadcastMessage(SuccessMessage);
       if(ShowFailtureMessage)
         if(!opened)
         {
           BroadcastMessage(FailtureMessage); // show Failure message when we don't have a key
         }
 
       // ...otherwise just do nothing.
       // else BroadcastMessage("Couldn't find key");
    }
}
 
defaultproperties
{
     ShowFailtureMessage=True
     SuccessMessage="Access granded."
     FailtureMessage="You need a key to open this door."
     Texture=Texture'Authorizer.Icons.Authorizer'
}

Discussion

sweavo: hmm, isn't this achievable with Triggers only? I think this page is a candidate for outright deletion. If not, can anyone identify what UT versions this is compatible with?

Raven: nope, it isn't. You have ClassProximityType in Trigger code, but it doesn't searches in Player's inventory. It's meant for UT'99.


Category:Legacy Mapping
Category:Legacy Custom Class
Category:Legacy Tutorial \\