The "How do I..." Thread

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
DoomKrakken
Posts: 3489
Joined: Sun Oct 19, 2014 6:45 pm
Location: Plahnit Urff
Contact:

Re: The "How do I..." Thread

Post by DoomKrakken »

Apeirogon wrote:Look like cuboid.
Screenshot_Doom_20171005_220239.jpg
But generic 3d graph creator say that must be a sphere.
wild sphere.png
Flattened because I dont setup z scale.
What if you applied this stuff to the velocity parameters?

Code: Select all

TNT1 A 0 A_SpawnItemEx("cover_cloud", 0, 0, 0, random(14, 22) * sin(random(0, 180)) * cos(frandom(0,359.99)), random(14,22) * sin(random(0,180)) * sin(frandom(0, 359.99)), random(14, 22) * cos(random(0, 180)), 0, SXF_NOCHECKPOSITION) 
It won't start off expanded, but it'd probably expand into a sphere, right? It'd also make for a more realistic explosion...
User avatar
kodi
 
 
Posts: 1361
Joined: Mon May 06, 2013 8:02 am

Re: The "How do I..." Thread

Post by kodi »

Either of you might be interested in this particle implosion effect for education purposes of nothing else:

Code: Select all

for(int i=0;i<=100;i++)
				{
				double prtc_ang = frandom(0.0,360.0);
				double prtc_pit = frandom(-90.0,90.0);
				double prtc_dist = frandom (64.0,128.0);
				double prtc_speed = -8.0;
				double cosang = cos(prtc_ang);
				double sinang = sin(prtc_ang);
				
				double cospit = cos(prtc_pit);
				double sinpit = sin(prtc_pit);
				int prtc_tics = prtc_dist/abs(prtc_speed);
				string prtcolor;
				switch(random(1, 3))
				{
				case 1:
				prtcolor = "77 99 FF";
				break;

				case 2:
				prtcolor = "FF FF FF";
				break;

				case 3:
				prtcolor = "22 22 FF";
				break;
				}
				
				a_spawnparticle(prtcolor,
								SPF_FULLBRIGHT,
								prtc_tics,
								5.0,
								0,
								cospit*(cosang*prtc_dist),
								cospit*(sinang*prtc_dist),
								sinpit*prtc_dist,
								cospit*(cosang*prtc_speed),
								cospit*(sinang*prtc_speed),
								sinpit*prtc_speed);
				}
			}
It spawns a cloud of particles that converge on the same spot and disappear at the same time.
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: The "How do I..." Thread

Post by Apeirogon »

DoomKrakken wrote:
Apeirogon wrote:Look like cuboid.
The attachment Screenshot_Doom_20171005_220239.jpg is no longer available
But generic 3d graph creator say that must be a sphere.
The attachment wild sphere.png is no longer available
Flattened because I dont setup z scale.
What if you applied this stuff to the velocity parameters?

Code: Select all

TNT1 A 0 A_SpawnItemEx("cover_cloud", 0, 0, 0, random(14, 22) * sin(random(0, 180)) * cos(frandom(0,359.99)), random(14,22) * sin(random(0,180)) * sin(frandom(0, 359.99)), random(14, 22) * cos(random(0, 180)), 0, SXF_NOCHECKPOSITION) 
It won't start off expanded, but it'd probably expand into a sphere, right? It'd also make for a more realistic explosion...
Aaaaaand...no, just like i think.
Screenshot_Doom_20171006_123607.jpg
But i managed to do this
Screenshot_Doom_20171006_124902.jpg
with

Code: Select all

tnt1 a 1 A_CustomMissile("transfer", 32, 0, frandom(0, 359.99), CMF_AIMDIRECTION, frandom(-90, 90))

actor transfer
{speed 1
states{
spawn;
tnt1 a 0 nodelay a_setspeed(random(14. 22))
tnt1 a 1
death:
tnt1 a 0 a_spawnitemex("cover_cloud")
And even now this still dont perfectly spherical.

Why live if gzdoom can not spawn object in spherical layer? Life is pain...
Also, it bag or feature, that gzdoom cant correct multiply sine and cosine?!
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: The "How do I..." Thread

Post by Apeirogon »

kodi wrote:Either of you might be interested in this particle implosion effect for education purposes of nothing else:

Code: Select all

for(int i=0;i<=100;i++)
				{
				double prtc_ang = frandom(0.0,360.0);
				double prtc_pit = frandom(-90.0,90.0);
				double prtc_dist = frandom (64.0,128.0);
				double prtc_speed = -8.0;
				double cosang = cos(prtc_ang);
				double sinang = sin(prtc_ang);
				
				double cospit = cos(prtc_pit);
				double sinpit = sin(prtc_pit);
				int prtc_tics = prtc_dist/abs(prtc_speed);
				string prtcolor;
				switch(random(1, 3))
				{
				case 1:
				prtcolor = "77 99 FF";
				break;

				case 2:
				prtcolor = "FF FF FF";
				break;

				case 3:
				prtcolor = "22 22 FF";
				break;
				}
				
				a_spawnparticle(prtcolor,
								SPF_FULLBRIGHT,
								prtc_tics,
								5.0,
								0,
								cospit*(cosang*prtc_dist),
								cospit*(sinang*prtc_dist),
								sinpit*prtc_dist,
								cospit*(cosang*prtc_speed),
								cospit*(sinang*prtc_speed),
								sinpit*prtc_speed);
				}
			}
It spawns a cloud of particles that converge on the same spot and disappear at the same time.
This acs or decorate? I ask because a_spawnparticle function and switch/case block.
User avatar
kodi
 
 
Posts: 1361
Joined: Mon May 06, 2013 8:02 am

Re: The "How do I..." Thread

Post by kodi »

Zscript. Like this:

TNT1 A 0
{
(that code block)
}

Might work in decorate as well; I'm not sure.
User avatar
DoomKrakken
Posts: 3489
Joined: Sun Oct 19, 2014 6:45 pm
Location: Plahnit Urff
Contact:

Re: The "How do I..." Thread

Post by DoomKrakken »

@Apeirogon Dude, that's a lot closer! :D

Why does the cloud need to be perfectly spherical, though? I know of no explosions (except those in outer space) that are perfectly spherical.
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: The "How do I..." Thread

Post by Apeirogon »

DoomKrakken wrote:@Apeirogon Dude, that's a lot closer! :D

Why does the cloud need to be perfectly spherical, though? I know of no explosions (except those in outer space) that are perfectly spherical.
You will see it at cacodemon replacer when, really when?, i finish my monster mod. I dont want to shown half of work.
User avatar
Ryuhi
Posts: 374
Joined: Tue Feb 21, 2017 11:00 pm

Re: The "How do I..." Thread

Post by Ryuhi »

I'm currently making an item that "cheats death" by sending a player to the beginning of the map rather than kill them, similar to how BJ's unique works in Samsara. so far so good, but my main problem is that any damage that puts a player into negative will cause it to fail. My main ideas for a solution are to make damage essentially change by tic rather than all at once (think Earthbound damage,) or to find a way to force it to activate before the player dies. Does anyone know how I would go about doing either?

here's the script as I have it so far:

Code: Select all

Script "Revival" ENTER
{
  If (CheckInventory("BrutalArtiSuperHealth") && GetActorProperty(0,APROP_HEALTH) < 5) //Activates at 5 or less health
  {
    GiveInventory("Telemini", 1);  //teleports player to start
    GiveInventory("Health", 999);
    TakeInventory("BrutalArtiSuperHealth", 1);  //item used to give effect
    Delay(1);
    restart;
  }
  Else
  {
    Delay(1);
    restart;
  }
}
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

Re: The "How do I..." Thread

Post by Blue Shadow »

I don't know if this would work for you or not. But make it so that as long as that item in the inventory, [wiki=SetPlayerProperty]the player would be in buddha mode[/wiki]. In that mode, the player's health cannot go below 1 hit point, meaning they cannot be killed.
User avatar
Ryuhi
Posts: 374
Joined: Tue Feb 21, 2017 11:00 pm

Re: The "How do I..." Thread

Post by Ryuhi »

thats actually a good idea. I can probably adapt that to work, I'll give it a try.

worked like a charm:

Code: Select all

Script "GodlikeCheck" ENTER
{
  If (CheckInventory("BrutalArtiSuperHealth"))
  {
	SetPlayerProperty(0,1,PROP_BUDDHA);
	Delay(35);
	Restart;
  }
  If (!CheckInventory("BrutalArtiSuperHealth"))
  {
	SetPlayerProperty(0,0,PROP_BUDDHA);
	Delay(35);
	Restart;
  }
}
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: The "How do I..." Thread

Post by Apeirogon »

User avatar
KeksDose
 
 
Posts: 596
Joined: Thu Jul 05, 2007 6:13 pm
Location: my laboratory
Contact:

Re: The "How do I..." Thread

Post by KeksDose »

@Apeirogon:
Your sphere coordinates idea is correct, but you're calling random 5 times and of course, each time it probably has another result. So all that happens is you accidentally mismatch your sin and cos inputs, resulting in the cuboid.

You can store the angle and inclination in variables and use those:

Code: Select all

float ang    = Frandom(0, 360);
float vang   = Frandom(0, 360);
float radius = Frandom(14, 22);

A_SpawnItemEx(
    "CoverCloud", 0, 0, 0,
    cos(ang) * cos(vang) * radius,
    sin(ang) * cos(vang) * radius,
    sin(vang) * radius, 0, SXF_NOCHECKPOSITION); 
edit: moved to velocities instead of pos as was the intention
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: The "How do I..." Thread

Post by Apeirogon »

float ang = Frandom(0, 360);
must be
float ang = Frandom(0, 180);
just because

Anyway, Houston, we have a problem.

Here screen when i left all argument in velociti
2.jpg
and here when insert all into positions.
1.jpg
Yes, i try conjure with radius variable, but what with frandom(0, 0.1) waht with frandom(100000, 5000000), i dont see any difference.

Updated my journal: go away, there's nothing to look at I found error by myself
Last edited by Apeirogon on Sun Oct 08, 2017 12:44 pm, edited 1 time in total.
User avatar
BigProjectAlone
Posts: 780
Joined: Wed Mar 21, 2012 5:38 am
Location: canada

Re: The "How do I..." Thread

Post by BigProjectAlone »

I know there is a way to do it but i cannot find how.. is someone can tell me how to change that menu selector please ?

Image
User avatar
kodi
 
 
Posts: 1361
Joined: Mon May 06, 2013 8:02 am

Re: The "How do I..." Thread

Post by kodi »

@bigprojectalone
It's in the CONFONT iirc
Locked

Return to “Editing (Archive)”