Extra Ego animations

Pikachu14 Allright, I got this Ego character and I want him to do shyte, like dying in several nasty ways and stuff. I can do the Death dialog window, but how do I handle the animations?
Brian_Provinciano You can change the ego's animation easily with main.sc's SetUpEgo() procedure.

See the info at:
http://www.bripro.com/scistudio/help/scc/script_main.html
Pikachu14 Uhhn...no.

I mean, Ego walks through some dangerous area and suddenly trips over a rock or something.

How do I make Ego trip?
Lars Skovlund
Pikachu14 wrote:

Uhhn...no.

I mean, Ego walks through some dangerous area and suddenly trips over a rock or something.

How do I make Ego trip?


Control lines. Choose a colour and draw on the control map of your picture. Define a constant that identifies the colour (this will clarify your code somewhat). Then put something like this in the doit of your room script:


(if (& (send gEgo:onControl()) CONTROL_EGO_TRIP)
(send gRoom:setScript(egoTripScript))
)


Then define egoTripScript accordingly. You can use the End cycler to play an animation once and have the controlling script notified:


(send gEgo:view(VIEW_TRIP_DIE) setCycle(End self))


Then in the second state of your script, you call the death handler as usual.
Pikachu14 ...Thank you. I'm gonna try that now...
Pikachu14 Errrm...how do I define EgoTripScript?
Pikachu14 Allright forget it. It works.

"Specify:
[ DIE ]"
* BLAM! Monkeyman's head explodes! *
"Whatever gave you the idea...."
Joe Lars, that's a good idea, I would've done:


(if (& (send gEgo:onControl()) CONTROL_EGO_TRIP)
(send gEgo:view(VIEW_TRIP_DIE) setCycle(End egoTripScript))
)


But your way is much better. Thanks
Lars Skovlund
Pikachu14 wrote:

Errrm...how do I define EgoTripScript?


I have drawn a yellow control line on the picture and added the sample death icon to the game as view number 5.
This will cycle the death icon once, wait a short while and then run the standard death handler.

(define CONTROL_EGO_TRIP $4000) /* This is ctlYELLOW */
(define VIEW_EGO_TRIP 5)

(instance egoTripScript of Script
(properties)
(method (changeState newState)
(var dyingScript)
(super:changeState(newState))
(switch (newState)
(case 0 (send gEgo:view(VIEW_EGO_TRIP) setMotion(NULL) setCycle(End self)))
(case 1 ((send gEgo:setCycle(NULL)) = cycles 13)) /* Short pause */
(case 2 (Print("You tripped!"))
= dyingScript ScriptID(DYING_SCRIPT)
(send dyingScript:caller(VIEW_EGO_TRIP)
register("You're dead!"))
(send gGame:setScript(dyingScript)))
)
)
)

/******************************************************************************/
(instance RoomScript of Script
   (properties)
(method (doit)
(if (& (send gEgo:onControl()) CONTROL_EGO_TRIP)
(send gRoom:setScript(egoTripScript))
)
)
   (method (handleEvent pEvent)
(super:handleEvent(pEvent))

/*****************************************
* Handle the possible said phrases here *
*****************************************/
(if(Said('look'))
Print("You are in an empty room")
)
   )
)

Pikachu14 Thanks, but I already figured it out!