Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
ExIm

[ACS] How to assign new thing ID to rockets

Recommended Posts

Well, it seems my problem hasn't been solved completely yet so I come here again for advice.

Now I know that there is ThingCountSector to count number of my rockets in specific sector. My objective is to assign an ID to every rocket that has been launched (or spawned) and each one is unique. For example, when I fired the first rocket, it is assigned an ID of 1. And then if I fired another rocket, its tid will be 2, 3, 4... and so on.

I tried using while(true) loop to check at anytime new rocket will be launched. If that occur, I taught I can use Thing_ChangeID to assign the id to it. However, when I used ThingCountSector to count the rocket with new tid, it showed 0 (that's mean it fail to assign the id). I even tried to change ID of myself (Player class) before executing this script but it still failed.

FYI, I use ZDoom In UDMF format.

Share this post


Link to post

If you really want every rocket to get a unique TID, you'll need to make a rocket replacement which will call ACS_ExecuteAlways right after its spawn state to run a script which calls Thing_ChangeID. You'll also need a global variable which is used as the new TID and increased by one each time the script is run.

Share this post


Link to post

What do you mean rocket replacement? Is it other thing like spawned dummy rocket? And how to make it to call the script by itself (I think if I place ACS_Execute line normally the activator should be the player right?)

Right now, I have global variable that increase by one once a rocket is launched as you said. But I also want to know info of every rocket about its coordinate and movement (like speed, angle) so it will be useless if I can't assign id to the original one :(

Share this post


Link to post

I mean in DECORATE.

Actor TidRocket : Rocket replaces Rocket
{
    States
    {
    Spawn
        TNT1 A 0
        TNT1 A 0 ACS_ExecuteAlways(666)
        Goto Super::Spawn
    }
}
Then in ACS:
script 666 (void)
{
    Thing_ChandeID(rocketid++);
}

Share this post


Link to post

Oh, I see. I'm not familiar with DECORATE so I don't know. Actually, I still working on my first map and don't even know how to edit things other than creating a map and write ACS script in Doom Builder 2 -_-"

Just download SLADE 3. Got to learn this.

Share this post


Link to post

Now, I've finally manage to include your code into my wad and it works really fine. Thanks, Gez! Here is the result I made.

http://www.youtube.com/watch?v=t7-T0Hi1T-w

Anyway, I've a bit problem with SLADE. After I included DECORATE into my wad, I can't open it again in Doom Builder (there is no map to select) unless I delete DECORATE in my wad using SLADE. Is this normal or is there a way to open it in Doom Builder without deleting DECORATE?

Share this post


Link to post

Make sure that the DECORATE lump in question is not between any map lump. It should be before the map label (e.g., "MAP01") or after the SCRIPTS lump; not anywhere in between.

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×