Page 3 of 3

Re: Lua question

Posted: Fri Jan 18, 2008 1:57 pm
by Eagle Eye
I dont now... I think i just should give up my project, i searched to long for this
This is my script now: i know the problem in game but dont now how to fix it in script
Hidden/Spoiler:
ActivateRegion("forcevehiclereg")
local VehspawnNum = 1
local VehspawnMaxNum = 11

testfunction = OnEnterRegion(
function(region, player)
if IsCharacterInRegion(player, "forcevehiclereg") and VehspawnNum <= VehspawnMaxNum then
EnterVehicle(player, "Vehspawn" .. VehspawnNum)
VehspawnNum = VehspawnNum + 1
end
if IsCharacterInRegion(player, "forcevehiclereg") and VehspawnNum > VehspawnMaxNum then
VehspawnNum - VehspawnMaxNum
EnterVehicle(player, "Vehspawn" .. VehspawnNum)
VehspawnNum = VehspawnNum + 1
end
end,"forcevehiclereg"
)

Re: Lua question

Posted: Sat Jan 19, 2008 5:09 pm
by [RDH]Zerted
Eagle Eye wrote:I dont now... I think i just should give up my project, i searched to long for this
This is my script now: i know the problem in game but dont now how to fix it in script
Hidden/Spoiler:
ActivateRegion("forcevehiclereg")
local VehspawnNum = 1
local VehspawnMaxNum = 11

testfunction = OnEnterRegion(
function(region, player)
if IsCharacterInRegion(player, "forcevehiclereg") and VehspawnNum <= VehspawnMaxNum then
EnterVehicle(player, "Vehspawn" .. VehspawnNum)
VehspawnNum = VehspawnNum + 1
end
if IsCharacterInRegion(player, "forcevehiclereg") and VehspawnNum > VehspawnMaxNum then
VehspawnNum = VehspawnNum - VehspawnMaxNum
EnterVehicle(player, "Vehspawn" .. VehspawnNum)
VehspawnNum = VehspawnNum + 1
end
end,"forcevehiclereg"
)
I'm not completely sure what you are trying to do, but I fixed a bug in your code. Its in red in the quoted setion.

I've never done much with vehicle spawns. So the vehicle object is the spawn point's name with a number after it. That number starts at 1 and continues to the max amount of vehicles that that spawn point can spawn. Is this correct? However, using CreateEntity() you can create a vehicle, but give it any name you want. Hmmm, I might create another utility script (like teleport.lua) if a few people want one.

Re: Lua question

Posted: Sun Jan 20, 2008 5:08 am
by Eagle Eye
[RDH]Zerted wrote:
Eagle Eye wrote:I dont now... I think i just should give up my project, i searched to long for this
This is my script now: i know the problem in game but dont now how to fix it in script
Hidden/Spoiler:
ActivateRegion("forcevehiclereg")
local VehspawnNum = 1
local VehspawnMaxNum = 11

testfunction = OnEnterRegion(
function(region, player)
if IsCharacterInRegion(player, "forcevehiclereg") and VehspawnNum <= VehspawnMaxNum then
EnterVehicle(player, "Vehspawn" .. VehspawnNum)
VehspawnNum = VehspawnNum + 1
end
if IsCharacterInRegion(player, "forcevehiclereg") and VehspawnNum > VehspawnMaxNum then
VehspawnNum = VehspawnNum - VehspawnMaxNum
EnterVehicle(player, "Vehspawn" .. VehspawnNum)
VehspawnNum = VehspawnNum + 1
end
end,"forcevehiclereg"
)
I'm not completely sure what you are trying to do, but I fixed a bug in your code. Its in red in the quoted setion.

I've never done much with vehicle spawns. So the vehicle object is the spawn point's name with a number after it. That number starts at 1 and continues to the max amount of vehicles that that spawn point can spawn. Is this correct? However, using CreateEntity() you can create a vehicle, but give it any name you want. Hmmm, I might create another utility script (like teleport.lua) if a few people want one.

What i try to do is:
place a fixed amound (like 11) of vehicles (vehspawns) in a trade federation droid control ship (space). If a player or a AI unit spawns in a specified cp (I use region) then he has to spawn into a vehicle (ex: vehspawn1). When the vehicle is already used by another, he just spawn into the next available vehicle (ex:vehspawn2) etc... The vehspawnnum is what I think the actual counting number for spawning.
So I would like that they keep spawning into vehicles until the vehspawnmaxnumber is reached (11 in my case). Above 11, the vehspawnnumber should be reset to 1, so that spawning can continue to go on from 1 to 11 (looping).

The problem at this time is that, if the vehspawnmaxnum (11) is reached, then the vehspawnnum does not reset to 1, but just continues counting further (12, 13,...). So the vehspawnmaxnum doesn't work! As a result, once above 11, the game doesnt find vehspawn12, so the game crashes.


Can you give me the loop for resetting the vehspawnnum to 1 once vehspawnnum reached vehspawnmaxnum (11)?

Re: Lua question

Posted: Sun Jan 20, 2008 11:20 am
by Teancum
Try this:
Hidden/Spoiler:
ActivateRegion("forcevehiclereg")
local VehspawnNum = 1
local VehspawnMaxNum = 11

testfunction = OnEnterRegion(
function(region, player)
if IsCharacterInRegion(player, "forcevehiclereg") and VehspawnNum <= VehspawnMaxNum then
EnterVehicle(player, "Vehspawn" .. VehspawnNum)
VehspawnNum = VehspawnNum + 1
else if IsCharacterInRegion(player, "forcevehiclereg") and VehspawnNum > VehspawnMaxNum then
VehspawnNum = 1
EnterVehicle(player, "Vehspawn" .. VehspawnNum)
VehspawnNum = VehspawnNum + 1
end
end,"forcevehiclereg"
)
I changed the second section into another conditional rather than ending the function. Now if it's 1-11 it'll run the first, otherwise [using else if] it will first reset VehspawnNum to 1, then run code.

Re: Lua question

Posted: Sun Jan 20, 2008 12:37 pm
by Eagle Eye
it still crash... :( but what i found is when i tried to start the swbf2 pc server to see the logfile, he load and crash.

This is the bfront2.log file:
Hidden/Spoiler:
Opened logfile BFront2.log 2008-01-20 1732
ingame stream movies\crawl.mvs

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(857)
Lua ReadDataFile: Could not open sound\shell.lvl
prev = none iLastPage = nil
prev = texture iLastPage = 1
prev = texture iLastPage = 2
prev = texture iLastPage = 3
ifs_legal.Exit
ifs_autonet dedicated
AutoNet Main
AutoNet Multi
AutoNet Gamespy
AutoNet multi main
AutoNet Server
AutoNet Game Options
Updating Lobby and attempting to Launch

Message Severity: 2
.\Source\HUDElementBitmap.cpp(380)
HUD BitmapElement unable to find texture hud_target_hint_offscreen

Message Severity: 2
.\Source\HUDElementBitmap.cpp(380)
HUD BitmapElement unable to find texture hud_target_hint_offscreen

Message Severity: 2
.\Source\HUDElementBitmap.cpp(380)
HUD BitmapElement unable to find texture btn_directional_pad_LR

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(857)
Lua ReadDataFile: Could not open sound\spa.lvl;spa2cw

Message Severity: 2
.\Source\EntityGeometry.cpp(1058)
Entity "com_weap_veh_fly_guided_rocket_" unknown terrain collision "p_front_sphere"

Message Severity: 2
.\Source\EntityGeometry.cpp(1073)
Entity "com_weap_veh_fly_guided_rocket_" unknown vehicle collision "p_front_sphere"

Message Severity: 2
.\Source\EntityGeometry.cpp(1065)
Entity "com_weap_veh_fly_guided_rocket_" unknown building collision "p_front_sphere"

Message Severity: 2
.\Source\EntityGeometry.cpp(1051)
Entity "com_weap_veh_fly_guided_rocket_" unknown targetable collision "CollisionMesh"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (rep1_inf_pc_com_hostile_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (rep1_inf_pc_com_bacta_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (rep1_inf_pc_com_mechanic_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (rep1_inf_pc_com_ammo_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (rep1_inf_pc_com_transport_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (rep1_inf_pc_com_backup_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (rep1_inf_pc_com_clear_area_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (rep1_inf_pc_com_defend_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\FLEffect.cpp(214)
FLEffect::Read: duplicate effect class name (787b2928)!

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (cis1_inf_pc_com_hostile_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (cis1_inf_pc_com_bacta_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (cis1_inf_pc_com_mechanic_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (cis1_inf_pc_com_ammo_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (cis1_inf_pc_com_transport_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (cis1_inf_pc_com_backup_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (cis1_inf_pc_com_clear_area_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (cis1_inf_pc_com_defend_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\FLEffect.cpp(214)
FLEffect::Read: duplicate effect class name (5f518933)!

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (cis1_inf_pc_com_hostile_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (cis1_inf_pc_com_bacta_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (cis1_inf_pc_com_mechanic_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (cis1_inf_pc_com_ammo_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (cis1_inf_pc_com_transport_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (cis1_inf_pc_com_backup_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (cis1_inf_pc_com_clear_area_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\VOHelper.cpp(183)
VOSound (cis1_inf_pc_com_defend_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
.\Source\EntityBuilding.cpp(695)
Building missing explosion "cis_bldg_boxturret_exp"

Message Severity: 2
.\Source\EntityBuilding.cpp(695)
Building missing explosion "cis_bldg_boxturret_exp"

Message Severity: 2
.\Source\EntityBuilding.cpp(695)
Building missing explosion "rep_bldg_boxturret_exp"

Message Severity: 2
.\Source\EntityBuilding.cpp(695)
Building missing explosion "rep_bldg_boxturret_exp"

Message Severity: 3
.\Source\Weapon.cpp(1719)
Weapon "imp_weap_fly_tiefighter_sc_cann" missing ordnance 0.000000 "imp_weap_fly_tiefighter_cannon_ord"

Message Severity: 2
.\Source\EntityGeometry.cpp(1058)
Entity "all_fly_n1" unknown terrain collision "collision_n1"

Message Severity: 2
.\Source\EntityGeometry.cpp(1073)
Entity "all_fly_n1" unknown vehicle collision "collision_n1"

Message Severity: 2
.\Source\EntityGeometry.cpp(1065)
Entity "all_fly_n1" unknown building collision "collision_n1"

Message Severity: 2
.\Source\GameObject.cpp(978)
Too many damage effects specified for gameobject [all_fly_n1]

Message Severity: 2
.\Source\GameObject.cpp(978)
Too many damage effects specified for gameobject [all_fly_n1]

Message Severity: 2
.\Source\GameObject.cpp(978)
Too many damage effects specified for gameobject [all_fly_n1]

Message Severity: 3
.\Source\Explosion.cpp(171)
Explosion base class "com_weap_inf_sonic_blaster_hidden_exp" not found

Re: Lua question

Posted: Sun Jan 20, 2008 2:01 pm
by Teancum
Message Severity: 3
.\Source\Explosion.cpp(171)
Explosion base class "com_weap_inf_sonic_blaster_hidden_exp" not found

That's what's causing your crash.

Re: Lua question

Posted: Sun Jan 20, 2008 2:30 pm
by Eagle Eye
ok.. how to fix it?

I found "com_weap_inf_sonic_blaster_hidden_exp.odf" in C:\BF2_ModTools\assets\sides\Common\odf, do i need to add the odf into C:\BF2_ModTools\data_BON\Sides\Common\odf?

EDIT: i copy common folder out C:\BF2_ModTools\assets\sides to C:\BF2_ModTools\data_BON\Sides so got the "com_weap_inf_sonic_blaster_hidden_exp.odf" now

EDIT2:
Teancum wrote:Try this:
Hidden/Spoiler:
ActivateRegion("forcevehiclereg")
local VehspawnNum = 1
local VehspawnMaxNum = 11

testfunction = OnEnterRegion(
function(region, player)
if IsCharacterInRegion(player, "forcevehiclereg") and VehspawnNum <= VehspawnMaxNum then
EnterVehicle(player, "Vehspawn" .. VehspawnNum)
VehspawnNum = VehspawnNum + 1
else if IsCharacterInRegion(player, "forcevehiclereg") and VehspawnNum > VehspawnMaxNum then
VehspawnNum = 1
EnterVehicle(player, "Vehspawn" .. VehspawnNum)
VehspawnNum = VehspawnNum + 1
end
end,"forcevehiclereg"
)
I changed the second section into another conditional rather than ending the function. Now if it's 1-11 it'll run the first, otherwise [using else if] it will first reset VehspawnNum to 1, then run code.
Thanks Teancum, the crash is gone and ur script works exepts one thing:
When vehspawnnum = 12 then the unit spawn into vehspawn1 (like u said in script)also when its already in use by another
so then, every time i spawn, i spawn into vehspawn1 at its not counting further if its already used

Code: Select all

else if IsCharacterInRegion(player, "forcevehiclereg") and VehspawnNum > VehspawnMaxNum then
VehspawnNum = 1
i should create some loop/ruturn function so the vehspawn reset from 12 to 1, and count further from 1 to 11 instead of using VehspawnNum = 1