[ACS] Another way for A_RadiusGive but on ACS?

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
Kernodon
New User
Posts: 4
Joined: Mon Dec 25, 2017 12:22 am

[ACS] Another way for A_RadiusGive but on ACS?

#1

Post by Kernodon » Sat Jan 20, 2018 6:04 pm

Boop, is there a way to give everything an inventory via ACS?
By everything I mean PROJECTILES - MONSTERS - PLAYERS and possibly some other stuff I'm missing.
Like, I either dont know if A_RadiusGive(stuff,stuff,RGF_MISSILES,1) actually works (because slade keeps throwing an error) or I don't know how to use it.

User avatar
Empyre
Zandrone
Posts: 1316
Joined: Sun Jul 08, 2012 6:41 am
Location: Garland, TX, USA

[ACS] Re: Another way for A_RadiusGive but on ACS?

#2

Post by Empyre » Sun Jan 21, 2018 12:56 am

What is the code that is causing an error, and what is the error?
"For the world is hollow, and I have touched the sky."

User avatar
Kernodon
New User
Posts: 4
Joined: Mon Dec 25, 2017 12:22 am

[ACS] Re: Another way for A_RadiusGive but on ACS?

#3

Post by Kernodon » Sun Jan 21, 2018 1:27 am

"unknown identifier RGF_MISSILES" from the A_Radius give, thats why I'm looking for another workaround

User avatar
jdagenet
Forum Regular
Posts: 191
Joined: Tue Jun 05, 2012 8:08 am
Clan: Cube
Clan Tag: A3
Contact:

[ACS] Re: Another way for A_RadiusGive but on ACS?

#4

Post by jdagenet » Sun Jan 21, 2018 7:34 am

I think a more interesting question is why are you trying to give every single actor an inventory item. Question needs context.
Upfront though, I don't think it's possibly to do that. For one, that DECORATE function doesn't have all the flags that are in the current build of GZDoom so most likely whatever flag you're trying to apply just isn't supported in Zandronum. Another thing is even if you recreate the function in ACS there still isn't a way to interact and directly control actors that are within whatever radius you have. You can do it with players because you know players have their own id's you can refer to and keep track of, etc, but when it comes to items or projectiles on the other hand... Yeah not so much.
<Dynamo_>uh
<Dynamo_>did you just take the thread away
<FusedQyou>Dunno
<FusedQyou>ask the thread

Catastrophe
Retired Staff / Community Team Member
Posts: 2558
Joined: Sat Jun 02, 2012 2:44 am

[ACS] Re: Another way for A_RadiusGive but on ACS?

#5

Post by Catastrophe » Sun Jan 21, 2018 8:07 am

Is a_radiusgive even in Zandronum? If so then just create an actor in decorate that exists for 1 tic which calls a_radiusgive and then spawn it using ACS.

User avatar
Kernodon
New User
Posts: 4
Joined: Mon Dec 25, 2017 12:22 am

[ACS] Re: Another way for A_RadiusGive but on ACS?

#6

Post by Kernodon » Sun Jan 21, 2018 4:26 pm

Okok, heres a bit more context (I think)
Since RGF_MISSILES (for A_Radiusgive) is nonexistant at the moment, I wanted to give everything an item (custominventory) that checks it's flags
if it had whatever the "PROJECTILE" combo flag gives in it, it would succesfully do whatever thing it's supposed to do if it had the flags

Code: Select all

actor IsProjectilePickup : Custominventory
{
Pickup:
TNT1 A 0
TNT1 A 0 A_CheckFlag("MISSILE","NextCheck-NoGravity") //Or A_CheckFlag("PROJECTILE","stuffstuff") if it even works
stop
NextCheck-NoGravity:
TNT1 A 0 A_CheckFlag("NOGRAVITY","MoreStuff")
stop
}
Said pickup would be given to everything (because again, RGF_MISSILES is nonexistant), players - monsters - pickups laying around, but since I THINK none of the 3 use the projectile combo it just wouldn't do anything unless it was a projectile

User avatar
Empyre
Zandrone
Posts: 1316
Joined: Sun Jul 08, 2012 6:41 am
Location: Garland, TX, USA

[ACS] Re: Another way for A_RadiusGive but on ACS?

#7

Post by Empyre » Sun Jan 21, 2018 5:46 pm

A possible workaround might be to make a custom version of every projectile, and have them do the stuff you want. Whether that would work depends largely on what stuff you are trying to do.

A_RadiusGive is indeed in Zandronum. It was added in 3.0. I use it for the healing function in my OPWeapons, so players can heal themselves and other players nearby.
"For the world is hollow, and I have touched the sky."

User avatar
Kernodon
New User
Posts: 4
Joined: Mon Dec 25, 2017 12:22 am

[ACS] Re: Another way for A_RadiusGive but on ACS?

#8

Post by Kernodon » Sun Jan 21, 2018 11:01 pm

Hmmm... Seem to have found a workaround that actually works, sadly, it depends on A_SpawnItemEx because A_FireCustomMissile can't pass tids.

Code: Select all

//This is the thing that is going to be given the Item, called from a weapon.
A_SpawnItemEx("MAGICMISSILE",0,8,32,cos(pitch)*30,0,sin(-pitch)*30,0,1,0,tid+1000) 

=========
//This is the actor that calls the RadiusGiveLikeScript
actor TestingRadiusGive {
PROJECTILE
var int user_CustomID;
States
{
Spawn:
TNT1 A 0
TNT1 A 1
TNT1 A 0 A_SetUserVar("user_CustomID",1000) //Which things to give the projectile to
TNT1 A 0 ACS_NamedExecuteAlways("WIZ_TEAMGIVER",0,256,1,1)
loop
}
}

Code: Select all


str WizardyItems[6]={
"Item1", //0
"Item2", //1
"Stuff" //2
};

script "WIZ_TEAMGIVER" (int range, int WhichItem, int Amount)
{
	int Target_TID;
	int Owner = ActivatorTID();
	int user_ID = GetUserVariable(Owner,"user_CustomID");
	int OwnerNumber = PlayerNumber();
	
	if ( ActivatorTID() == 0 ) {SetActivatorToTarget(0);} //If its called from a projectile, set the activator to the player that fired it.
	
	for(int i=0; i<32; i++) {
	
		if (owner != 1000 + i) {
		
			if(distanceVal(x,y, 1000+i) < range) {
				Target_TID = 1000+i;
				
				//For TeamGames
				/*If(GetPlayerInfo(OwnerNumber,PLAYERINFO_TEAM)==GetPlayerInfo(Target_TID-1000,PLAYERINFO_TEAM))
				{
				GiveActorInventory(Target_TID+user_ID,ItemList[WhichItem],Amount);
				terminate;
				}*/
				
				//For everyone
				GiveActorInventory(Target_TID+user_ID,ItemList[WhichItem],Amount); //Gives the item.
				terminate;
			}
			
		}
		
	}
		
}

function int distanceVal (int tid1x, int tid1y, int tid2)
{
	int x, y, d;
	x = tid1x - GetActorX(tid2) >> 16; //Convert fixed point to integer
	y = tid1y - GetActorY(tid2) >> 16;
	d = sqrt8( x*x + y*y );
	return d;
}
And it can also give the stuff to players if the user_CustomID is set to 0, the only thing (at least the one I notice) is that if the owner fires a lot of the same projectile, the script would give it to every projectile that is currently spawned. And works only on own projectiles so far.

Note: The real script is a bit more large and has more stuff in it, but this works the same way.

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

[ACS] Re: Another way for A_RadiusGive but on ACS?

#9

Post by Ænima » Tue Feb 13, 2018 1:07 am

custom damagetypes and a_explode

it’s hacky but it probably works
­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !


ZandroSkins
: a pack made by our community

Post Reply