Jump to content

moveObject


PhantomDamn

Recommended Posts

hola queria saber si

moveObject 

fue reemplazado en las nuevas versiones

tengo problemas con las gatemaker .. exactamente en estas lineas:

function moveBack(index, x,y,z, raising) 
    if status[index] == 1 then 
        status[index] = 2 
        moveObject ( gateList[index], 2000, x,y,z, gateListMoveTorX[gateIndex],gateListMoveTorY[gateIndex],gateListMoveTorZ[gateIndex],rx,ry,rz ) 
        setTimer ( resetTimer, 2000, 1, index ) 
    end 
end 

:(

Link to comment
  
--Donde tienes definido esto? 
gateListMoveTorX 
gateIndex 
gateList 
  
--Tampoco se si esto este bien implementado 
setTimer ( resetTimer, 2000, 1, index ) 
  
--Se supone que donde pusiste resetTimer tendría que ir una función  
  

la verdad no entendí lo que quisiste hacer.

Link to comment

mira: este es el script completo.

gateList        = {} 
  
gateListMoveToX = {} 
gateListMoveToY = {} 
gateListMoveToZ = {} 
  
gateListMoveTorX = {} 
gateListMoveTorY = {} 
gateListMoveTorZ = {} 
  
shapes          = {} 
team            = {} 
temp            = {} 
  
status          = {} -- 0 = not moving. 1 = moving to open. 2 = moving to close 
  
function checkClass(hitElement, matchingDimension) 
  
    if ( getElementType(hitElement) == "vehicle" ) then 
        hitElement = getVehicleController(hitElement) 
    end 
  
    for i=0,#gateList do  
        local name = getTeamName(getPlayerTeam(hitElement)) 
        if(name == false) then 
            name = "false" 
        end 
        if ( name == team[i] or name == "false") then  
            detection = isElementWithinColShape ( hitElement, shapes[i] ) 
            if detection == true then  
                move(i, false) 
            end 
        end 
    end 
end 
  
  
function loadup(startedResource) 
    gates = xmlLoadFile ( "gates.xml" ) 
    count = xmlNodeGetChildren(gates) 
  
    for i=1,#count do 
        local gate = xmlFindChild ( gates, "gate", i-1 ) 
        local attributes = xmlNodeGetAttributes ( gate ) 
        for name,value in pairs ( attributes ) do 
                temp["" .. name .. ""] = value 
        end 
  
     
            gateList[i]  = createObject(temp["objectID"], temp["x"], temp["y"], temp["z"], temp["rx"], temp["ry"], temp["rz"]) 
            gateListMoveToX[i] = temp["x2"] 
            gateListMoveToY[i] = temp["y2"] 
            gateListMoveToZ[i] = temp["z2"] 
  
            gateListMoveTorX[i] = temp["rx2"] 
            gateListMoveTorY[i] = temp["ry2"] 
            gateListMoveTorZ[i] = temp["rz2"] 
            outputDebugString("" .. temp["objectID"] .. "") 
            shapes[i] = createColRectangle(temp["collisionx"], temp["collisionY"], temp["collisionZ"], temp["collisionSize"],temp["collisionSize"])  
            team[i]   = temp["team"] 
            setElementInterior(gateList[i], temp["interiorID"]) 
            status[i] = 0 
            addEventHandler ( "onColShapeHit", shapes[i], checkClass ) 
  
    end 
  
  
    xmlUnloadFile ( gates ) 
end 
  
function move(gateIndex, rotate) -- 0 = not moving. 1 = moving to open. 2 = moving to close 
    outputDebugString("moving..") 
    x,y,z = getElementPosition(gateList[gateIndex]) 
    rx,ry,rz = getObjectRotation(gateList[gateIndex]) 
    if status[gateIndex] == 0 then 
        moveObject ( gateList[gateIndex], 2000, gateListMoveToX[gateIndex], gateListMoveToY[gateIndex],gateListMoveToZ[gateIndex]) 
        status[gateIndex] = 1 
        setTimer ( moveBack, 3000, 1,gateIndex, x,y,z,rx,ry,rz, raising ) 
    end 
end 
  
function moveBack(index, x,y,z, raising) 
    if status[index] == 1 then 
        status[index] = 2 
        moveObject ( gateList[index], 2000, x,y,z, gateListMoveTorX[gateIndex],gateListMoveTorY[gateIndex],gateListMoveTorZ[gateIndex],rx,ry,rz ) 
        setTimer ( resetTimer, 2000, 1, index ) 
    end 
end 
  
function resetTimer(index) 
    status[index] = 0 
end 
  
  
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), loadup ) 

son las gatemaker.. es que cuando abren no cierran despues quedan bug.

Link to comment
  • Recently Browsing   0 members

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