How do i make random arty?
Cause ya know there was alot of it on D-Day lol :rolleyes:
you have to go into scar to do this.
Here's how(i may as well make this a how-to) -
-make a few markers on your map. to do this, go into the marker editor (flag symbol in WB) and right click to place markers. make sur ethe markers are of the same type and have the same naming format. example: make all markers blue markers, named marker_1, marker_2, marker_3, etc...
-Make a new file in your map's directory called mapname.scar
--there is already a file called mapname_id.scar, don't edit this. this does however prrovide ou with useful info such as marker names and counts, which you will need later
-here's the code you will need. i'll explain as much as i can on this:
import("ScarUtil.scar")
function OnGameSetup()
Rule_RemoveAll() --this is necessary to use Rule_AddInterval
Rule_AddInterval(kbzl_arty, 20) --this will set an interval to call the kbzl_arty function every 20 seconds
end
function kbzl_arty()
plyr=World_GetPlayerCount() --get the number of players on the map, so that we can assign an "owner" of the arty strike
if World_GetRand(0, 1) == 0 then --Do we want to use the arty strike? choose randomly...
bomber = World_GetPlayerAt(World_GetRand(1, plyr)) --assign the bomber/owner to a random player
mark=Marker_FromName("mkr_"..World_GetRand(1,17), "blue_marker") --choose which marker we want to set the arty strike at. we use the marker name format mkr_#. adjust this to your needs, including the # of total markers, in this case 1-17
target = Util_GetPosition(mark) --get the position of our marker
target.x = target.x + World_GetRand(-50, 50) --set a random x offset from -50 to 50
target.z = target.z + World_GetRand(-50, 50) --set a random z offset
direction = Marker_GetDirection(mark) --get the direction of our marker, for things like airstrikes or creeping barrage
direction.x = direction.x + World_GetRand(-90, 90) --offest angle
direction.z = direction.z + World_GetRand(-90, 90) --offset angle
btype = World_GetRand(0,3) --this is optional, used to randomly select an arty strike type. we start by selecting from 4 #s randomly
if btype == 0 then --if it is 0, then...
Cmd_Ability(bomber, BP_GetAbilityBlueprint("abilities/ally_air_strike_ability_rockets.lua"), target, direction, true) --we call an ability, assigning a bomber, and then calling an ability, then setting our target and direction, and set the last value to true
elseif btype == 1 then --the rest of this is straightforward, calling different arty strikes for different values of btype
Cmd_Ability(bomber, BP_GetAbilityBlueprint("abilities/off_map_artillery_ability.lua"), target, direction, true)
elseif btype == 2 then
Cmd_Ability(bomber, BP_GetAbilityBlueprint("abilities/overwatch_barrage.lua"), target, direction, true)
elseif btype == 3 then
Cmd_Ability(bomber, BP_GetAbilityBlueprint("abilities/creeping_barrage.lua"), target, direction, true)
end
end
end
that should be it... i'm not at home right now so i can't check if that's all. test it out a few times and you'll see if it works, tweak a few things to your map's needs.
ok but now i cant play the map
vBulletin v3.6.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.