NML - Random vehicle variant + Random cargo variant ?
Posted: 25 Jun 2012 17:27
Hello again,
I was trying to make a vehicle with variants and cargo variants like,
Vehicle_Variant1_Cargo1
Vehicle_Variant1_Cargo2
Vehicle_Variant2_Cargo1
Vehicle_Variant2_Cargo2
In which the vehicle variant is chosen randomly at purchase/refit, and cargo variant is chosen randomly when new cargo is loaded.
However I'm not able to come up with a code that does this.
Is it possible? If so, how?
I tried the following setup.
Random Cargo graphics for the given variant:
Cargo switches that call the cargo randomizer
Vehicle variant switch, it calls cargo switch depending on vehicle variant
Item code, we call for vehicle variant randomizer
The problem with this code is that vehicle variant is also rerandomized when the tiggers for random_switch_spritgroup_VEHICLE_V1_CARGO are fulfilled.
I was trying to make a vehicle with variants and cargo variants like,
Vehicle_Variant1_Cargo1
Vehicle_Variant1_Cargo2
Vehicle_Variant2_Cargo1
Vehicle_Variant2_Cargo2
In which the vehicle variant is chosen randomly at purchase/refit, and cargo variant is chosen randomly when new cargo is loaded.
However I'm not able to come up with a code that does this.
Is it possible? If so, how?
I tried the following setup.
Random Cargo graphics for the given variant:
Code: Select all
random_switch (FEAT_ROADVEHS, SELF, random_switch_spritgroup_VEHICLE_V1_WOOD, bitmask(TRIGGER_VEHICLE_UNLOAD_ALL, TRIGGER_VEHICLE_ANY_LOAD, TRIGGER_ALL_NEEDED)) {
1: spritgroup_VEHICLE_V1_WOOD_c1;
1: spritgroup_VEHICLE_V1_WOOD_c2; //1+1 = 2 = 2^1
}
random_switch (FEAT_ROADVEHS, SELF, random_switch_spritgroup_VEHICLE_V2_WOOD, bitmask(TRIGGER_VEHICLE_UNLOAD_ALL, TRIGGER_VEHICLE_ANY_LOAD, TRIGGER_ALL_NEEDED)) {
1: spritgroup_VEHICLE_V2_WOOD_c1;
1: spritgroup_VEHICLE_V2_WOOD_c2; //1+1 = 2 = 2^1
}
//Same for STEL//
Code: Select all
switch (FEAT_ROADVEHS, SELF, switch_spritegroup_VEHICLE_V1, cargo_type_in_veh) {
WOOD: random_switch_spritgroup_VEHICLE_V1_WOOD;
STEL: random_switch_spritgroup_VEHICLE_V1_STEL;
}
switch (FEAT_ROADVEHS, SELF, switch_spritegroup_VEHICLE_V2, cargo_type_in_veh) {
WOOD: random_switch_spritgroup_VEHICLE_V2_WOOD;
STEL: random_switch_spritgroup_VEHICLE_V2_STEL;
}
Code: Select all
random_switch (FEAT_ROADVEHS, SELF, random_switch_spritegroup_VEHICLE ) {
1: switch_spritegroup_VEHICLE_V1;
1: switch_spritegroup_VEHICLE_V2; //1+1 = 2 = 2^1
}
Code: Select all
item(FEAT_ROADVEHS, item_VEHICLE) {
property {
/* Properties */
}
graphics
{
default: random_switch_spritegroup_VEHICLE;
}