I'm a doctor, not a mechanic
Difference between revisions of "UE1:Authorizer"
From Unreal Wiki, The Unreal Engine Documentation Site
(Thanks Raven!) |
m |
||
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. | |
<uscript> | <uscript> | ||
Line 10: | Line 10: | ||
//================================================= | //================================================= | ||
// by Raven | // by Raven | ||
− | // http://turniej.unreal.pl | + | // http://turniej.unreal.pl/rp |
− | / | + | |
// for The Chosen One SP mod | // for The Chosen One SP mod | ||
//================================================= | //================================================= | ||
− | class Authorizer extends | + | class Authorizer extends Trigger; |
− | + | var() class KeyClass; | |
− | + | var() bool bDestroyKey; | |
− | var() class | + | var() bool bCheckKeyOnceOnly; |
− | var() bool | + | var() bool bShowSuccessMessage; |
− | var() bool | + | var() bool bShowFailtureMessage; |
− | var() bool | + | |
− | var() bool | + | |
var() localized String SuccessMessage; | var() localized String SuccessMessage; | ||
var() localized String FailtureMessage; | var() localized String FailtureMessage; | ||
− | var bool | + | var bool bWasOpened; |
− | + | ||
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 ) |
+ | bWasOpened; | ||
} | } | ||
function Touch( actor Other ) | function Touch( actor Other ) | ||
{ | { | ||
− | + | local Inventory key; | |
− | + | local actor A; | |
− | + | if (Other.IsA('Pawn') && KeyClass != NONE) | |
+ | { | ||
+ | key = Pawn(Other).FindInventoryType(KeyClass); | ||
− | + | if (key != none && Event != '') | |
− | + | foreach AllActors( class 'Actor', A, Event ) | |
− | + | A.Trigger( Other, Other.Instigator ); | |
− | + | ||
− | + | ||
− | + | ||
− | + | if(bDestroyKey) | |
− | + | if(!bWasOpened) Pawn(Other).DeleteInventory(key); | |
− | + | if(bCheckKeyOnceOnly) | |
− | + | bWasOpened=true; | |
− | + | } | |
− | + | if(bWasOpened && Event != '') | |
− | + | foreach AllActors( class 'Actor', A, Event ) | |
− | + | A.Trigger( Other, Other.Instigator ); | |
− | + | if(bShowSuccessMessage && PlayerPawn(Other) != none) | |
− | + | PlayerPawn(Other).ClientMessage(SuccessMessage); | |
− | + | if(bShowFailtureMessage && !bWasOpened) | |
− | + | PlayerPawn(Other).ClientMessage(FailtureMessage); | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
defaultproperties | defaultproperties | ||
{ | { | ||
− | + | bShowFailtureMessage=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." | ||
− | |||
} | } | ||
+ | |||
</uscript> | </uscript> | ||
[[Category:Legacy Mapping|{{PAGENAME}}]] | [[Category:Legacy Mapping|{{PAGENAME}}]] | ||
[[Category:Legacy Custom Class (UT)|{{PAGENAME}}]] | [[Category:Legacy Custom Class (UT)|{{PAGENAME}}]] |
Revision as of 04:43, 20 March 2008
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 is very old script, I've created to Skaarj Evasion TC (RIP). As a base was used KeyMover tutorial from 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.
//================================================= // 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/rp // for The Chosen One SP mod //================================================= class Authorizer extends Trigger; var() class KeyClass< SEMI > var() bool bDestroyKey; var() bool bCheckKeyOnceOnly; var() bool bShowSuccessMessage; var() bool bShowFailtureMessage; var() localized String SuccessMessage; var() localized String FailtureMessage; var bool bWasOpened; replication { // Variables the server should send to the client. reliable if( Role==ROLE_Authority ) bWasOpened; } function Touch( actor Other ) { local Inventory key; local actor A; if (Other.IsA('Pawn') && KeyClass != NONE) { key = Pawn(Other).FindInventoryType(KeyClass); if (key != none && Event != '') foreach AllActors( class 'Actor', A, Event ) A.Trigger( Other, Other.Instigator ); if(bDestroyKey) if(!bWasOpened) Pawn(Other).DeleteInventory(key); if(bCheckKeyOnceOnly) bWasOpened=true; } if(bWasOpened && Event != '') foreach AllActors( class 'Actor', A, Event ) A.Trigger( Other, Other.Instigator ); if(bShowSuccessMessage && PlayerPawn(Other) != none) PlayerPawn(Other).ClientMessage(SuccessMessage); if(bShowFailtureMessage && !bWasOpened) PlayerPawn(Other).ClientMessage(FailtureMessage); } defaultproperties { bShowFailtureMessage=True SuccessMessage="Access granded." FailtureMessage="You need a key to open this door." }