[ACS] ActivatorExists()

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: [ACS] ActivatorExists()

Re: [ACS] ActivatorExists()

by randi » Sun Dec 07, 2008 6:24 pm

I realized I made a slight mistake in the changelog description. ACTOR_NONE is not a bitfield, but a lack of any bits set. So you would test for that with ==, but the others are tested with &.

Re: [ACS] ActivatorExists()

by randi » Sat Dec 06, 2008 10:02 pm

I did something like that. The result is ClassifyActor, which returns a bitfield describing the actor. It takes a TID, so use 0 to query about the activator. I've got these all listed in the changelog entry.

Re: [ACS] ActivatorExists()

by HotWax » Sat Dec 06, 2008 12:15 am

How about ActivatorType? This could return an int that evaluates to either ISACTOR or ISWORLD.

You could even extend it (if desired) and have it return stuff like ISPLAYER, ISMONSTER, ISBOT, etc.

Code: Select all

script 1 ENTER {
     // Do awesome stuff

     if (ActivatorType() == ISWORLD) terminate;

     restart;
}

Re: [ACS] ActivatorExists()

by bagheadspidey » Fri Dec 05, 2008 7:24 pm

OriginalActivatorExists? ActivatorInPlay? =/

Is the world "useful" for anything as an activator? If not, I think the original suggestion is fine...


edit - or maybe ActivatorChanged... could return the opposite of whatever ActivatorExists / IsActivatorWorld would return.

Re: [ACS] ActivatorExists()

by randi » Fri Dec 05, 2008 7:14 pm

Scripts that become orphaned are automatically assigned the world as their activator, just like an open script. So technically, ActivatorExists() would always return true, since every script has some sort of actor. I know what you're asking for, and it's quite simple to do, but is there a better name for it? IsActivatorWorld() would accurately describe it, but how easy will it be for people to grasp that that can tell them if their actor-activated script no longer has its actor around?

Re: [ACS] ActivatorExists()

by Macil » Fri Dec 05, 2008 4:09 pm

jimmy91 wrote:What about

Code: Select all

ThingCount(T_NONE,ActivatorTid())
?
If there are multiple things with the same tid, or its tidless, then that won't work.

Re: [ACS] ActivatorExists()

by Jimmy » Fri Dec 05, 2008 3:10 pm

What about

Code: Select all

ThingCount(T_NONE,ActivatorTid())
?

EDIT: Sorry if this isn't helpful - just read over your post a second time to make sure I know what I'm talking about, and it looks like you want to avoid using this function, but I do believe that it might help a pinch.

[ACS] ActivatorExists()

by Kate » Fri Dec 05, 2008 1:53 pm

Nice and simple. It would make my nightmare less of a nightmare. Simply put, when called, returns TRUE when the activator of the script still exists or FALSE if it has disappeared off of the map (items that have been picked up, things forcefully removed from ACS scripts or as part of their state cycle, etc.). ThingCount can't directly reference the activator so it can't reliably be used with scripts that are called directly by actors from DECORATE that don't have Thing IDs. It also can't tell the difference between a dead enemy and an object that has actually disappeared off of the map.

This is pretty much what I'm trying to do (this is called by an object on the map when it's first spawned after the level starts, which has no TID but can sometimes have one in certain cases):

Code: Select all

int FreeTID = 6000;

Script 962 (ThingType)
{
    int SpawnTID = FreeTID;
    FreeTID++;
    If (CheckInventory(SpecialThings[ThingType])) Terminate;
    Spawn("AGiantFingerPointingDown", GetActorX(0), GetActorY(0), GetActorZ(0), SpawnTID, 0);
    While (ActivatorExists()) Delay(8);
    Thing_Remove(SpawnTID);
}

Top