Page 1 of 1

Using weapons while in "PROP_TOTALLYFROZEN" and custom jumping?

Posted: Sat Feb 06, 2016 2:42 am
by Lord_of_D:
So im trying to work out on the mod of Doom Kart but i have a problems at the momment and something else that i want to implement:

-I want the player to be able to pick an item that gives a random kind of ammo, which the default weapon will use, however i dont want to allow the players to look around, so im using the property "PROP_TOTALLYFROZEN", however it blocks too the usage of weapons, "PROP_FROZEN" doesnt, but it allows the player to look around, any idea on how to do this? maybe using some acs bullshit like in Wrath of Cronos for the skills, but despite i checked it i dont quite understand it, however it most allow to have a "hold" property for some of the type of ammos, and an alt-fire too.

-I want to allow the player to jump too and after jumping, if the jump button is held, do an specific action, but not exactly sure how to do this, maybe with a custom bind that makes the player use the action "ThrustThingZ", but not sure for the hold action.

RE: Using weapons while in "PROP_TOTALLYFROZEN" and custom jumping?

Posted: Sat Feb 06, 2016 3:06 am
by Kaminsky
1. You can have a script looping for each player that's constantly calling GetPlayerInput() and check if the player is pressing their attack (or alt-attack) button. If they are, execute a block of code that takes some of the ammo from the player and fires something like a projectile or hitscan attack. If you need to have some delay in the attack, you can add another condition that causes the cancels the execution until some time has passed.

So, you could use something like:

Code: Select all

if(GetPlayerInput(-1, INPUT_BUTTONS) & BT_ATTACK)
{
       //Execute attack if possible.
}
I used this method in order to get a player inside a car to accelerate or decelerate while being completely frozen.

2. Again, you can use GetPlayerInput() and check if the player pressed the jump button, then thrust them upwards. If when they land they're still holding the jump button, execute the action.

RE: Using weapons while in "PROP_TOTALLYFROZEN" and custom jumping?

Posted: Sat Feb 06, 2016 10:07 pm
by Lord_of_D:
Dr.Robotnik wrote: 1. You can have a script looping for each player that's constantly calling GetPlayerInput() and check if the player is pressing their attack (or alt-attack) button. If they are, execute a block of code that takes some of the ammo from the player and fires something like a projectile or hitscan attack. If you need to have some delay in the attack, you can add another condition that causes the cancels the execution until some time has passed.

So, you could use something like:

Code: Select all

if(GetPlayerInput(-1, INPUT_BUTTONS) & BT_ATTACK)
{
       //Execute attack if possible.
}
I used this method in order to get a player inside a car to accelerate or decelerate while being completely frozen.
ok, so i tried using that, however it gives me this error when i try to compile the next code:

Code: Select all

Line 23 in file "C:\Users\FRANCI~1\AppData\Local\Temp\SLADE3\ITEMS.acs" ...
C:\Users\FRANCI~1\AppData\Local\Temp\SLADE3\ITEMS.acs:23: Missing ')'.
>        if (CheckInventory("GreenSkullAmmo"){ 
>                                            

Code: Select all

Script 2000 Enter
{
	int buttons;
	
	if(GetPlayerInput(-1, INPUT_BUTTONS) & BT_ATTACK & CheckInventory("ItemCheck"))
	{
       if (CheckInventory("GreenSkullAmmo"){
			Thing_Projectile (1, "GreenSoul", 0, 60, 0);
			TakeInventory("ItemCheck",1);
			TakeInventory("GreenSkullAmmo",1);
			}
	   if (CheckInventory("RedSkullAmmo"){
			Thing_Projectile (1, "RedSoul", 0, 60, 0);
			TakeInventory("ItemCheck",1);
			TakeInventory("RedSkullAmmo",1);
			}
	}
}
do i have to "declare"(not sure if its the right word) the different actors as some kind of float type?

RE: Using weapons while in "PROP_TOTALLYFROZEN" and custom jumping?

Posted: Sat Feb 06, 2016 11:54 pm
by ZZYZX
you should write

Code: Select all

if (CheckInventory("GreenSkullAmmo"))
missed a parenthesis.

RE: Using weapons while in "PROP_TOTALLYFROZEN" and custom jumping?

Posted: Sun Feb 07, 2016 2:03 am
by Catastrophe
do i have to "declare"(not sure if its the right word) the different actors as some kind of float type?
C:\Users\FRANCI~1\AppData\Local\Temp\SLADE3\ITEMS.acs:23: Missing ')'.

RE: Using weapons while in "PROP_TOTALLYFROZEN" and custom jumping?

Posted: Sun Feb 07, 2016 5:52 am
by Lord_of_D:
ZZYZX wrote: you should write

Code: Select all

if (CheckInventory("GreenSkullAmmo"))
missed a parenthesis.
man...this is the kind of mistakes one makes but only someone else can notice up, i didnt noticed that part, i thougt it was talking about not declaring the ammo, thanks anyway

RE: Using weapons while in "PROP_TOTALLYFROZEN" and custom jumping?

Posted: Sun Feb 07, 2016 8:00 pm
by SwordGrunt
It's not that hard to notice when the compiler tells you exactly what to do and on which line, but anyway...

Why do you want to freeze players in a kart minigame where they're supposed to be able to look around so they don't always go in a straight line?

RE: Using weapons while in "PROP_TOTALLYFROZEN" and custom jumping?

Posted: Mon Feb 08, 2016 12:27 am
by Lord_of_D:
SwordGrunt wrote: It's not that hard to notice when the compiler tells you exactly what to do and on which line, but anyway...

Why do you want to freeze players in a kart minigame where they're supposed to be able to look around so they don't always go in a straight line?
its to prevent the user from strafing and turing around, im using scripts to allow the player to move with "recoil" and "setangle" by customizing the default binds.

edit: ok, so the script is partially working, because it prints the message thats in the code, however it doesnt spawns the projectile, i tried by giving the projectile an spawn id and tagging the player, but its just not working and i cant find out why :(

Code: Select all

Script 2000 ENTER
{	
	int buttons;
	
	while (TRUE)
	{
		buttons = GetPlayerInput(-1, INPUT_BUTTONS);
		
		if(buttons & BT_ATTACK)
		{
			if (CheckInventory("GreenSkullAmmo")>0)
			{
				print(s:"Test");
				Thing_Projectile(1, "GreenSoul", 0, 60,0);
				TakeInventory("ItemCheck",1);
				TakeInventory("GreenSkullAmmo",1);
            }
		}
	delay(1);
	}
}	

RE: Using weapons while in "PROP_TOTALLYFROZEN" and custom jumping?

Posted: Mon Feb 08, 2016 1:27 am
by Kaminsky
Thing_Projectile uses SpawnIDs to determine which projectile to fire, not the name. Try using SpawnProjectile instead.

RE: Using weapons while in "PROP_TOTALLYFROZEN" and custom jumping?

Posted: Mon Feb 08, 2016 8:13 am
by Catastrophe
To be honest, I think making scripts of this caliber might be out of your league. From my experience with modding and clientside scripting, you should never use getplayerinput() on a non-clientside script unless you are okay with high pinging players getting constantly shafted. You don't really need to use setactorproperty to prevent a player from strafing. Just give the player a "Player.sidemove" of 0 in decorate.

As for turning, I think you might wanna just give up on that. ACS scripts only have 35 chances (tics) to be activated each second, so simply doing setactorangle isn't going to work as it will look really choppy between each of those 35 tics if you run Zandro with more than 35 frames per second. I honestly see no way to prevent instantaneous turning without the mod being really choppy/clunky. It's just something you gotta live with for now.

Trust me, I've tried to get that stuff working (See my death-race project). Zdoom nor Zandronum has any known method/hacky workarounds to limit mouse turning speed. And even if Zandro did, I don't see it being enforceable server-side either. Someone could just edit their client to not limit their mouse movement.