Using weapons while in "PROP_TOTALLYFROZEN" and custom jumping?

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
Lord_of_D:
Posts a lot
Posts: 691
Joined: Sun Aug 26, 2012 5:31 am
Location: Mexico
Contact:

Using weapons while in "PROP_TOTALLYFROZEN" and custom jumping?

#1

Post by Lord_of_D: » Sat Feb 06, 2016 2:42 am

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.
Image

User avatar
Kaminsky
Developer
Posts: 202
Joined: Sun Apr 14, 2013 7:17 pm
Location: Canada

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

#2

Post by Kaminsky » Sat Feb 06, 2016 3:06 am

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.

User avatar
Lord_of_D:
Posts a lot
Posts: 691
Joined: Sun Aug 26, 2012 5:31 am
Location: Mexico
Contact:

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

#3

Post by Lord_of_D: » Sat Feb 06, 2016 10:07 pm

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?
Image

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

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

#4

Post by ZZYZX » Sat Feb 06, 2016 11:54 pm

you should write

Code: Select all

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

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

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

#5

Post by Catastrophe » Sun Feb 07, 2016 2:03 am

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 ')'.
Last edited by Catastrophe on Sun Feb 07, 2016 2:03 am, edited 1 time in total.

User avatar
Lord_of_D:
Posts a lot
Posts: 691
Joined: Sun Aug 26, 2012 5:31 am
Location: Mexico
Contact:

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

#6

Post by Lord_of_D: » Sun Feb 07, 2016 5:52 am

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
Image

User avatar
SwordGrunt
Forum Regular
Posts: 377
Joined: Thu Jun 07, 2012 8:43 pm

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

#7

Post by SwordGrunt » Sun Feb 07, 2016 8:00 pm

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?

User avatar
Lord_of_D:
Posts a lot
Posts: 691
Joined: Sun Aug 26, 2012 5:31 am
Location: Mexico
Contact:

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

#8

Post by Lord_of_D: » Mon Feb 08, 2016 12:27 am

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);
	}
}	
Last edited by Lord_of_D: on Mon Feb 08, 2016 1:10 am, edited 1 time in total.
Image

User avatar
Kaminsky
Developer
Posts: 202
Joined: Sun Apr 14, 2013 7:17 pm
Location: Canada

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

#9

Post by Kaminsky » Mon Feb 08, 2016 1:27 am

Thing_Projectile uses SpawnIDs to determine which projectile to fire, not the name. Try using SpawnProjectile instead.

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

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

#10

Post by Catastrophe » Mon Feb 08, 2016 8:13 am

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.
Last edited by Catastrophe on Mon Feb 08, 2016 8:16 am, edited 1 time in total.

Post Reply