Basic Tutorial for SCI1.1 - Dying: Difference between revisions

From Sierra Wiki
Jump to navigationJump to search
Andrew Branscom (talk | contribs)
No edit summary
 
Andrew Branscom (talk | contribs)
 
(4 intermediate revisions by the same user not shown)
Line 4: Line 4:
<div align="center">
<div align="center">
Chapter:  
Chapter:  
[[Customizing the Title Screen|1]] |  
[[Basic Tutorial for SCI1.1 - Customizing the Title Screen|1]] |  
[[The First Room|2]] |  
[[Basic Tutorial for SCI1.1 - The First Room|2]] |  
[[Interacting with Objects|3]] |  
[[Basic Tutorial for SCI1.1 - Interacting with Objects|3]] |  
[[Adding a Background and Static Objects|4]] |  
[[Basic Tutorial for SCI1.1 - Adding a Background and Static Objects|4]] |  
[[The Priority Screen|5]] |  
[[Basic Tutorial for SCI1.1 - The Priority Screen|5]] |  
[[Animating Props|6]] |  
[[Basic Tutorial for SCI1.1 - Animating Props|6]] |  
[[Managing the Player’s Inventory|7]] |  
[[Basic Tutorial for SCI1.1 - Managing the Player’s Inventory|7]] |  
[[Actors|8]] |  
[[Basic Tutorial for SCI1.1 - Actors|8]] |  
[[Dying|9]] |  
[[Basic Tutorial for SCI1.1 - Dying|9]] |  
[[Using Inventory Items|10]] |  
[[Basic Tutorial for SCI1.1 - Using Inventory Items|10]] |  
[[Scoring and Flags|11]] |  
[[Basic Tutorial for SCI1.1 - Scoring and Flags|11]] |  
[[Adding a Second Room|12]]
[[Basic Tutorial for SCI1.1 - Adding a Second Room|12]]
</div><br />
</div><br />


Line 95: Line 95:
&nbsp;
&nbsp;


<span style="float: left">[[Actors|&lt; Previous: Actors]]</span>
<span style="float: left">[[Basic Tutorial for SCI1.1 - Actors|&lt; Previous: Actors]]</span>
<span style="float: right">[[Using Inventory Items|Next: Using Inventory Items &gt;]]</span>
<span style="float: right">[[Basic Tutorial for SCI1.1 - Using Inventory Items|Next: Using Inventory Items &gt;]]</span>
&nbsp;
&nbsp;
[[Category:Technical Info]]
[[Category:Technical Info]]

Latest revision as of 12:56, 28 April 2025

SCI Tutorials and Guides

Chapter: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12


Dying
Author: Phil Fortier


IMPORTANT:: SCI1.1 only




Introduction

Having an evil ego walking around is a good time to worry about dying.


Coding Death

Let's make the ego die when the evil ego gets close. Add a script to the evilEgo. We can delete the changeState method (we don't need it) and just use doit(). Furthermore, we can override init() in the evilEgo and set the script there. That looks like:

SCI Code:
    (instance evilEgo of Actor
        (properties
            view 1
            x 231
            y 131
            signal ignAct
            noun N_EVILEGO
            moveSpeed 30
            cycleSpeed 30
        )
    
        (method (init)
            (super init: &rest)
            (self setScript: evilEgoScript)
        )
    )

    (instance evilEgoScript of Script
        (properties)
    
        (method (doit)
            (super doit:)
        )
    )

Now in our doit() method we need to see how close the evilEgo is to the player, and kill them if evilEgo is too close:

SCI Code:
    (instance evilEgoScript of Script
        (properties)
    
        (method (doit)
            (super doit:)
            (if (<= (client distanceTo: gEgo) 25)
                (Die)
            )
        )
    )

Is it that easy? Yes it is! You can also pass a number to Die to indicate a death reason. This lets you customize your death screen. The default one in the template game is a little spartan, but you can open DeathRoom.sc and customize to your heart's content when you're more familiar with SCI.

What if there were a way to fight back?


References



Also See

 

< Previous: Actors Next: Using Inventory Items >