Several ACS questions

Discuss all aspects of editing for ZDoom.
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Several ACS questions

Postby Amuscaria » Mon Dec 04, 2006 2:04 pm

Just a few things I need to clear up. An example solution to some of these would also be appreciated.

ACS:

1) When I ACS_Terminate (or whatever the command is) a script, does it remove the script the the map, stop it and reset it, or pause it where it's at at the time the termination is called?

2) Is it possible to make a monster follow another actor. However, these monsters only move when it's target moves, and stops when the target stops. Also, the will remain a certain distance from the target. Is that doable?

3) Is it possible to run multiple loops within several maps at the same time by activating a script from a map? I was wondering hwo to change the sky textures from time to time through out ALL the maps in a hub when entering the main map. Something like this?

Spoiler:


thanks for the help. :D
User avatar
Amuscaria
The Sentient Mushroom
 
Joined: 26 Jul 2004
Location: Growing from mycelium near you.

Re: Several ACS questions

Postby HotWax » Mon Dec 04, 2006 2:18 pm

Eriance wrote:1) When I ACS_Terminate (or whatever the command is) a script, does it remove the script the the map, stop it and reset it, or pause it where it's at at the time the termination is called?


Using ACS_Terminate is exactly the same thing as using terminate within that script, except that it can be called on scripts that are currently "running" (see below) on other maps in the same hub. The target script, if it's in the same map, is immediately halted. A subsequent call to the same script will start it over from the beginning.

2) Is it possible to make a monster follow another actor. However, these monsters only move when it's target moves, and stops when the target stops. Also, the will remain a certain distance from the target. Is that doable?


Yes. Just used GetActorX/Y/Z to get the location of the target actor and spawn a mapspot a specified distance away, then have your follower use that mapspot as a goal. You can also run it in a loop and compare the X/Y/Z values from subsequent iterations to see whether the actor is moving and if so how far and fast he is moving. I'll try to provide an example of this later, after I get home from work.

3) Is it possible to run multiple loops within several maps at the same time by activating a script from a map? I was wondering hwo to change the sky textures from time to time through out ALL the maps in a hub when entering the main map.


No it's not. When a script is run on another map in a hub, the script doesn't actually start processing until the player reaches that map. The script is flagged to run, but is in a paused state until the map is entered. If the map is left while a script is running, it is paused at that point and resumed when the player re-enters the map. If ACS_Terminate is called on the paused script, it will be terminated as soon as the player re-enters the map. Calling ACS_Terminate on a script in another map in the hub, then executing it again should flag it to restart as soon as the player enters the map.
User avatar
HotWax
Do what you must, and pay the price later.
 
Joined: 19 Jul 2003
Location: Idaho Falls, ID

Postby Isle » Mon Dec 04, 2006 3:37 pm

if you want the skys in a hub to cycle you can use timer()

Code: Select allExpand view
script 1 ENTER
{
   int time;
   while(1)
   {
      time = ((timer() / 35) % 60);
      if(time >= 30) changesky ("sky1", "sky1");
      else changesky ("sky2", "sky2");
      delay(1);
   }
}

put this in each map and it will change it every 30 seconds
User avatar
Isle
WadAuthor 4 L1F3
 
Joined: 21 Nov 2003
Location: Arizona, USA

Postby Amuscaria » Mon Dec 04, 2006 4:44 pm

Alrighty, then. Thanks for the help. :D
User avatar
Amuscaria
The Sentient Mushroom
 
Joined: 26 Jul 2004
Location: Growing from mycelium near you.

Re: Several ACS questions

Postby Risen » Tue Dec 05, 2006 11:18 am

Eriance wrote:3) Is it possible to run multiple loops within several maps at the same time by activating a script from a map? I was wondering hwo to change the sky textures from time to time through out ALL the maps in a hub when entering the main map.


What HotWax says is correct, but this effect can still be accomplished. I believe this thread has details.
User avatar
Risen
 
Joined: 08 Jan 2004
Location: N44°30' W073°05'


Return to Editing (Archive)

Who is online

Users browsing this forum: No registered users and 1 guest