Q) I've started by copying the script from the demo and saved as an external script inside my projects folder. When I try to apply it, it doesn't work. It only works if I add it as microscript. I've tried to change the VehID variable to 5, which is the ID of the entity, but nothing happens... what should I do to use external scripts in a Physx Vehicle?
Q) There are some settings in the script which are the same as in the .car file. Do they overwrite the original seetings?
Q) I've noticed that there's no absolute nor relative paths to the files linked in the script... does that mean that all the resources must have a different name? Does the script search for resources outside the Assets Library as well?
SolarPortal wrote:But before we do, did you by any chance add the external script to your resources?
Hi, thanks for the quick reply and lots of info, slowly I'm getting the basics..
SolarPortal wrote:If you dont mind me asking, but which vehicle file exactly was it you copied from? as i would love to replicate this myself and hopefully find and fix any remaining issues with the external script.
function onInit(objID)
obj = objID;
end
function postInit()
sky.setVar("Vehicle_ParticleType", "asphalt");
vehID = vehicle.getVehicleID(obj, "");
createSoundData();
createParticleData(sky.getVar("Vehicle_ParticleType"));
isPlayer = vehicle.isPlayer(vehID);
sky.lprint("LUA: vehID!"..vehID);
sky.lprint("LUA: isPlayer!"..isPlayer);
if(isPlayer == 1)then
sound.play3DSound( lowSound_ID , 0, 0, 0 );
sound.play3DSound( highSound_ID , 0, 0, 0 );
sound.play3DSound( skidSound_ID, 0, 0, 0);
end
--sky.lprint("LUA: VEHICLE Script Active!");
end
SolarPortal wrote:Edit: When editing the .car file, you may find this document helpful: http://www.chi-ad.com/DokuWiki/doku.php/english_manual:res_vehiclesetup
ribbon.setFadeColour(ribbonID, 0.0, 0.0, 0.0, 0.0);
ribbon.setInitialColour(ribbonID, 1.0, 1.0, 1.0, 0.0);
SolarPortal wrote:Have you tried it with an xbox controller or something? as that script was programmed with joypad also.
SolarPortal wrote:As for the ribbons, are you using your own texture? There was an issue on the ribbon trail back then, that the texture had to be 1D.
This means you can have a 128 texture but it can only be 1px height. Check out the ribbon texture default to see what i mean It might be in the data folder.
SolarPortal wrote:Plus, keep up the good work! I look forward to seeing the final game
So I'm trying to port my game to Skyline and see how far I can get.
ribbon.setInitialColour(ribbonID, 1.0, 0.0, 0.0, 0.0);
StarFire wrote:Any snags then we will be there to the rescue
SolarPortal wrote:If your tread texture was quite black, then any colour you apply will be dark also. So simply increase the brightness on your texture and then use the code line to change the colour as you expected
SolarPortal wrote:Waiting for the next video now lol
vehicle.followPath(vehID, pathName, throttle);
currentNode = vehicle.followPath(vehID, pathName, throttle);
nodeIndex = 1;
entity.callFn(obj,-9,"updateTracking",nodeIndex); -- -9 is the sceneScript
function updateTracking(vehicleEID, nodeIndex)
lprint("vehicleEID: "..vehicleEID);
lprint("nodeIndex: "..nodeIndex);
end
-- Create the waypoints
for i=0,lastNode,5 do
wpx,wpy,wpz = path.getNodePosition(pathName, i);
nodeYaw = path.getNodeYaw(pathName, i);
waypoint[i] = entity.spawn("node",wpx,wpy,wpz,75,20,0.01);
--entity.setVisible(waypoint[i],0);
entity.setRotation(waypoint[i],0,nodeYaw,0);
if (i == 0) then
entity.setMaterialName(waypoint[i], "node_red");
end
physics.addTrigger(waypoint[i],1);
sky.setVar("wpID",i/5); --set global var for each script
entity.addScript(waypoint[i],"MR_trigger.lua");
end
obj = 0;
wpID = 0;
function onInit(objID)
obj = objID;
wpID = sky.getVar("wpID");
end
function onTrigger_Enter(HitID)
tagname = entity.getTagFromID(HitID);
if (tagname == "player") then
-- set global variables
sky.setVar("Collision",1);
sky.setVar("waypointID",wpID);
sky.lprint("Waypoint: "..wpID); -- <-- HERE IS THE DOUBLE PRINT
end
end
function onUpdate( td )
-- set global variables
sky.setVar("Collision",0);
end
TerrainSize = 1500; --size of the terrain in meters
MapSize = 350; --size of the map in pixels
DotSize = 15; --size of the dot in pixels
MapRatio = TerrainSize/MapSize;
function onUpdate( td )
cx,cy,cz = entity.getPosition(CarID);
final_car_x = (cx/MapRatio)+(MapSize/2)-(DotSize/2);
final_car_z = (cz/MapRatio)+(MapSize/2)-(DotSize/2);
gui.setPosition(guiID,"map_player",final_car_x,final_car_z);
end
<div id="map_container">
<div id="map">
<img src="map_01.dds" style="width: 100%; height: 100%;" />
</div>
<div id="map_player">
<img src="map_player.dds" style="width: 100%; height: 100%;" />
</div>
</div>
#map_container {
position: absolute;
bottom: 0;
width: 350px;
height: 350px;
}
#map {
z-index: 1;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
}
#map_player {
z-index: 2;
position: absolute;
bottom: 0;
left: 0;
width: 15px;
height: 15px;
}
CHA1 2.9 1 7.3 0 0.8 0
CHA2 1.6 0.8 2.5 0 2.7 0
Users browsing this forum: No registered users and 1 guest