class CBP1_Girl_A extends CBP1_Pawn; var string name; var bool Hit1; var bool Hit2; function Touch( actor Other ){ // Get the name of the Other actor touched and display the name name = Other.GetPropertyText("Name"); ClientMessage("CBP1_Girl_A::Touch: Touched Actor " $ name); // Test to see if we've touched UseTrigger0 if(name == "UseTrigger0") { Hit1 = true; } // Test to see if we've touched Spotlight0 if(name == "Spotlight0") { Hit2 = true; } if ( (Hit1 == true) && (Hit2==true) ) ClientMessage("GOAL ACHIEVED"); } function BeginPlay() { // Initialize variables Hit1 and Hit2 to false - they're NOT yet hit Hit1 = false; Scripting = Programmin g
13
Embed
class CBP1_Girl_A extends CBP1_Pawn; var string name; var bool Hit1; var bool Hit2;
class CBP1_Girl_A extends CBP1_Pawn; var string name; var bool Hit1; var bool Hit2; function Touch( actor Other ){ // Get the name of the Other actor touched and display the name name = Other.GetPropertyText("Name"); ClientMessage("CBP1_Girl_A::Touch: Touched Actor " $ name); - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
class CBP1_Girl_A extends CBP1_Pawn;
var string name;var bool Hit1;var bool Hit2;
function Touch( actor Other ){
// Get the name of the Other actor touched and display the name name = Other.GetPropertyText("Name"); ClientMessage("CBP1_Girl_A::Touch: Touched Actor " $ name);
// Test to see if we've touched UseTrigger0 if(name == "UseTrigger0") { Hit1 = true; } // Test to see if we've touched Spotlight0 if(name == "Spotlight0") { Hit2 = true; }
if ( (Hit1 == true) && (Hit2==true) ) ClientMessage("GOAL ACHIEVED");
}
function BeginPlay() {
// Initialize variables Hit1 and Hit2 to false - they're NOT yet hit Hit1 = false;
Scripting = Programming
The Concept of Classes
Object
Actor
Pawn UseTrigger
CBP1_Girl CBP1_Girl_A
• Object has tons of code
• Actor “inherits” this via “extend”
• Pawn “inherits” this likewise
• So does CBP1_Girl
• and also CBP1_Girl_A
• But CBP1_Girl can replace Pawn’s code
x
The runtime engine
Runtime Engine
function BeginPlay() {
}
Your stuff here
function Touch() {
}
function Bump() {
}
Your stuff here
Your stuff here
Invisible Visible for each Actor
function Touch() {
}
Touch
class CBP1_Girl extends CBP1_Pawn;
function Touch( actor Other ){
}
File : CBP1_Girl.uc
UseTrigger
CBP1_Girl
Level
This and Other Actors
Bump
function Bump() {
}
function Bump( actor Other ) {
name = Other.GetPropertyText("Name");
ClientMessage("CBP1_Girl_A::Bump: Bumped Actor " $ name);