(SOLVED)Powerup that spawns something as it lasts?

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

(SOLVED)Powerup that spawns something as it lasts?

#1

Post by FranckyFox2468 » Sat Nov 12, 2016 11:38 pm

I'm wondering if it's possible to make a powerup that spawns something (like a spam of projectiles or an explosion) every X tics while it lasts?
Last edited by FranckyFox2468 on Mon Nov 14, 2016 6:44 pm, edited 2 times in total.

User avatar
Ænima
Addicted to Zandronum
Posts: 3579
Joined: Tue Jun 05, 2012 6:12 pm

Re: (DECORATE)Powerup that spawns something as it lasts?

#2

Post by Ænima » Sat Nov 12, 2016 11:51 pm

Use an ACS script.
Reinforcements: midgame Survival joining/respawning
Doom64: Unabsolved: Doom64 + Diablo II
ZandroSkins: a pack made by our community
AeniPuffs: 3D blood and bullet puff effects, free to use for your own mods
Squad Radio: a WASD-based radio chat menu, add your own custom sounds!
Mercenaries (on hold)
Image

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

Re: (DECORATE)Powerup that spawns something as it lasts?

#3

Post by FranckyFox2468 » Sun Nov 13, 2016 1:05 am

An exemple would be nice if possible. That is a well done one, unless its as basic as an inventory check so it spawns something. But wouldn't even know how to do so at a player's position.

User avatar
ZZYZX
Posts a lot
Posts: 742
Joined: Thu Jun 07, 2012 5:56 pm
Location: Ukraine
Clan: A3
Clan Tag: [A3]

Re: (DECORATE)Powerup that spawns something as it lasts?

#4

Post by ZZYZX » Sun Nov 13, 2016 1:09 am

Subclass this in decorate http://zdoom.org/wiki/Classes:CustomInventory
Then make an ACS library http://zdoom.org/wiki/Libraries
In the ACS library, create a script like this one (this script starts and executes some code every second for 10 seconds):

Code: Select all

script 666 (void)
{
  for (int i = 0; i < 10; i++)
  {
    // spawn something here.
    Delay(35);
  }
}
Then put an ACS_ExecuteWithResult(666) in your CustomInventory thing in Pickup: state (if the powerup is used instantly) or Use: state (if it's stored in the inventory).

Player position can be received with GetActor# family of functions.
Spawning is done by the Spawn family (see the bottom of this page for other spawn-related functions).
Last edited by ZZYZX on Sun Nov 13, 2016 1:52 am, edited 1 time in total.

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

Re: (DECORATE)Powerup that spawns something as it lasts?

#5

Post by FranckyFox2468 » Sun Nov 13, 2016 1:39 am

Neat, ill try it out whenever i can!

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

Re: (DECORATE)Powerup that spawns something as it lasts?

#6

Post by FranckyFox2468 » Sun Nov 13, 2016 5:03 pm

Uh, i would like to ask another question, if the spawn is done via a script and not via a decorate or an actor itself, wouldn't it result the projectile to hurt the user of the projectile as well and its allies?

EDIT: I tried a work around in the meantime of an inventory item that loops its effect for as long as the powerup is detected on the player but i seem to be running out of luck... Only does it once you pick up the item then it stops

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

Re: (DECORATE)Powerup that spawns something as it lasts?

#7

Post by FranckyFox2468 » Sun Nov 13, 2016 7:20 pm

ZZYZX wrote:Subclass this in decorate http://zdoom.org/wiki/Classes:CustomInventory
Then make an ACS library http://zdoom.org/wiki/Libraries
In the ACS library, create a script like this one (this script starts and executes some code every second for 10 seconds):

Code: Select all

script 666 (void)
{
  for (int i = 0; i < 10; i++)
  {
    // spawn something here.
    Delay(35);
  }
}
Then put an ACS_ExecuteWithResult(666) in your CustomInventory thing in Pickup: state (if the powerup is used instantly) or Use: state (if it's stored in the inventory).

Player position can be received with GetActor# family of functions.
Spawning is done by the Spawn family (see the bottom of this page for other spawn-related functions).
Don't know if i'm doing this right but nothing seems to be spawning:

Code: Select all

script 600 (void)
{
  for (int i = 0; i < 30; i++)
  {
    str class = "StarmanAOE";
       do {
     delay(1);
     int x = GetActorX(0);
     int y = GetActorY(0);
     int z = GetActorZ(0);
	 int angle = GetActorAngle(0);
 
   } until (Spawn(class, x, y, z, 0, angle));
    Delay(1);
  }
}
I'm pretty awful when it comes to ACS ^^'

EDIT: Figured its because i forgot to put #include "zcommon.acs", tho what is weird is that instead of counting seconds it counts ticks, like it only lasts 10-30 tics. And it also hurts allied players as i feared.

EDIT2: I figured a work around using ZZYZX's script (Will remember to give him a special thanks if this project gets finished), instead of spawning something every X tics, it gives an item to the player that spawns something every X tics. So it doesn't affect the player and nor allied players :D. Thanks for the help guys!

Post Reply