EDIT 2: I have updated the scripts again
EDIT: I have been trying to make a race mission almost identical to L1M7, and I obviously Don't know what I am doing because Lauren already helped me, and I don't want to waste people's time looking through my scripts. But here I am again asking for help. I am much noob.
link for scripts: mega.nz/#F!fk1hzISC!Np6YCxT6yFTaxOgvXaE6Kg
Thanks,
Hipporeno
I need help, AGAIN LUA scripts (CUSTOM MOD)
Posted in Support
Please login to contribute to the conversation.
[deleted user] EDIT 2: I have updated the scripts again
EDIT: I have been trying to make a race mission almost identical to L1M7, and I obviously Don't know what I am doing because Lauren already helped me,
Loren Can you post the decryption key to that link so I can help you out? Or better yet submit it straight to my dropbox here.
Can you post the decryption key to that link so I can help you out? Or better yet submit it straight to my dropbox here.
[deleted user] https://mega.nz/#F!ukUXEYpD!1tW-7kDT7vfQOqIH1Y3HtA
oops, sorry for no key. I am much idiot!
Loren Ok I see a few problems with your scripts.
m1preload.lua
On Line 1 you're loading the mission banner using LoadP3DFile which doesn't really affect anything but its weird and you shouldn&
Ok I see a few problems with your scripts.
m1preload.lua
On Line 1 you're loading the mission banner using LoadP3DFile which doesn't really affect anything but its weird and you shouldn't do it.
m1load.lua
This code on Line 3 is a bit invalid:
Try this code instead:
This loads the car cVan into one of the AI slots, you were specifying a con file for the slot name. Paths to con files aren't a valid slot name so that's part of the problem.
m1info.lua
On Line 8 you're not using AddStageVehicle correctly at all:
You want to try this code:
To break that down a bit:
- cVan: The name of the vehicle specified in the 2nd argument to LoadDisposableCar (for all intents and purposes, its always the same name as the cars p3d file)
- locator2_type3_name: the name of Locator 2 Type 3 you want the car to spawn at. This would generally be in the missions locators file (art\\missions\\level01\\m5.p3d in your m1load.lua)
- NULL: The behaviour of the vehicle. You're activating the vehicle in the following stage so we use NULL here to make it do nothing until activated.
- Missions\\level01\\M5evade.con: The con file you want the vehicle to use. This path is relative to scripts\\cars in your CustomFiles folder (or the games folder if its not a custom file). The con file you use should not call SetDriver, if it does remove it and I'll explain why right below this. It can cause confusion and other issues if you specify one in the con file.
- skinner: The vehicle's driver. This is the proper way to specify a driver for an AI car in a mission. I used skinner here, but you can use whoever you want.
On Line 25 you have the start to an objective which also contains a condition inside it, this isn't particularly valid and it might cause problems if it works at all:
This is easily fixed by taking the code for the condition and moving it outside the objective like this:
On Line 39 you start an objective but never actually close it:
You want to add CloseObjective() after SetCompletionDialog in this case:
That should fix all of the actual problems with the mission. Though I also notice you're not setting the stage message in any of the stages which isn't an actual problem but the mission wouldn't display any text saying what to do in this case.
m1preload.lua
On Line 1 you're loading the mission banner using LoadP3DFile which doesn't really affect anything but its weird and you shouldn't do it.
m1load.lua
This code on Line 3 is a bit invalid:
LoadDisposableCar( "art\\cars\\cVan.p3d","cvan","scripts\\Missions\\level01\\M5evade.con" )
Try this code instead:
LoadDisposableCar("art\\cars\\cVan.p3d","cVan","AI")
This loads the car cVan into one of the AI slots, you were specifying a con file for the slot name. Paths to con files aren't a valid slot name so that's part of the problem.
m1info.lua
On Line 8 you're not using AddStageVehicle correctly at all:
AddStageVehicle("art\\cars\\cVan.p3d","cvan","scripts\\Missions\\level01\\M5evade.con")
You want to try this code:
AddStageVehicle("cVan","locator2_type3_name","NULL","Missions\\level01\\M5evade.con", "skinner");
To break that down a bit:
- cVan: The name of the vehicle specified in the 2nd argument to LoadDisposableCar (for all intents and purposes, its always the same name as the cars p3d file)
- locator2_type3_name: the name of Locator 2 Type 3 you want the car to spawn at. This would generally be in the missions locators file (art\\missions\\level01\\m5.p3d in your m1load.lua)
- NULL: The behaviour of the vehicle. You're activating the vehicle in the following stage so we use NULL here to make it do nothing until activated.
- Missions\\level01\\M5evade.con: The con file you want the vehicle to use. This path is relative to scripts\\cars in your CustomFiles folder (or the games folder if its not a custom file). The con file you use should not call SetDriver, if it does remove it and I'll explain why right below this. It can cause confusion and other issues if you specify one in the con file.
- skinner: The vehicle's driver. This is the proper way to specify a driver for an AI car in a mission. I used skinner here, but you can use whoever you want.
On Line 25 you have the start to an objective which also contains a condition inside it, this isn't particularly valid and it might cause problems if it works at all:
AddObjective("follow","neither") SetObjTargetVehicle("cVan") AddCondition("followdistance") SetFollowDistances(0, 200) SetCondTargetVehicle("cVan") CloseCondition() CloseObjective()
This is easily fixed by taking the code for the condition and moving it outside the objective like this:
AddObjective("follow","neither") SetObjTargetVehicle("cVan") CloseObjective() AddCondition("followdistance") SetFollowDistances(0, 200) SetCondTargetVehicle("cVan") CloseCondition()
On Line 39 you start an objective but never actually close it:
AddObjective("goto") SetDestination("m4_powerplant", "carsphere") SetCompletionDialog("skeleton") SetFadeOut(1.0) ShowStageComplete()
You want to add CloseObjective() after SetCompletionDialog in this case:
AddObjective("goto") SetDestination("m4_powerplant", "carsphere") CloseObjective() SetCompletionDialog("skeleton") SetFadeOut(1.0) ShowStageComplete()
That should fix all of the actual problems with the mission. Though I also notice you're not setting the stage message in any of the stages which isn't an actual problem but the mission wouldn't display any text saying what to do in this case.
[deleted user] Thanks a bunch! I really appreciate the quick response!
Thanks a bunch! I really appreciate the quick response!
[deleted user] I have updated the thread, I am much noob!
I have updated the thread, I am much noob!
Gibstack I would imagine that having 3 of those SetStageAIRaceCatchupParams could cause problems Try removing or commenting out 2 of those lines.
http://i.imgur.com/EQc6BEp.png
I would also check to make
I would imagine that having 3 of those SetStageAIRaceCatchupParams could cause problems Try removing or commenting out 2 of those lines.
I would also check to make sure the locator I have selected exists, I looked in the vanilla l1m7 for reference and noticed that it's commented out.
While this shouldn't break anything, you don't need anything in the selected line other than AddObjective("getin"); the "neither" part is unnecessary as far as I'm aware. Same thing for the race objective; you only need AddObjective("race"); and not the "both" part.
In m2load, you don't need to load characters in a mission p3d. I'm not sure if this would cause issues but I think it does so definitely remove it.
Hopefully this will fix your issue.
I would also check to make sure the locator I have selected exists, I looked in the vanilla l1m7 for reference and noticed that it's commented out.
While this shouldn't break anything, you don't need anything in the selected line other than AddObjective("getin"); the "neither" part is unnecessary as far as I'm aware. Same thing for the race objective; you only need AddObjective("race"); and not the "both" part.
In m2load, you don't need to load characters in a mission p3d. I'm not sure if this would cause issues but I think it does so definitely remove it.
Hopefully this will fix your issue.
[deleted user] The Van's AI still won't do anything, and the game crashes after 10 seconds of the van not moving. Just to ask, how can I make the mod output to a console to see what I'm doing wrong.
The Van's AI still won't do anything, and the game crashes after 10 seconds of the van not moving. Just to ask, how can I make the mod output to a console to see what I'm doing wrong.
Gibstack There's a mod in the mod list called "Console". Enable it, right click it, click Settings, tick Include Game, Include Mods, and Include Hacks and the 4th option if you want.
http://prn
There's a mod in the mod list called "Console". Enable it, right click it, click Settings, tick Include Game, Include Mods, and Include Hacks and the 4th option if you want.
Aha! Don't know how I overlooked this. So you can fix this in a couple different ways:
-Add the stage vehicle in the "getin" stage, replace "race" in AddStageVehicle with "NULL", then activate it once you start the race.
Or,
-Take the ActivateVehicle line and remove it.
Or,
-Add the vehicle in the getin stage, and get rid of the ActivateVehicle line.
The first option will have the van spawn, you enter your car, then he starts moving and you race. The second option will have the car appear and start racing right as you enter your car, and the third option will have the car start immediately after you begin playing the mission. Any should work.
Aha! Don't know how I overlooked this. So you can fix this in a couple different ways:
-Add the stage vehicle in the "getin" stage, replace "race" in AddStageVehicle with "NULL", then activate it once you start the race.
Or,
-Take the ActivateVehicle line and remove it.
Or,
-Add the vehicle in the getin stage, and get rid of the ActivateVehicle line.
The first option will have the van spawn, you enter your car, then he starts moving and you race. The second option will have the car appear and start racing right as you enter your car, and the third option will have the car start immediately after you begin playing the mission. Any should work.
[deleted user] the van still doesn't do anything, or the game crashes. I have updated the scripts and will re-upload them sometime today.
the van still doesn't do anything, or the game crashes. I have updated the scripts and will re-upload them sometime today.