Jump to content

my problem with dimensions


BinSlayer1

Recommended Posts

Hi,

I'm trying to make this script for a race server. Basically I want the players to be split in half. Some of them remain in the original dimension, the rest go into another one. I want the map to be the same for both dimensions. So far I've been able to make the script copy all objects from the map that gets loaded to that specific dimension and to also create the 2 teams. Now I want the race pickups from the map to be copied there too. I've tried using "createPickup" but it seems this function isn't designed for race (nitro, vehicle change, health pickups). I'm also trying to copy the checkpoints, but the only functions available are marker ones. And checkpoints cannot be modified by using marker functions :S

i've made this:

checkpoints = getElementsByType("checkpoint") 
        for theKey, checkpoint in ipairs(checkpoints) do  
            cx, cy, cz = getElementPosition(checkpoint) 
            newcheck = createMarker(cx,cy,cz) 
            setElementDimension(newcheck, 1) 
        end     

The above is triggered onMapStarting. But when I run this script, markers are indeed created in that dimension all around the map exactly where the checkpoints should be, but they are generated all at once which isn't exactly good and I can't even make these markers the same size as the checkpoints as there is no function that retrieves checkpoints' size.

This was the first idea. The other one was using cloneElement() but this wouldn't generate any checkpoints nor error codes in debugging.

So can I get some help with this? copying the pickups and the checkpoints from one dimension to another? (manually changing each map's meta.xml isn't very smart either)

PS: What's weirder is that if I go through where the checkpoints should be (even though I dont see them in the other dimension), I still trigger them.. So I can finish a race in another dimension even if my client doesn't see the CPs, or only sees those markers that I created

Link to comment

race pickups are not standard pickups. they are custom objects with collision spheres around it.

just look how pickups are loaded/created in race resource - and make them load into another dimension too

for checkpoints - that will be harder - as player have to go through all of them, and if you will clone them - it may get broken. you will have to rewrite some parts of race resource i think.

Link to comment

and if you will clone them - it may get broken.

if i clone them, not only could they be broken, but they don't even show up :/

I used this:

  
   checkpoints = getElementsByType("checkpoint") 
          for theKey, checkpoint in ipairs(checkpoints) do 
             newcheck = cloneElement(checkpoint) 
             setElementDimension(newcheck, 1) 
           end     

You could try changing dimension of the elements client-side. Every client will only see the changes locally. You won't need to copy elements.

I don't really understand :S

Link to comment

All changes you are making on client scripts - are visible only on that client. Changing dimension of checkpoints/pickups on clientside - will make these changes only for current player which is running script. This is very good idea. Probably the best thing you can do.

You need to understand the difference between clientside and server side.

Link to comment

alright

I'm running this clientside:

addEventHandler("onClientMapStarting", getRootElement(), 
function() 
    checkpoints = getElementsByType("checkpoint") 
    for theKey, check in ipairs(checkpoints) do  
        setElementDimension(check, 1) 
    end 
end 
)     

doesn't return any error but doesn't work either

I tried using some outputChatBox to see if it detects the Checkpoints themselves.. it worked nicely

there's probably something wrong with (the way I'm using) the setElementDimension function

Link to comment

Because "checkpoint" isn't visible mta element. (search wiki for "element",.. really do it, i know most ppl are ignoring wiki at all, but trust me and do it) It's custom one, and while map is loading race resource is creating markers in place where checkpoints are set in map file. Try to set all markers dimension but i think it won't be so easy, and you will have to modify race resource a lot.

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...