Jump to content

Script .doesn't really work


Recommended Posts

Hello, I have a script here that doesn't really work, who knows why?

As you can see, the monsters are not teleported into the room, the monsters are in a room that is completely different.

 

#include "zcommon.acs"

script 1 (void)
{
    int i;
    int roomTID; // TID des Raums

    // Sucht nach dem Raum mit dem Tag "20"
    roomTID = FindActor("20");

    // Wenn der Raum gefunden wurde
    if (roomTID != 0)
    {
        // Teleportiert 8 Monster mit dem Tag "4" in den Raum
        for (i = 0; i < 8; i++)
        {
            // Überprüft, ob ein Monster mit dem Tag "4" vorhanden ist
            if (ThingCountName("4") > 0)
            {
                // Holt die TID des nächsten Monsters mit dem Tag "4"
                int monsterTID = ActivatorTID();

                // Wenn ein Monster mit dem Tag gefunden wurde, teleportiert es in den Raum
                if (monsterTID != 0)
                {
                    Teleport(0, monsterTID, roomTID);
                }
            }
        }
    }

    // Öffnet 3 Türen mit den IDs 2, 3 und 4
    Door_Open(2, 16, 1);
    Door_Open(3, 16, 1);
    Door_Open(4, 16, 1);
}

 

 DAB

Share this post


Link to post

Yeah, well, it doesn't work because nothing in it actually makes sense D:

script 1 (void)
{
    int i;
    int roomTID;

    roomTID = FindActor("20"); //There's no ACS function called FindActor()

    if (roomTID != 0)
    {
        for (i = 0; i < 8; i++) //You're initializing a loop with int i but then you never use it
        {
            if (ThingCountName("4") > 0) //You're using ThingCountName wrong
            {
                int monsterTID = ActivatorTID();

                if (monsterTID != 0)
                {
                    Teleport(0, monsterTID, roomTID); //You're using Teleport wrong
                }
            }
        }
    }
    Door_Open(2, 16, 1);
    Door_Open(3, 16, 1);
    Door_Open(4, 16, 1);
}

https://zdoom.org/wiki/ThingCountName

https://zdoom.org/wiki/Teleport

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...