Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
NokturnuS

Small Script

Recommended Posts

Hi

Need some help. Are there any examples showing how mapthing TIDs interact with Small scripts (like lower a floor when some demons are killed, spawn a monster/powerup when other is killed, etc.) ?
Try to search but found none.

Thanks for your time.

Cya!

Share this post


Link to post

Hey man, long time no see.

I think the trick would be to use EDF to call a Small function with one of the death frames. Just make a custom monster if you have to, it's no big deal.

Or is there an easier way James?

Share this post


Link to post

Hi Joel, long time indeed...

Making via EDF is easy, using LineEffect or even Startscript codepointers. Problem is, the action affects all the monsters of the same type and the sector action is activated when any of them die. I think this is the point to have TIDs so you can assign the action to only a specific demon. I may have 20 Hell Knights on the level but only killing 2 of them, spawning via ExtraData, some sector action is activated. I think this can be achieved via Small scripts.

Thank you!

Share this post


Link to post

Right now, the only way to start an action after a particular set of monsters died would be to have all such monsters use a StartScript in their death frames like Joel suggested.

The trick is to create a global variable in your script that counts the number of deaths, but only if the trigger object's TRUE tid (not _TID_TRIGGER) is a certain value. It could look something like this:

enum
{
   DEMON_TID_1 = 999,
   DEMON_TID_2,
   DEMON_TID_3,
   NUM_DEMONS = 3
}

new NumDemonsDead = 0;

public OnDemonDeath()
{
   new tid = _GetThingSrc();

   // NOTE: switch statements do not
   // fall through cases in Small!
   switch(tid)
   {
   case DEMON_TID_1:
      ++NumDemonsDead;
   case DEMON_TID_2:
      ++NumDemonsDead;
   case DEMON_TID_3:
      ++NumDemonsDead;
   }

   if(NumDemonsDead == NUM_DEMONS)
      // Do anything here
}
I suggest using some special TID value like I have here if you intend to put this into the GlobalScript and use it on multiple maps. Otherwise, the behavior will be bound to an individual map's data, which may not be what you want.

(BTW, by having monsters call LevelScripts, you can certainly have differing monster behavior per map, but you must be sure to define all the scripts for all your maps)

Share this post


Link to post

Cool, gonna try this. With EDF i have no problem creating a monster looking exactly like a existing one but with startscript frames. Only worried by the infight issue, but i'll see.

Thanks very much!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×