Newbie "killing alien" question

gideonwilliams
14 Feb 2012, 19:26
I just cant get it - sorry

I open box and inside is an alien. I have to use the spray in my inventory to kill it and if I do anything else eg look at, go out of room etc it kills me

In pidgeon code...

When Box is open say "Oh dear you have disturbed a rather dangerous creature."
If use spray on alien then destroy alien
Else If do anything else then game over


Ideally I want the player to have say 10s to enter the command to use spray on alien or she gets it

Please please help and put me out of this pain - even if they can point me to a game that I can look at and edit

Thanks

Alex
14 Feb 2012, 21:05
It's a bit difficult to override all commands except one (although it could be done). I think a better approach would be to remove all the exits so the player can't go anywhere, then give them 10 seconds to use the spray. That's probably a bit fairer on them as it means they're allowed to make typos at least.

You can hide the exits by making sure they all have names, then use (set a variable or attribute) exitname.parent = null

To give them 10s to use the spray, from the Timers script category choose "Run script after a number of seconds". In the script, if the alien's "dead" flag is not set, kill the player.

In the "use spray" script, set the alien's "dead" flag. Also, move the exits back into the room with exitname.parent = room

mws257
10 Apr 2012, 20:25
Newbie problems.....First and foremost I'm sorry if this little problem of mine is 'painfully obvious' but I simply can't see it and I was wondering whether anybody out there can be a second set of eyes and look at this for me.

I too want to explore exitname.parent = null and exitname.parent = room.. I have written a little program to see if I can get this principle to work and I can see it working but it won't let me move the player....It just keeps on telling me 'east' and the player stays in the same room......

I have successfully proven to myself that I can hide the exits and I have successfully proven to myself I can reopen them ...but I, as the player, still can't move from the room.....

Help Please....

Penny

sgreig
10 Apr 2012, 21:28
I'm not 100% sure, but I think your problem is that all of your scripts are in the exits themselves and have timers on them. I'm not even sure what you're trying to have happen. When I ran the game, I went east and the game just hung there printing "Yay!" over and over again.

I think a simpler idea would be to explain what you're trying to accomplish, and then we can help with that.