| Blockland Forums > Modification Help |
| Vehicle Spawning |
| << < (2/6) > >> |
| Desolation:
From what I see the following have issues. %vehicle.CostWood/Steel isn't defined. You have a return; before messageclient. Try using the echo("Stuf"); function to figure out where the scripts stops. |
| heedicalking:
--- Quote from: Desolation on September 19, 2010, 03:50:57 PM ---From what I see the following have issues. %vehicle.CostWood/Steel isn't defined. You have a return; before messageclient. Try using the echo("Stuf"); function to figure out where the scripts stops. --- End quote --- It's defined in the vehicle's datablock. I fixed that I used it to figure out that the problem is here: %CostWood = %vehicle.CostWood; %CostSteel = %vehicle.CostSteel; if(%Costwood >= 1 || %Coststeel >= 1 The defining doesn't want to work for some reason bow that I switched functions. I don't know if %vehicle is now a datablock, and object, a name, or what. |
| phflack:
what about determining the cost of the vehicle from it's size/if it can fly or not? |
| Desolation:
--- Quote from: heedicalking on September 19, 2010, 04:24:06 PM ---It's defined in the vehicle's datablock. I fixed that I used it to figure out that the problem is here: %CostWood = %vehicle.CostWood; %CostSteel = %vehicle.CostSteel; if(%Costwood >= 1 || %Coststeel >= 1 The defining doesn't want to work for some reason bow that I switched functions. I don't know if %vehicle is now a datablock, and object, a name, or what. --- End quote --- Try using %vehicle.dump(); to search for the %vehicle.CostWood/Steel values. Although I usually use global variables to define costs for items. This would only apply if %vehicle was indeed a datablock. --- Code: ---//Put this somewhere other then inside the function. $Heed::VehicleCost["VehicleDatablockName"] = "5 10"; //First is Wood, Second is Steel //In the BuyVehicle function. %a = getWord($Heed::VehicleCost[%vehicle],0); %b = getWord($Heed::VehicleCost[%vehicle],1); if(%a !$= "") { if(%client.VariableStuff1 >= %a && %client.VariableStuff2 >= %b) { //DoStuff } else { echo("DERP NOT ENOUGH STUFZ"); } } --- End code --- |
| heedicalking:
That may be useful later on. The problem is I just don't know exactly what works with that function at all. There's spawnvehicle, setvehicle, respawnvehicle, and tons of other stuff that I have no idea which does which. Making it set the vehicle back to none if it doesn't work right. Making it check for errors in vehicle spawning. Making it so when the vehicle dies it gets set to "none" There isn't a lot of references because vehicles seem to be a neglected subject for scripting. The only resource I found was the vehicle events which only gave me the args. |
| Navigation |
| Message Index |
| Next page |
| Previous page |