How to access classes made in other projects?

Hello.
I want to make a first person shooter game , and i need to access the classes made in the “Shooter game 4.4” content example (source folder) from my project . how can i do this ?
does simply copying the source folder of the “shooter game” project to my project works ?
do i need to compile after ?or it doest not work that way and i need to do something else ? thanks in advance

You can start by copying the source, but you could have problems ‘porting’ the .uasset files over, they will have reference to the source classes and so you have to setup all in the same structure as in the ShooterGame template. I’m preparing a simple python script to create a copy of ShooterGame to use it as a base for other games easier. I hope I can post it next week.

i did whatever i could think of to do this but all failed :confused: . The mentioned script would be really great and appreciated .

would you please notify me via this thread when it is finished ? thanks again

I will upload it today ^^

I just pushed the tool to GitHub: GitHub - Tragnarion/UE4_CopyProject: Simple python tool to copy a sample project like ShooterGame

I still have to add some documentation but if you run it with --help you will see how to use it.

Cheers,
Moss

Thanks a lot . i really appreciate it.

np :smiley: If it have any issues with the tool just let me know ^^

Sorry to bother you again , but i couldnt actually make it work , whatever i do i get syntax error . here is what i do .

i open the “init.py” then Run it . it gives me :


usage: __init__.py -h] -v] -f] -s SOURCE -t TARGET -c COPYRIGHT]
__init__.py: error: the following arguments are required: -s/--source, -t/--target

then i tried typing something along this line in the shell :


-s C:\Unreal Projects\ShooterGame4.4 -t C:\Unreal Projects\MyProject

which gives me syntax error

i also noticed the comments and help texts in the in the “init.py” script . but couldnt actually understand it

lets say :

my source = C:\Unreal Projects\ShooterGame4.4
my target = C:\Unreal Projects\MyProject

What should i do to make it work?
And sorry again, i’m a newbie programmer and never worked with python before.
Thanks.

Maybe use quotes for the path argument with spaces?

i also tested with " " , ] , {} , ’ ’ . still syntax error .

You need to pass arguments to the script. Try "python init.py -s ‘C:\Unreal Projects\ShooterGame4.4’ -t ‘C:\Unreal Projects\MyProject’ "

Still gives me syntax error . i also tried putting the path into " " instead of ’ ’ , still the same . and thanks for the responses

Post the error. Maybe the script doesn’t work for your python version or you could be missing a module.

This is the picture of the error . the only thing it says is "syntax error " . i am using the latest version of python which is 3.4.1 , could this be the problem ?
746fbb90955dfec497f6579fed1cb583ac16ac66.jpeg

i’m guessing i should also specify the path for the init.py script , if i’m right , how should i do it ?

lets say the init.py is located in "C:\Downloads\UE4_CopyProject-master\copyproject " . so how should i go about saying run this scrip which is located there with the specified arguments ? thanks

EDIT :i could run it from the windows command line < cmd > and pass the arguments to it . now it gives me another error which is :

aeeada1dfe8764ea5503b001f0ec85061a833c43.jpeg

Now as you can see , it says my source path is not valid , but it is valid .
In the script i think it is searching for the .uproject file which is actually in the "…/ShooterGame/data " folder , but i also tried with this address and it still says my source path is not valid . anyone knows what seems to be the problem here ?

Yes it checks that the .uproject file is in the root of the source folder. Did that change for ShooterGame? If you would like to change that just comment the lines 124 to 127 using the # character.

The invalid syntax error came up because you used the python interpreter as a command-line, this will not work because in the python interpreter you have to input valid python and not a command. The interpreter is like programming in real-time :smiley:

I will check the latest version of the ShooterGame sample and see if I make a fix for the issue. I will also submit a release with a pre-compiled version for windows.

Cheers,
Moss

I have just downloaded the ShooterGame sample and then I created a project from it. You must the use that project as the source for yours. Also make sure you do not use the word Shooter within your target folder (the tool will then confuse some folders :D).

I will upload an updated version and the pre-compiled binary as a release.

Here you got the pre-compiled one: Release Release 0.2 · Tragnarion/UE4_CopyProject · GitHub

Just make sure to use a project as the source, in your case you where using the raw content the launcher downloaded. Once you have downloaded the stuff from the launcher you have to create a project from it, then you use that project as a template.

Cheers,
Moss

Thanks again “Moss” .
I’m downloading the ShooterGame again with launcher to see if that solves my problem .