Jump to content
The Dark Mod Forums

Beta testers sought: speed potion, slow-fall potion


VanishedOne

Recommended Posts

Bikerdude requested a formal beta test of the new items from http://forums.thedarkmod.com/topic/17367-custom-items/with a view to adding them to the core mod, so we're seeking volunteers so they can be tested across a range of maps and computers. If you'd like to participate, just post in this thread. The defs are available here and the latest version of the script is here.

 

Besides checking for glitches, this is also your chance to help fine-tune the default settings, e.g. if you think you'd never pay that much for a slow-fall potion.There are some spawnargs explained in the entityDefs which let you adjust the items' behaviour easily in DR.

 

Defs go in def/whatever.def.

 

Scripts go in script/tdm_custom_scripts.script, or you put them in script/whatever.script and add the following line to script/tdm_custom_scripts.script (changing 'whatever' as appropriate).

#include "script/whatever.script"
Note that installed missions can include their own tdm_custom_scripts.script which will make the one in your scripts directory not work. Edited by VanishedOne

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Link to comment
Share on other sites

I cobbled together a potions.script file, put it in darkmod/script, and a potions.def file and put it in darkmod/def.

 

I added one of each item to my WIP so that I'd get 20 of each at map start.

 

When I start TDM, I get this message:

 

script object 'playertools_slowfallpotion' not found on entity 'atdm_playertools_slow_fall_potion_1'.

 

The scriptobject spawnarg on the item is correct, and matches the name of the script object in potions.script.

 

When I delete the slow fall potion from the map, I get the same error for the speed potion.

 

Not sure what's going on, or what I failed to do to set this up properly.

Link to comment
Share on other sites

Do you have any other missions installed? They might be overriding your tdm_custom_scripts.script with one of their own.

I cobbled together a potions.script file, put it in darkmod/script, and a potions.def file and put it in darkmod/def.

Did you #include potions.script in script/tdm_custom_scripts.script?

Edited by VanishedOne

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Link to comment
Share on other sites

One thing that's apparent from Bikerdude's test map is how easy it is to hurt yourself from wall collisions when running off ledges at boosted speed.

 

The speed potion doesn't boost while you're jumping up (jumps were really dramatic before that, presumably due to the lack of friction) but what I found while implementing the slow-fall potion is that getMove() reports '_ _ 0' for both being on the ground and being in free-fall. So instead of checking whether you're falling, the script checks that you're not rising [under what I presume to be your own volition].

 

(Edit: I checked the behaviour on moving lifts. It may need looking at some more.)

 

I thought about trying to change that for the slow-fall potion (by tracking getOrigin() across multiple frames, or using the trace code SteveL showed me to test for solid surfaces under the player) but didn't because if you add a bit more lift_force to that potion you start bouncing over water or flying anyway, so having some lift while you're on the ground isn't a problem. But if the speed potion causes inconsistent wall damage it might be worth revisiting.

Edited by VanishedOne

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Link to comment
Share on other sites

The other issue I see is there is now count-down timer for each of the potions.

Did T2's versions have one? I can copy the timer code from the holy water script if people think it's needed.

 

Edit: I'm not sure how that would handle multiple timers active at once...

Edited by VanishedOne

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Link to comment
Share on other sites

I don't think a timer is needed. Unlike water arrows, the player should be able to feel the difference when the effect wears off.

 

If we want some kind of visual feedback, then I'd do something subtle to the player's view, like a subtle shroud or something that slowly fades away.

Link to comment
Share on other sites

After testing for a while, some observations:

 

1 - If I swallow the slow fall potion, normal walking and running turns into a slog. The same thing after falling slowly and landing. (Is this what you were talking about above?)

 

There's a script boolean you can use to test whether your feet are on the ground: AI_ONGROUND.

 

2 - Why does the slow fall potion let you jump higher? Wouldn't it affect falling only?

 

3 - Mantling with the slow fall seems okay, though I jump up into the air once the mantle is complete if the jump key is involved in mantling (which is how I do it).

 

4 - When running off a ledge with the speed potion, I keep going fast with hardly any drop, easily smashing into walls. Easy to kill myself. Wouldn't speed only be in effect when the player's on the ground or swimming in water?

 

5 - If I'm swimming along on a water surface and swallow the speed potion, I can't sink into the water while moving. I skim speedily along the surface.

 

6 - If I'm underwater when I take the potion, I can't swim up or down; I stay at the same depth while the potion is in effect.

 

7 - If I'm swimming on the water surface and swallow the slow fall potion, I bob up and down like a yo-yo. Can't break out of it until the potion runs out.

 

8 - If I'm swimming underwater and swallow the slow fall, I leap up out of the water. Once I'm out of the water, I fall back to the water surface and start doing #7.

 

9 - If I slow fall into water, I hit the surface and start doing #7.

 

10 - It's real easy to hurt myself with the current settings. I reduced the speed bump from 9 to 5, but that's only 30% faster than running, and isn't very noticeable. Would only make sense if running at the same time. Tried 7, and that felt about right. I also couldn't hurt myself running at full speed into a wall.

 

11 - If walking along and I take a slow fall, I slow down to a crawl. If I then try to run, there's no speed change, so the run key is being ignored. When #1 gets fixed, that should fix this problem.

 

12 - Mantling with the speed potion is okay.

 

More later.

 

 

Link to comment
Share on other sites

I don't think a timer is needed. Unlike water arrows, the player should be able to feel the difference when the effect wears off.

 

If we want some kind of visual feedback, then I'd do something subtle to the player's view, like a subtle shroud or something that slowly fades away.

 

Agreed. I don't even think the shroud is needed. You know when either potion is in effect, and it's not like you can do anything about it (unlike the breath timer, which gives you feedback that you'd better find some air soon).

Link to comment
Share on other sites

The only argument I can see for having visual feedback is that someone who takes a slowfall potion might need to know whether it is still active before jumping off a ledge, or whether it's just about to wear off when he's half-way down or something. It depends on how the potion works...if it slows everything down then that would be easy for the player to see.

Link to comment
Share on other sites

After testing for a while, some observations:

 

1 - If I swallow the slow fall potion, normal walking and running turns into a slog. The same thing after falling slowly and landing. (Is this what you were talking about above?)

 

There's a script boolean you can use to test whether your feet are on the ground: AI_ONGROUND.

 

2 - Why does the slow fall potion let you jump higher? Wouldn't it affect falling only?

 

3 - Mantling with the slow fall seems okay, though I jump up into the air once the mantle is complete if the jump key is involved in mantling (which is how I do it).

 

4 - When running off a ledge with the speed potion, I keep going fast with hardly any drop, easily smashing into walls. Easy to kill myself. Wouldn't speed only be in effect when the player's on the ground or swimming in water?

 

5 - If I'm swimming along on a water surface and swallow the speed potion, I can't sink into the water while moving. I skim speedily along the surface.

 

6 - If I'm underwater when I take the potion, I can't swim up or down; I stay at the same depth while the potion is in effect.

 

7 - If I'm swimming on the water surface and swallow the slow fall potion, I bob up and down like a yo-yo. Can't break out of it until the potion runs out.

 

8 - If I'm swimming underwater and swallow the slow fall, I leap up out of the water. Once I'm out of the water, I fall back to the water surface and start doing #7.

 

9 - If I slow fall into water, I hit the surface and start doing #7.

 

10 - It's real easy to hurt myself with the current settings. I reduced the speed bump from 9 to 5, but that's only 30% faster than running, and isn't very noticeable. Would only make sense if running at the same time. Tried 7, and that felt about right. I also couldn't hurt myself running at full speed into a wall.

 

11 - If walking along and I take a slow fall, I slow down to a crawl. If I then try to run, there's no speed change, so the run key is being ignored. When #1 gets fixed, that should fix this problem.

 

12 - Mantling with the speed potion is okay.

 

More later.

 

 

 

1, 11 - that's deliberate, and controlled via the drag_penalty spawnarg. It approximates the behaviour of http://thief.wikia.com/wiki/Slow-Fall_Potion(though if memory serves T2's slowdown feels more like a low-G effect, whereas mine isn't applied while jumping):

 

 

However, the player will move very slowly, so it is not advised to drink when being pursued or being fired at.

 

2 - It shouldn't, or at least not much; the lift force isn't applied while the _z of getMove() is > 0. Though according to the speedrunner's link below T2's does increase jump height. I did get occasional, hard-to-reproduce moonjump behaviour from an earlier version, so maybe it's still there: are you jumping a bit higher or much higher?

 

7,8,9 - according to https://kb.speeddemosarchive.com/Thief_2/Game_Mechanics_and_Glitchesbeing boosted out of the water is T2 behaviour as well and has a use:

 

 

Slowfall potions: they'll let you fall slower, but they also slow you down on the ground. [...] You can jump higher than normal using a slowfall potion. If you're airborne while you quaff one (just after jumping), you will keep your velocity. ALSO, when you're underwater you can drink one to suddenly increase your buoyancy by a lot. The deeper down you were the more speed you'll be able to accumulate by the time you hit the surface. You might be able to reach a ledge that you otherwise couldn't this way.

Exactly how much you bounce, though, depends on the lift_force spawnarg and possibly should be tuned down a bit.

 

I'll look into the others. Thanks for letting me know about AI_ONGROUND.

Edited by VanishedOne

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Link to comment
Share on other sites

Letting the player jump higher would allow them to reach places they otherwise couldn't, which would make me hesitant to add them as a mapper (you'd have to beta-test the entire map using a potion). Is there any reason why that has to be bundled up with the ability to fall more slowly?

Link to comment
Share on other sites

Letting the player jump higher would allow them to reach places they otherwise couldn't, which would make me hesitant to add them as a mapper (you'd have to beta-test the entire map using a potion). Is there any reason why that has to be bundled up with the ability to fall more slowly?

As I said to grayman, the potion isn't supposed to boost jump height (unless you're referring to the boost out of water here). If it does that's a bug.

 

As I mentioned to Destined here, someone else might make a jump potion.

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Link to comment
Share on other sites

Here's a version that uses AI_ONGROUND to test for jumping. I ran around in Biker's test map again and didn't take damage running off ledges into walls this time. I haven't tested it in water yet.

 

/*
* SPEED POTION scriptobject
*/
object playertools_speedpotion : player_tools {
	/**
	* [ Comment copied from health potion script object: ]
	* greebo: This is the method that gets called from within the SDK
	*		  when the player "uses" this tool as inventory item.
	*
	* @userEntity: the entity that is using this item, usually $player1
	* @frobbedEntity: the entity the player is currently frobbing, may be $null_entity
	* @buttonState: a float telling about the current button state (pressed, released)
	*/
	void inventoryUse(player userEntity, entity frobbedEntity, float buttonState);
	void update(player userEntity);
	
	float duration;
	float speed_mod;
	float endTime;
};

/**
* =============== SPEED POTION ======================================
*/
void playertools_speedpotion::inventoryUse(player userEntity, entity frobbedEntity, float buttonState)
{
	// Callback to decrease the inventory stack count
	userEntity.changeInvItemCount(getKey("inv_name"), getKey("inv_category"), -1);

	// Play the activate sound
	userEntity.startSoundShader(getKey("snd_swallow"), SND_CHANNEL_VOICE);
	
	duration = getFloatKey("duration");
	speed_mod = getFloatKey("speed_mod");
	
	endTime = (sys.getTime() + duration);
	
	update(userEntity);
}

void playertools_speedpotion::update(player userEntity) {
	sys.killthread("speed_potion");
	sys.threadname("speed_potion");
	
	while (sys.getTime() < endTime) {sys.wait(0.01);
		vector player_direction = userEntity.getViewAngles();
		float player_angle = player_direction_y;
		vector player_movement = userEntity.getMove();
		vector player_movement_world = player_movement;
		player_movement_world_x = (player_movement_x * sys.cos(player_angle)) + (player_movement_y * sys.cos(player_angle - 90));
		player_movement_world_y = (player_movement_x * sys.sin(player_angle)) + (player_movement_y * sys.sin(player_angle - 90));
		
		vector boost_movement = '0 0 0';
		
		if (userEntity.AI_ONGROUND) {
			boost_movement_x = player_movement_world_x * speed_mod;
			boost_movement_y = player_movement_world_y * speed_mod;
		};
		
		userEntity.applyImpulse(userEntity,0,userEntity.getOrigin(),boost_movement);
	};
}



/*
* SLOW-FALL POTION scriptobject
*/
object playertools_slowfallpotion : player_tools {
	/**
	* [ Comment copied from health potion script object: ]
	* greebo: This is the method that gets called from within the SDK
	*		  when the player "uses" this tool as inventory item.
	*
	* @userEntity: the entity that is using this item, usually $player1
	* @frobbedEntity: the entity the player is currently frobbing, may be $null_entity
	* @buttonState: a float telling about the current button state (pressed, released)
	*/
	void inventoryUse(player userEntity, entity frobbedEntity, float buttonState);
	void update(player userEntity);
	
	float duration;
	float lift_force;
	float drag_penalty;
	float endTime;
};

/**
* =============== SLOW-FALL POTION ==================================
*/
void playertools_slowfallpotion::inventoryUse(player userEntity, entity frobbedEntity, float buttonState)
{
	// Callback to decrease the inventory stack count
	userEntity.changeInvItemCount(getKey("inv_name"), getKey("inv_category"), -1);

	// Play the activate sound
	userEntity.startSoundShader(getKey("snd_swallow"), SND_CHANNEL_VOICE);
	
	duration = getFloatKey("duration");
	lift_force = getFloatKey("lift_force");
	drag_penalty = getFloatKey("drag_penalty");
	
	userEntity.setHinderance("slowfall_potion", drag_penalty, drag_penalty);
	
	endTime = (sys.getTime() + duration);
	
	thread update(userEntity);
}

void playertools_slowfallpotion::update(player userEntity) {
	sys.killthread("slowfall_potion");
	sys.threadname("slowfall_potion");
	
	while (sys.getTime() < endTime) {sys.wait(0.01);
		vector player_movement = userEntity.getMove();
		vector boost_movement = '0 0 0';
		
		if ( (player_movement_z <= 0) && !userEntity.AI_ONGROUND && !userEntity.AI_ONLADDER) boost_movement_z = lift_force;
		userEntity.applyImpulse(userEntity,0,userEntity.getOrigin(),boost_movement);
	};
	
	userEntity.setHinderance("slowfall_potion", 1, 1);
}

 

 

 

Does anyone know a way for scripts to check whether the player is mantling? I tried disabling the slowfall lift when AI_CROUCH is true, and that seemed to fix the problem of jumping after mantling, but it makes the potion wholly inoperative when the player is crouching.

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Link to comment
Share on other sites

I don't understand why the slow fall potion would slow you down when you're on the ground. It's a slow fall potion, and you're not falling. It sounds like the original creators noticed this odd behavior, and rather than fix it, they pronounced it 'normal behavior'. Even if we say that the potion lets you jump higher, that's still a gravitational effect, and might be acceptable on those terms.

 

I spend so much time trying to make sure that players can get to reasonable places vertically, and not get to places where they'd break the map, that having a potion that lets them jump higher is not something I want to spend even more time accommodating. So I wouldn't use it, just to cut down on the amount of time I have to spend worrying about it and testing the entire map with it.

Link to comment
Share on other sites

Does anyone know a way for scripts to check whether the player is mantling? I tried disabling the slowfall lift when AI_CROUCH is true, and that seemed to fix the problem of jumping after mantling, but it makes the potion wholly inoperative when the player is crouching.

 

There's no current way. We'd have to add code support for that.

Link to comment
Share on other sites

13 - (with changed script) Took a slow fall potion and mantled up out of water onto surrounding ground. Traveled 646 units straight up into the air until I hit the sky brush, died, and fell back down.

 

Not good. One more reason to kill the potion effect when mantling is done.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
    • nbohr1more

      Please vote in the 15th Anniversary Contest Theme Poll
       
      · 0 replies
×
×
  • Create New...