I love the smell of UnrealEd crashing in the morning. – tarquin
Difference between revisions of "UE1:Authorizer"
From Unreal Wiki, The Unreal Engine Documentation Site
m (updated due to changes to class infobox) |
(→Source Code) |
||
Line 73: | Line 73: | ||
foreach AllActors( class 'Actor', A, Event ) | foreach AllActors( class 'Actor', A, Event ) | ||
A.Trigger( Other, Other.Instigator ); | A.Trigger( Other, Other.Instigator ); | ||
− | if( | + | if( PlayerPawn(Other) != none ) |
− | PlayerPawn(Other).ClientMessage(SuccessMessage); | + | { |
− | + | if( bShowSuccessMessage && bWasOpened ) | |
− | + | PlayerPawn(Other).ClientMessage(SuccessMessage); | |
+ | if( bShowFailtureMessage && !bWasOpened ) | ||
+ | PlayerPawn(Other).ClientMessage(FailtureMessage); | ||
+ | } | ||
} | } | ||
Latest revision as of 00:30, 5 August 2010
About[edit]
This is very old script I've created to Skaarj Evasion TC (RIP). As a base was used KeyMover tutorial from Chimeric.
Properties[edit]
Visible[edit]
- class<inventory> KeyClass
- key class to search in players inventory
- bool bDestroyKey
- should key be deleted from inventory
- bool bCheckKeyOnceOnly
- if true and key was found, this class starts acting like standard trigger
- bool bShowSuccessMessage
- if true will show message when key was found
- bool bShowFailtureMessage
- if true will show message when key can not be found
- localized String SuccessMessage
- message visible when player has a key
- localized String FailtureMessage
- message visible when player don't have a key
Hidden[edit]
- bool bWasOpened
- true if key was found and bCheckKeyOnceOnly is set to true
Source Code[edit]
//================================================= // 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<inventory> 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 && !bWasOpened) { key = Pawn(Other).FindInventoryType(KeyClass); if (key != none && Event != '' && !bCheckKeyOnceOnly) 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( PlayerPawn(Other) != none ) { if( bShowSuccessMessage && bWasOpened ) 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." }