Jump to content

Editing Gamemodes to learn..


stoneymedia

Recommended Posts

Hi all, new here, so be gentle :)

Been trying to start to learn this lua stuff by looking at some of the already complete gamemodes and trying small edits locally etc.

Ive been looking at the "hay" gamemode and have worked some things out like number of levels and hay blocks left to right etc, but im now stuck.

The invisible "kill barrier" is confusing me. Removing any reference to it doesn't work, as you are still killed at some point when walking away.. Should I be looking at increasing an option rather than removing text from the hay.lua file?

Also, If I wanted to move the hay (as a whole) to be positioned in an entirely different place on the map, Im guessing I would need to place coordinates somewhere..

Any ideas please?

Thank you all :)

Link to comment
I imagine you can't move Hay due to the maths involved. Well, you could, but it would be hard work. It's located there as that is the center of GTA with coordinates 0,0 which makes the maths easier...

It wouldn't be difficult though. Just offset the already-calculated-coords and it should work. ( add yours selected place's coords, that's all ).

eg.:

createObject ( 3374, x * -4 + (yourX), y * -4 + (yourY), z * 3 + (yourZ) ) 

Do the same for all of the calculations. It may work, I don't know.

Link to comment

Ah ha! Progress (thanks 50p)

I've managed to add my own coords, so I've now got the hay where I want it to be thanks to your

createObject ( 3374, x * -4 + (yourX), y * -4 + (yourY), z * 3 + (yourZ) ) 

Below where you say

Do the same for all of the calculations.
has me stumped completly!

When I run the gamemode on my MTA server, and connect to it fine, the hay is where I want it to be and ive changed player spawn points to get my guy to spawn near the hay, so thats good, but the hay doesn't moved (because ive not yet edited the calculations I presume)?

The server window reports a series of line errors, which are.. 80, 88, 96, 104, 112, 120, which ive quoted below...

80

    if (move == 0)  and (x ~= 1) and (free[x-1][y][z] == 0) then 

88

    elseif (move == 1) and (x ~= options.x) and (free[x+1][y][z] == 0) then 

96

    elseif (move == 2) and (y ~= 1) and (free[x][y-1][z] == 0) then 

104

    elseif (move == 3) and (y ~= options.y) and (free[x][y+1][z] == 0) then 

112

    elseif (move == 4) and (z ~= 1) and (free[x][y][z-1] == 0) then 

120

    elseif (move == 5) and (z ~= options.z) and (free[x][y][z+1] == 0) then 

Now, im guessing that those are the lines of the calculations which of which some value needs to be changed as advised.. However, im totally stumped as to which. :shock:

Can some cleverer person than me advise me on how to continue?

Id be very greatful! Thank you.

EDIT: Doh! I missed out line 96 too (Updated above)

Link to comment

Hi all, I'm new (as you can tell by the post count :roll: ) and i'm also having a crack at this moving hay... The positioning of hay actually works :D and by looking at those lines he's posted here i've attempted to try changing the "0" figures to the related coordinates, and a couple of other ways but they don't work, just throwing up more errors.

I don't know why it stops when its placed somewhere else, i'm not a maths person :cry:

Throw us both a bone here :oops::D

Link to comment
The invisible "kill barrier" is confusing me. Removing any reference to it doesn't work, as you are still killed at some point when walking away.. Should I be looking at increasing an option rather than removing text from the hay.lua file?

i do not have the script in front of me, but i know it a bit and the killing barrier is solved with a circle around the center of the haystack - just like the player spawns are placed on a circle.

so just edit the radius of this circle and all will be good ;)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...