The Elder Scrolls Forums

TES Construction Set and Plugins >> General TES Construction Set

Pages: 1
slacker007
Acolyte

Reged: 06/05/04
Posts: 119
Loc: USA, MS
enimies are gone script
      #2898695 - 08/07/04 03:07 PM

Does anyone know how I could write a script that makes it impossible to open a door until you have killed all the enimies in the room?

--------------------
--------------------
Cogito ergo sum. -Descartes
(I think therefore I am)

Mediocrity:
It takes alot less time and most people don't notice until its too late
-2004 Dispair Calendar

DON'T CONFORM TO ANTI-CONFORMATISM, JUST BE YOURSELF!

Post Extras: Print Post   Remind Me!   Notify Moderator  
Archived User Account

Re: enimies are gone script [Re: slacker007]
      #2898827 - 08/07/04 03:37 PM

Lets say there are three enemies in the room, Id's "enemy1, enemy2 and enemy3"

On the door, put this (untested) script

Code:
Begin PB_Lock_in

if ( OnACtivate == 1 )
if ( PB_enemies_dead ) >= 3 ); this is a global variable, or a local variable on a local object, whichever you prefer
Activate
else
Playsound3d "lockeddoor"
Messagebox "The door is locked" "OK"
endif
endif

end



On each of the enemies, which should all have unique IDs

Code:

Begin PB_dead_enemy

short done

if ( done == 0 )
if ( GetHealth <= 0 )
Set PB_enemies_dead to ( PB_enemies_dead + 1 )
Srt done to 1
endif
endif

end



Post Extras: Print Post   Remind Me!   Notify Moderator  
slacker007
Acolyte

Reged: 06/05/04
Posts: 119
Loc: USA, MS
Re: enimies are gone script [Re: ]
      #2902888 - 08/08/04 02:40 PM

Thanks, Patrograd2. I knew someone would come through! Now, I'm creating the test cells right now, but I just wondered, do I have to do anything special to make PB_enemies_dead a variable or does the script that manipulates that variable create it on its own. Thanks.

--------------------
--------------------
Cogito ergo sum. -Descartes
(I think therefore I am)

Mediocrity:
It takes alot less time and most people don't notice until its too late
-2004 Dispair Calendar

DON'T CONFORM TO ANTI-CONFORMATISM, JUST BE YOURSELF!

Post Extras: Print Post   Remind Me!   Notify Moderator  
slacker007
Acolyte

Reged: 06/05/04
Posts: 119
Loc: USA, MS
Re: enimies are gone script [Re: slacker007]
      #2902905 - 08/08/04 02:45 PM

Also, I'm wanting to make this a chain of cells that once you start going through, you can't go back. It was said that I would need unique id's for each enemy I'm creating that this script pertains to. Does that mean that if I were to make this go through 100 cells(rooms) w/ 4 enimies in each I would have to come up with 400 unique id's, or could I make PB_enimies_dead a local variable and have basically every cell a duplicate of the last.

--------------------
--------------------
Cogito ergo sum. -Descartes
(I think therefore I am)

Mediocrity:
It takes alot less time and most people don't notice until its too late
-2004 Dispair Calendar

DON'T CONFORM TO ANTI-CONFORMATISM, JUST BE YOURSELF!

Post Extras: Print Post   Remind Me!   Notify Moderator  
Archived User Account

Re: enimies are gone script [Re: slacker007]
      #2903229 - 08/08/04 04:10 PM

To make a global variable go to gameplay->globals, and then select new.


Post Extras: Print Post   Remind Me!   Notify Moderator  
slacker007
Acolyte

Reged: 06/05/04
Posts: 119
Loc: USA, MS
Re: enimies are gone script [Re: ]
      #2903407 - 08/08/04 04:57 PM

Ok, I've got the variable working, but I'm having trouble with the PB_Dead_Enemy script. On line 6 you have "Srt to 1" but the cs won't accept that. I'm pretty sure that you meant short, and corrected it, but now that i've tested it, I'm not sure if that's what is should have been.

--------------------
--------------------
Cogito ergo sum. -Descartes
(I think therefore I am)

Mediocrity:
It takes alot less time and most people don't notice until its too late
-2004 Dispair Calendar

DON'T CONFORM TO ANTI-CONFORMATISM, JUST BE YOURSELF!

Post Extras: Print Post   Remind Me!   Notify Moderator  
Archived User Account

Re: enimies are gone script [Re: slacker007]
      #2903478 - 08/08/04 05:16 PM

It should be

Set done to 1

Me and my dodgy typing

Post Extras: Print Post   Remind Me!   Notify Moderator  
slacker007
Acolyte

Reged: 06/05/04
Posts: 119
Loc: USA, MS
Re: enimies are gone script [Re: ]
      #2903538 - 08/08/04 05:31 PM

There must be a loop or something because I have it set to If () PB_enimies_dead ) >= 4) in the script for the door and I go in and kill 2 and the door opens for me. Don't lines 5 and 6 of PB_dead_enemy do the same thing. If so, every enemy I kill would add 2 to the variable value instead of one.

--------------------
--------------------
Cogito ergo sum. -Descartes
(I think therefore I am)

Mediocrity:
It takes alot less time and most people don't notice until its too late
-2004 Dispair Calendar

DON'T CONFORM TO ANTI-CONFORMATISM, JUST BE YOURSELF!

Post Extras: Print Post   Remind Me!   Notify Moderator  
slacker007
Acolyte

Reged: 06/05/04
Posts: 119
Loc: USA, MS
Re: enimies are gone script [Re: slacker007]
      #2904467 - 08/08/04 08:46 PM

Come on. A little help here for a scripting noob?

--------------------
--------------------
Cogito ergo sum. -Descartes
(I think therefore I am)

Mediocrity:
It takes alot less time and most people don't notice until its too late
-2004 Dispair Calendar

DON'T CONFORM TO ANTI-CONFORMATISM, JUST BE YOURSELF!

Post Extras: Print Post   Remind Me!   Notify Moderator  
Archived User Account

Re: enimies are gone script [Re: slacker007]
      #2905988 - 08/09/04 02:50 AM

Line 5 adds 1 to the global variable PB_enemies_dead
Line 6 makes sure that this only happens once

I dont know why this is looping (its what line 6 is for), but perhaps one of the other guys can help

Post Extras: Print Post   Remind Me!   Notify Moderator  
Klinn
Diviner

Reged: 11/19/02
Posts: 2319
Re: enimies are gone script [Re: ]
      #2907137 - 08/09/04 11:43 AM

May I suggest a slightly different approach, which removes the need for the global and updating of it?

Create your own unique-ID version of a creature and put 3 copies of it in the room. The script on the door uses the 'GetDeadCount' function to see if all three have been killed, e.g.:

Begin DoorOutScript

If ( OnActivate == 1 )
. . If ( GetDeadCount "Your_Creature_ID" >= 3 )
. . . . Activate
. . EndIf
EndIf

End

If you want more than one type of creature in the room, you could either create two types and expand the script logic slightly to check the GetDeadCount for each, or make a levelled-list-creature to spawn randomly-selected ones within the list.

Hope this helps,

...Klinn


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1


Extra information
0 registered and 1 anonymous users are browsing this forum.

Moderator:  Umrahel, Freddo, Pete, Hungry Donner, Attrebus, Miltiades, tegger 

Print Thread

Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Thread views: 69

Rate this thread
 
Jump to

The Elder Scrolls Homepage

*
UBB.threads™ 6.3

Click for Privacy Statement 2003 Bethesda Softworks LLC, a ZeniMax Media company. All Rights Reserved.
PRIVACY POLICY | TERMS & CONDITIONS | LEGAL INFORMATION | CONTACT US