Help - Search - Members - Calendar
Full Version: question on if / then usage
Battlefield SinglePlayer Forum > Main > BF42 and BFV Discussion > AI Editing and Mod Support
korben_dallas
I remember the DCX guys talking about using If Then statements to test if a certain map is loaded and change skins on vehilces accordingly. In a more general sense, this should be able to be applied to any object? Vehicles and weapons only?

How soon and where would this need to happen? In the map's init.con?

I think I have down the basic idea:

1. Set a variable during map load but before object load
2. If / then statement in object runs during object load and routes to the appropriate conditonal code.

Also, are Case statements supported? Or do you have to use nested if / then / else?

Dnamro
Four Cents is the resident expert on conditionals. Case statements do not seem to be supported, so that means nested if then else statemenst.

Check out his thread:

http://dynamic.gamespy.com/~bf42players/in...?showtopic=1236

FourCentsShy
You can simulate the case statement with the if .. elseif .. elseif ... end if. Here is an example from my debugging toolkit:

QUOTE
Var v_debug
Var v_urg
Var v_spawn
Var v_strat
Var v_sai
Var v_bot
Var v_sense
Var v_areas
Var v_none
Var v_botspawn


game.showAIStats      -> v_debug
ai.showStrategicAreas -> v_areas
ai.showBotStats       -> v_bot
ai.showBotSense       -> v_sense
ai.showBotSpawnCoord  -> v_spawn
ai.showBotUrgencies   -> v_urg
ai.showStrategies     -> v_strat
ai.showSAIStats       -> v_sai

Utils.expr v_urg  | v_spawn   -> v_none
Utils.expr v_none | v_strat   -> v_none
Utils.expr v_none | v_sai     -> v_none
Utils.expr v_none | v_bot     -> v_none
Utils.expr v_none | v_sense   -> v_none
Utils.expr v_none | v_areas   -> v_none
Utils.expr ! v_none           -> v_none

Utils.expr ! v_spawn -> v_botspawn
Utils.expr v_bot & v_botspawn -> v_botspawn

game.showAIStats 1
game.enableFreeCamera 1

if v_debug == 0
   debug.debugOutputMessage "Show AI Stats is ON" 1
   ai.showBotUrgencies   0
   ai.showBotSpawnCoord  0
   ai.showStrategies     0
   ai.showSAIStats       0
   ai.showBotStats       0
   ai.showBotSense       0
   ai.showStrategicAreas 0
elseif v_none
   debug.debugOutputMessage "AI Strategic Area debugging is ON" 1
   ai.showStrategicAreas 1
elseif v_areas
   debug.debugOutputMessage "AI Bot Stats debugging is      ON" 1
   ai.showStrategicAreas 0
   ai.showBotStats       1
elseif v_botspawn
   debug.debugOutputMessage "AI Bot Spawn debugging is also ON" 1
   ai.showBotSpawnCoord  1
elseif v_spawn
   debug.debugOutputMessage "AI Bot Sense debugging is      ON" 1
   ai.showBotStats       0
   ai.showBotSpawnCoord  0
   ai.showBotSense       1
elseif v_sense
   debug.debugOutputMessage "AI Bot Urgency debugging is    ON" 1
   ai.showBotSense       0
   ai.showBotUrgencies   1
elseif v_urg
   debug.debugOutputMessage "AI Strategy  debugging is      ON" 1
   ai.showBotUrgencies   0
   ai.showStrategies     1
elseif v_strat
   debug.debugOutputMessage "AI SAI debugging is            ON" 1
   ai.showStrategies     0
   ai.showSAIStats       1
elseif v_sai
   debug.debugOutputMessage "AI debugging is now            OFF" 1
   game.showAIStats      0
   ai.showSAIStats       0
endif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.