Scripts / climbing ladders

Author
Message
Scanman
5
Years of Service
User Offline
Joined: 8th Dec 2019
Playing: Total War Saga: Troy, Amytric Pulse
Posted: 30th Mar 2020 16:30
Hi!

I worked out script for climbing up and down ladders. I used TransportToIfUsed function for this as was advised at the forum. You can see how it works in the video below.

----------- GOOGLE DISK VIDEO CONNECTOR START (USE CHROME TO OPEN)-----------
https://drive.google.com/file/d/1EFhQ6Zmo1L6YzG_mUXAayKhr39CdNtQO/view?usp=sharing
----------- GOOGLE DISK VIDEO CONNECTOR END-----------

As you can see, i have programmed two different buttons for climbing up and down. T for up direction and G for down direction. May be someone knows how to solve it (i mean two keys)? I tried to apply only one key for climbing, but in this occasion player returning down immediatly after climbing up. There are two trigger zones for 'IfUsed' variables of ladder parts entities and two scripts for different messages. Problem still with single key for both directions...Thank you for attention.
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 31st Mar 2020 04:52
Hey yo. Yeah, gravity will always pretty much bring the player back down
from the air in any script attempt to lift the player. You need a floor below
the player! So how do we do that? Well I just got an idea.. maybe that
could work for you.

I am assuming that you are using this for 1st Person??

smallg has a platform script in his library somewhere, but I'll rummage
around for one I made, to be sure I'm not in the wrong (I mean, I won't post
his script.)
But the idea will be to actually ride the platform up the ladder.
You would make the platform invisible, and script it going up and down.

So, here ya go;
Just use the little square wooden bridge in the 'bridges' folder/

Scale as shown
Static = no
Is Immobile = yes


-------------------------------------------
local thingx = {}
local thingy = {}
local thingz = {}

local movex = {}
local movey = {}
local movez = {}

function moveup_downb_init(e)


thingx[e] = g_Entity[e]['x']
thingy[e] = g_Entity[e]['y']
thingz[e] = g_Entity[e]['z']

movex[e] = 0
movey[e] = 0
movez[e] = 0

Hide(e)

end -- init

------### - < - ###- M A I N- < - ###- M A I N

function moveup_downb_main(e)

if GetPlayerDistance(e) < 55 then -- Activate when near

if g_Scancode == 20 then -- 'T' = up
if movey[e] < 180 then
movey[e] = movey[e] + 1
end -- constraints; (goes to 180 above original position)
end -- 'T' = up

if g_Scancode == 34 then -- 'G' down
if movey[e] > 0 then
movey[e] = movey[e] - 1
end -- constraints; (goes to original position)
end -- 'G' = down

end -- -- Activate when near


if g_PlayerPosY < thingy[e] + (movey[e]-10) then
movey[e] = 0
end -- Auto reset 'ladder'/ AKA platform to original position
------ if player jumps off or falls off

Text(33,22,1,"mvy2plry; "..thingy[e] + (movey[e]+10))


if GetPlayerDistance(e) < 125 then -- Activate when near
TextCenterOnX(50,44,1,"'T'=climb up/ 'G' = down")
end

Text(22,22,1,"plrdist; "..GetPlayerDistance(e))
PromptLocal(e,"Platform here")

CollisionOff(e)
SetPosition(e,thingx[e],thingy[e]+movey[e],thingz[e])
ResetPosition(e,thingx[e],thingy[e]+movey[e],thingz[e])
CollisionOn(e)


end --- Main

PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 31st Mar 2020 05:43
Obviously remark away the adjustment text and prompts
when you have it set to your needs.

Another thing I just thought of; if you climb the ladder, exit
the area and wander around to a point lower than the
platform, now you won't be able to climb DOWN the ladder
from the top (back up it, yes.)

There's a pretty easy fix for that, can you figure it out?
I will post the fix when I get back, as it's nearly 1am here.
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 31st Mar 2020 11:07
It's tough to say without seeing the code but you need to toggle the input so it only returns true when the player actually presses the input (if you are relying on the player holding the input to move then you will need an extra check to tell if the player is moving in a certain direction and reset that at the same time as the player releases the input)
I.e.


Obviously you need to do your own checks for if the player is at the bottom or top etc as you already have in your own code
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Scanman
5
Years of Service
User Offline
Joined: 8th Dec 2019
Playing: Total War Saga: Troy, Amytric Pulse
Posted: 1st Apr 2020 18:10 Edited at: 1st Apr 2020 20:11
Hello there,

After several hours of experiments I have got working variant of ladder script, which can be called by pressing just one key in both directions. I have some troubles while testing, but script can the following tricks:
1. Climbing up from bottom after simple approaching
2. Immediate climbing down after climbing up
3. Climbing down after going something else on the same altitude
4. Climbing up after going something else on the very floor after climbing down
5. Climbing up after returning from the top without using ladder
6. Different messages for both directions
Certainly, script can be optimized, and i share it to all (for ocassion if sombody wants to use it or recode). There is a bug.
After returning from botttom, pressing E not working. Exactly, only the second pressing of button works fine (or flying out and returning to active trigger area).
In any way it works!!!
You can see real example in the video using the link below:

----------- GOOGLE DISK VIDEO CONNECTOR START (USE CHROME TO OPEN)-----------
https://drive.google.com/file/d/1fjgUA5l8nshRGRCqnXfQU64c-aJyxTdk/view?usp=sharing
----------- GOOGLE DISK VIDEO CONNECTOR END-----------

A ladder is constructed using two parts: bottom ( ladder1_bottom) and top (ladder1_top). Teleportation points are two trigger zones: bottom (ladder1_bottom_t) and top (ladder1_top_t). "ladder1_bottom_t" is "if used" in ladder1_top entity and "ladder1_top_t" is "if used" in ladder1_bottom entity.

Script for ladder1_bottom is called ladder_up.lua


Script for ladder1_top is called ladder_down.lua


It will be very nice if somebody helps me understand why the script has the bug. It not sends to top after backing to ground immediatly, but only after pressing E the second time! From other sides it seems to be perfect. Thank you again for attention!
PM
Scanman
5
Years of Service
User Offline
Joined: 8th Dec 2019
Playing: Total War Saga: Troy, Amytric Pulse
Posted: 14th Apr 2020 18:48 Edited at: 14th Apr 2020 19:13
Hi there!

Finally, i've got it! )))

Ready to use script for climbing ladders. All day i've wasted to create one script instead of two. Now any top and bottom active parts of ladder can have the same script (ladder.lua), which understand all it needs. In addition, any other ladders use the same script. It is only one!!! You need to place a ladder, set up right names for active parts, prepare climbing zones and entity's "if used" parameters. No bugs, ready to use. You can see the result using the link below.

----------- GOOGLE DISK VIDEO CONNECTOR START (USE CHROME TO OPEN)-----------
https://drive.google.com/file/d/1LUaAfozOkM4NAfJNQyC2XEwPbuT241ds/view?usp=sharing
----------- GOOGLE DISK VIDEO CONNECTOR END-----------

Here you can see the code itself.



I will be glad to here some response for anyone who test it. And if you want to use it, you need to do several steps:
1. Save script as ladder.lua (no further changes neede to the script)
2. Then create ladder with bottom and top parts, and set up lua script for each active part as "ladder.lua"
3. There is one important rule. Name of bottom part is to be "ladderbottom_XX", and name of top is to be "laddertop_XX", where XX - is unique integer. I used in the video numbers 1,2,3.
4. Place 2 trigger zones near bottom and top and give names (names can be any as you want, but all trigger zones for all ladders are to be unique). This is important. I used int the video the following name for trigger zones: "ltop__1", "lbottom__1", "ltop__2", "lbottom__2", "ltop__3", "lbottom__3"
5. Then apply this names to "if used" parameters of active parts of you ladder.

That's all! If someone wants to test it and failing with setting the things up, i can create a short tutorial on this topic. Thank you for all answers!!!
PM
Scanman
5
Years of Service
User Offline
Joined: 8th Dec 2019
Playing: Total War Saga: Troy, Amytric Pulse
Posted: 3rd May 2020 22:00 Edited at: 4th May 2020 17:26
Hi there,

I continue developing ladder script, because it has a bug with determination of direction while jumping. So i am seeking of ways of how to correct it. For now, i want to show two videos of how I implement script for different ladders.

The first video has an example of how to create ladder, which is located "on the second floor", and "not on the ground".

Testing Ladder 4 - Ladder is not on the ground

Then, here you can find nice example of using the ladder script. Here, i attached top part to a box, not to ladder...
Testing Ladder 4 - Attaching top of ladder outside ladder itself

Everything looks fine, but may be someone can support me with ideas...Thank you for attention!
PM
JC LEON
14
Years of Service
User Offline
Joined: 22nd Apr 2010
Location:
Posted: 3rd May 2020 22:46
nice try and many thanks for the script but from the video all seems.... but not a ladder climb...LOL
it's mainly like a teletransportation...
PC 2 Specs:
AMD RYZEN 2600 SIX CORE @3,70, 64GB RAM DDR4 2400, M/B GIGABYTE AX370
SVGA NVDIA 1660GTX 6GB , SSD M.2 TRANSCEND S110 1TB, 1X HDD SEAGATE BARRACUDA 4TB, 1X HDD TOSHIBA 2TB


PC 2 Specs:
AMD QUADCORE 880K @4.5GHZ, 32GB RAM DDR3 1600, M/B ASUS A88XM-PLUS
SVGA RADEON R9 380 4GB , SSD KINGSTON A400 1TB, 2X HHD SEAGATE BARRACUDA 4TB
PM
Scanman
5
Years of Service
User Offline
Joined: 8th Dec 2019
Playing: Total War Saga: Troy, Amytric Pulse
Posted: 3rd May 2020 23:04 Edited at: 4th May 2020 17:22
Yes, it is. It is using this technology . But while experimenting i find that it can be used for climbing not just "up and down". It can "teleport" through complex objects like "ladder - tube - another ladder' or "ladder - another ladder - hole - top of high wall - another ladder". Variations are infinite... Just change in script "Press E to go to that point" and choose trigger areas...
PM
Scanman
5
Years of Service
User Offline
Joined: 8th Dec 2019
Playing: Total War Saga: Troy, Amytric Pulse
Posted: 3rd May 2020 23:13 Edited at: 3rd May 2020 23:16
but without this simple script my game is nothing...creating something more sophisticated in plans though...
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 7th May 2020 19:27
In order to get the most sophisticated, you most likely would need an animated character ready to climb ladders, and then the script may do the rest.
However teleporting the player is also a valid option.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 7th May 2020 20:11
Been there, done that, got all the T-Shirts!
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 7th May 2020 20:30
Yah, something like this.
I love how uncharted games chars climb mountains and old temples.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
Scanman
5
Years of Service
User Offline
Joined: 8th Dec 2019
Playing: Total War Saga: Troy, Amytric Pulse
Posted: 4th Jan 2021 17:30 Edited at: 4th Jan 2021 17:35
Hi there,

After accumulating some information from forum, I've decided to create something more sophisticated. And now it is ready. Something like Half-Life ladder. The main problem was to debug positions and place it into script. Also it is common setup for script. Before using it is required to set up constants for positions of different type.
Check it out in the video below. Looks fine for me.



Thanks everybody who helped with experiments and watched my videos. So... There it is. The release of the very first version of a ladder script.



Please, check it by youself and let me know if any bugs exist. To set up it in a right way, you need to use debug info from the top of the game screen and correct the following constants:
PLATFORM_Z_MAX // MAXIMUM FOR PLATFORM
PLATFORM_Z_MIN // MINIMUM FOR PLATFORM
TOP_TELEPORT_X // GOOUT POSITION
TOP_TELEPORT_Y
TOP_TELEPORT_Z
PLAYER_FREEZE_POS_X // CENTER OF PLATFORM
PLAYER_FREEZE_POS_Z

Certainly, you need to name the script ladder_test.lua (or change names of functions) and then apply this script to any scaled entity used as platform.
PM
bluemeenie195
6
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 4th Jan 2021 17:51
Cool, I'll check it out.


GubbyBlips made a really good ladder script too, you can find on the forum.
PM
JC LEON
14
Years of Service
User Offline
Joined: 22nd Apr 2010
Location:
Posted: 4th Jan 2021 21:56
Quote: "


GubbyBlips made a really good ladder script too, you can find on the forum.
"


is this the GubbyBlips one?? can you link or share it ?
PC 1 Specs:
AMD RYZEN 2600 SIX CORE @3,70, 64GB RAM DDR4 2400, M/B GIGABYTE AX370
SVGA NVDIA 1660GTX 6GB , SSD M.2 TRANSCEND S110 1TB, 1X HDD SEAGATE BARRACUDA 4TB, 1X HDD TOSHIBA 2TB



PC 2 Specs:
AMD QUADCORE 880K @4.5GHZ, 32GB RAM DDR3 1600, M/B ASUS A88XM-PLUS
SVGA RADEON R9 380 4GB , SSD KINGSTON A400 1TB, 2X HHD SEAGATE BARRACUDA 4TB
PM
osiem80
5
Years of Service
User Offline
Joined: 24th Jan 2019
Location: Poland
Posted: 6th Jan 2021 00:45 Edited at: 6th Jan 2021 00:45
PM
JC LEON
14
Years of Service
User Offline
Joined: 22nd Apr 2010
Location:
Posted: 6th Jan 2021 22:06
Quote: "https://forum.game-guru.com/thread/222310#msg2636069"


thanks mate
PC 1 Specs:
AMD RYZEN 2600 SIX CORE @3,70, 64GB RAM DDR4 2400, M/B GIGABYTE AX370
SVGA NVDIA 1660GTX 6GB , SSD M.2 TRANSCEND S110 1TB, 1X HDD SEAGATE BARRACUDA 4TB, 1X HDD TOSHIBA 2TB



PC 2 Specs:
AMD QUADCORE 880K @4.5GHZ, 32GB RAM DDR3 1600, M/B ASUS A88XM-PLUS
SVGA RADEON R9 380 4GB , SSD KINGSTON A400 1TB, 2X HHD SEAGATE BARRACUDA 4TB
PM
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 7th Jan 2021 14:36 Edited at: 7th Jan 2021 14:37
I'm still surprised users are sill making climbing ladder scripts, this was done like forever ago. I find that there are so many old subjects being recycled ... hence my have a = it's a circle , meaning a circle is like a loop, meaning, ever repeating etc etc
Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++ VS2019, SQL, PL-SQL, JavaScript, HTML, Three.js, others
Hardware: ULTRA FAST Quad Core Gaming PC Tower WIFI & 16GB 1TB HDD & Win 10 (x64), Geforce GTX1060(3GB). Dell Mixed Reality VR headset, Aerodrums 3D
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Jan 2021 17:31
Quote: "I'm still surprised users are sill making climbing ladder scripts, this was done like forever ago. I find that there are so many old subjects being recycled ... hence my have a = it's a circle , meaning a circle is like a loop, meaning, ever repeating etc etc"

that could be said about making games in general - nothing wrong with trying to create something that fits your own style/requirements
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 7th Jan 2021 22:53
Circles and Rings are Boring?
But that's what makes the world go a--round- It's not flat!
I was thinking donut anyhow- too bad it's not.

Anyhow BOTR-- I need some help, looking for info on this matter:
Entity is set to Static as default // there is no [-Static-] selection in properties panel //
// I cannot use it [-dynamic-] in that condition! //
**This is some kind of voodoo setting in .fpe I'm sure- but what?**
What setting in .fpe to change? What I've tried so far hasn't worked!

Been looking through the forums, haven't found it, but surely it's been posted somewhere-
if I knew where.... so any ideas? Thanks!
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 8th Jan 2021 11:00
can use the extract and press Y when it is attached to the mouse to quickly toggle it or set
defaultstatic = 1
1 = static
0 = not static (dynamic)
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 8th Jan 2021 20:25
Ahhh... keep forgetting that! 'y' for static / dynamic...
Thanks.
There was no listing for "defaultstatic " in .fpe -- which I was looking for.
I will try to remember these tricks for next time.

This object came from a standard DLC, so don't know why it was ever
set for excluding the static/ dynamic option in the properties window--
I can't agree with that. Especially now- it's a new day and time.
EVERYTHING is dynamic!
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 9th Jan 2021 09:55
Quote: "EVERYTHING is dynamic! "

Not here and not today, here everything is floating, quite foggy here, can't see the neighbor's house. LOL
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 9th Jan 2021 10:59
i think characters get the option removed in the editor by default - probably a minor performance thing - is it marked as ischaracter = 1 in the fpe?
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Login to post a reply

Server time is: 2024-12-22 02:04:28
Your offset time is: 2024-12-22 02:04:28