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
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
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
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:
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:
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:
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