aaronkirkham / jc4-console-thingy

Spawn vehicles, characters, animals, props and mess with the game in Just Cause 4.
MIT License
70 stars 19 forks source link

REQUEST: any chance to get a teleport ? #11

Closed kktos closed 4 years ago

kktos commented 4 years ago

Hi, if you have access to the coordinate system, could it be possible to move the player to any location ? Thx.

aaronkirkham commented 4 years ago

Hello!

Yea, teleporting is a good idea for a command. I'm just thinking about how that would work, tp [x] [y] [z] or a named list of places of interest, e.g. tp airport?

The [x] [y] [z] version is the quickest, but then there has to be a way to give the players current coordinates to them. Again - pretty simple to do, but do we write their coordinates to the system clipboard so they can ctrl+v them into notepad or something, or just display them on screen as text.

The named list idea means that there'd be a list of coordinates to maintain, and the list itself is pretty subjective as to what qualifies as a place of interest.

Would be nice to know what you had in mind for the command - what were you expecting to type to achieve the teleport?

Thanks

kktos commented 4 years ago

Precisely what you just described ;) Best would be to be able to store the coord in a file, like INI file, for ex (as they are pretty easy to deal with). You can either provide an initialized file or not.

aaronkirkham commented 4 years ago

Ok, I'll experiment with a few things over the weekend and keep you updated in this thread.

kktos commented 4 years ago

Hi Aaron ! Was your WE fruitful ? ;)

aaronkirkham commented 4 years ago

Hi, yes - I got the teleport command added and working, not 100% sure I like the way it works right now, but I think it will be ok.

tp [x] [y] [z] - teleport tp save [name] - write current x/y/z to savedcoords.txt (saved inside jc4 folder) with the given name

Those are the current commands I added and seem to be working well. I was also thinking of adding tp load [name] which would grab the coordinates from the txt file and tp you there.

kktos commented 4 years ago

Excellent. tp < name > should be even better ;) for teleporting to a named location ( tp with 1 parm : [ tp < name > ] - load named location and tp tp with 2 parms: [ tp save < name > ] - save current location tp with 3 parms; [ tp < x > < y > < z > ] - tp to coord )

aaronkirkham commented 4 years ago

Ok, added support for teleporting to named locations and it is working good. I've attached a built version which you can try for yourself. Let me know how it works!

jc4-console-thingy-teleport-test.zip

kktos commented 4 years ago

did a quick test. Works very well ;) Cheers ! Also tried while hanging under the chute to the ground. Worked. Cool ;) But..... there is something missing..... as for spawn, it would be great to have the named locations list available ;)

kktos commented 4 years ago

Also, this is the reason why I was suggesting the use of INI files, if I tried to update a saved point, a new one, duplicate, will be saved. And lost as only the first found will be used.

aaronkirkham commented 4 years ago

The format shouldn't really matter - just the implementation doesn't take those things into account.

I have done a revamp of this whole teleport stuff and it now updates coordinates of existing locations if you try save with the same name. Also added support for showing the named locations from the savedcoords file in the hints list. Will upload another test version for you shortly.

aaronkirkham commented 4 years ago

Here's another version for you to try, added everything from your last messages and a tp delete <name> command to remove locations.

Let me know how it goes for you.

jc4-console-thingy-teleport-test-2.zip

kktos commented 4 years ago

Good job, Mate ;) I'll check it. About INI file, I wasn't talking about the format rather than the windows system calls you have at your disposal. And, by definition, you can't have duplicates in those files. What you did is really good and nice.... but if you have been as lazy as me ;), you would have simply use windows calls ;)

kktos commented 4 years ago

Quick test done. Works pretty well ;) I had to update my coords file with the new format. Once done, we got the list on TAB. Niiiiiice :):) Little side effect though with your changes: the file is only read once, so if I update it while the game is running, the changes won't be seen. Thx very much for your work :)

aaronkirkham commented 4 years ago

Yeah I forgot to mention you will probably need to delete/update the old save file as the format changed a little.

I'm not sure it's worth setting up anything to monitor if the file gets changed or keep re-opening the file when getting a value - I think most people won't be manually editing the file anyway.

I will close this issue now, will be releasing a new version very soon with new features including this!

Thanks