simulate the crouch

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.
Locked
User avatar
DOOMERO-21
Posts: 1423
Joined: Wed Jan 02, 2008 10:02 pm
Location: Chile

simulate the crouch

Post by DOOMERO-21 »

i have a question, when i press the crouch buttom, the player view change and go down, i need sometime like that, but not using crouch buttom, i mean edit the player view height for some events.
User avatar
Ral22
Posts: 531
Joined: Sun Sep 05, 2010 12:09 pm
Preferred Pronouns: He/Him
Location: The Fortress of Dr. Radiaki
Contact:

Re: simulate the crouch

Post by Ral22 »

I'm interested in this as well, but I haven't found a way to do it yet.
User avatar
Enjay
 
 
Posts: 27352
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: simulate the crouch

Post by Enjay »

I don't think the player view height can be altered dynamically using native ZDoom methods but you can fake it with camera views or even something as simple as putting the player on a platform and moving him up and down, provided that the player doesn't need to move around during your "events".

There is, however, [wiki]FraggleScript[/wiki] and it can alter the viewheight. eg this:

Code: Select all

[scripts] 

script 254
{
	runcommand("viewheight 16");
	wait(30);
	runcommand("viewheight 52");
}

startscript(254);
will switch the player viewheight to 16 and then raise it to 52 (the height I was using for the normal player viewheight in my mod). I was using it to simulate the player getting up from the floor after being knocked out in the previous level.
User avatar
DOOMERO-21
Posts: 1423
Joined: Wed Jan 02, 2008 10:02 pm
Location: Chile

Re: simulate the crouch

Post by DOOMERO-21 »

Enjay wrote:I don't think the player view height can be altered dynamically using native ZDoom methods but you can fake it with camera views or even something as simple as putting the player on a platform and moving him up and down, provided that the player doesn't need to move around during your "events".

There is, however, [wiki]FraggleScript[/wiki] and it can alter the viewheight. eg this:

Code: Select all

[scripts] 

script 254
{
	runcommand("viewheight 16");
	wait(30);
	runcommand("viewheight 52");
}

startscript(254);
will switch the player viewheight to 16 and then raise it to 52 (the height I was using for the normal player viewheight in my mod). I was using it to simulate the player getting up from the floor after being knocked out in the previous level.

interesting Enjay, i will check this, thanks!
User avatar
Enjay
 
 
Posts: 27352
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: simulate the crouch

Post by Enjay »

Simple example map:
fsexample.zip

Code: Select all

[scripts] 

script 254
{
	wait(70);
	print("viewheight 128");
	runcommand("viewheight 128");
	wait(105);
	print("viewheight 36");
	runcommand("viewheight 36");
	wait(105);
	print("viewheight 4");
	runcommand("viewheight 4");
	wait(105);
	print("viewheight 80");
	runcommand("viewheight 80");
	wait(105);
	print("viewheight 41 - default");
	runcommand("viewheight 41");
}

startscript(254);
edit:
Thinking about it, I suppose creating a player class with a different viewheight and then morphing the player might also work. At least that would be using native ZDoom features.
User avatar
DOOMERO-21
Posts: 1423
Joined: Wed Jan 02, 2008 10:02 pm
Location: Chile

Re: simulate the crouch

Post by DOOMERO-21 »

the player class, hmmm that could be too, but Enjay this could work with a global script? my mod not depend of maps.

edited: i have a problem, the xwe cant compile this.

edited2: also i tried with morph the actor and works!
User avatar
Enjay
 
 
Posts: 27352
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: simulate the crouch

Post by Enjay »

DOOMERO-21 wrote:the player class, hmmm that could be too, but Enjay this could work with a global script? my mod not depend of maps.

edited: i have a problem, the xwe cant compile this.

edited2: also i tried with morph the actor and works!
You probably don't need it now but...

FraggleScripts do not get compiled. Map specific scripts are held in a text lump that is used to replace the usual map01, map02 etc markers in the WAD.

They can also be used from a global script. From memory, fragglescripts in a lump called FSGLOBAL get executed globally.
User avatar
DOOMERO-21
Posts: 1423
Joined: Wed Jan 02, 2008 10:02 pm
Location: Chile

Re: simulate the crouch

Post by DOOMERO-21 »

i tried but is not working, on your test map the script was compiled.
User avatar
Enjay
 
 
Posts: 27352
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: simulate the crouch

Post by Enjay »

DOOMERO-21 wrote:on your test map the script was compiled.
It really wasn't.

My map does have a behavior lump because the map is in ZDoomHexen format. However, if you look at it with SLADE, it doesn't contain any scripts.

The FS script data is held in the MAP01 lump. This is normally just a header with the various map lumps after it but, in the case of FraggleScript, it's a text lump containing the scripts. However, the only way that I can find to show it are by opening the WAD in a HEX editor or Text editor. It would seem that when SLADE or XWE see a lump called MAP01, they show a map preview even though there is data in the MAP01 lump.

Text editor screenshot:

Image

See, not compiled. ;)


[edit]Also, I just copied and pasted my script into a text file called FSGLOBAL.txt and loaded it at the command line (ie zdoom -file FSGLOBAL.txt) and when I started a game, the script ran.[/edit]

[edit2]My bad, SLADE does show the script if you use a recent SVN build (r1299 or newer). [/edit2]
Locked

Return to “Editing (Archive)”