bots and mg42 problem

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Cobra {sfx}
Site Admin
Posts: 194
Joined: Tue Mar 23, 2004 10:25 pm
Contact:

bots and mg42 problem

Post by Cobra {sfx} »

ok after a week of trying different things to get my mg42 to show and be used by "soldier2" its doin my head in, can anyone help me fix this - all i want is soldier 2 to be able to spawn and use the mg42 to defend - its a stock map edit...

blah blah
level waittill prespawn

$world farplane 4500
$world farplane_color (.333 .333 .329)

//*** Precache Dm Stuff
exec global/DMprecache.scr

exec global/door_locked.scr::lock
level.script = maps/obj/obj_team4.scr
exec global/ambient.scr obj_team4

thread soldier1
thread mg42




//not functioning for bots yet? :(

mg42:

local.static = spawn script_model
local.static = spawn "statweapons/mg42_gun.tik"
local.static.origin = ( -355 -879 311)
local.static.angles = ( 0 0 0)
local.static solid
local.static firetype bullet
local.static model "statweapons/mg42_bipod.tik"
local.static.origin = ( -355 -879 311)
local.static.angles = (0 -90 0)
local.static scale 1.0


end

//the bots show up but no mg42, heres soldier2s info...

soldier2:
local.soldiercount2 = 2
spawn human/multiplayer_allied_2ndranger_sergeant.tik "targetname" "soldier2" "type_attack" "cover" "weapon" "bar"
thread soldier $soldier2 local.soldiercount2
$soldier2 turnto ( -355 -879 311)
$soldier2 waittill turndone
while(isAlive $soldier2)
{
wait 1
}
//remove $soldier2
wait 2
goto soldier3
end

see anything obvious? any help to get it working and even better to get the bot to use it would be a great help.

Cobra :(
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Yup the most obvious thing is that you didn't write any code for the bots to use the mg ;)

First of all you need to make him a mg-er, off the top of my head something like this:
$soldier2 type_attack turret
$soldier2 type_idle turret
$soldier2 type_grenade turret
$soldier2.enableEnemy = 0
$soldier2 turret $mg42 // targetname of mg-42

Then, you also need to write some targeting threads which is a little bit more complicated. Look at global/mg42_active.scr for the basics, though you gotta chance quite a few things to make it work in a multiplayer environment.
Image
Cobra {sfx}
Site Admin
Posts: 194
Joined: Tue Mar 23, 2004 10:25 pm
Contact:

Post by Cobra {sfx} »

Ok, ive added that info to soldier 2...

soldier2:
local.soldiercount2 = 2
spawn human/multiplayer_allied_2nd-ranger_sergeant.tik "targetname" "soldier2" "type_attack" "cover" "weapon" "bar"
thread soldier $soldier2 local.soldiercount2
$soldier2 type_attack turret
$soldier2 type_idle turret
$soldier2 type_grenade turret
$soldier2.enableEnemy = 0
$soldier2 turret $mg42 // targetname of mg-42
$soldier2 turnto ( -355 -879 311)
$soldier2 waittill turndone
while(isAlive $soldier2)
{
wait 1
}
//remove $soldier2
wait 2
goto soldier3
end

im still at problem 1 tho - no mg42 shows - i cant see it on the map (once i see the mg42 show - ill get on with the rest of the script thats needed)

i can get the mg42 to show using the spawn this way...

local.mg422 = spawn models/statweapons/mg42_gun.tik
local.mg422.origin = ( -355 -879 311)
local.mg422.angle = 90
local.mg422 yawCenter 90
local.mg422 maxyawoffset 40
local.mg42B = spawn script_model
local.mg42B model "statweapons/mg42_bipod.tik"
local.mg42B.origin = ( -355 -879 311)
local.mg42B.angles = (0 -90 0)
local.mg42B solid

this one shows up

but in other threads you say it needs to be done this way

local.static = spawn "statweapons/mg42_gun.tik" "tagetname" "mg42"
local.static.origin = ( -355 -879 311)
local.static.angles = ( 0 0 0)
local.static solid
local.static firetype bullet
local.static model "statweapons/mg42_bipod.tik"
local.static.origin = ( -355 -879 311)
local.static.angles = (0 -90 0)
local.static scale 1.0

this one doesnt??

ps where can i find the global/mg42 active file - i dont have that

Cobra
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

This line is the culprit:

local.static model "statweapons/mg42_bipod.tik"

You just spawned a mg-42, but now you're forcing it to become a bipod :? Simply change local.static to something like local.bipod from that line down. The line itself should now say:

local.bipod = spawn statweapons/mg42_bipod.tik

global/mg42_active.scr is in pak0.pk3 which is to be opened with winzip.
Image
Cobra {sfx}
Site Admin
Posts: 194
Joined: Tue Mar 23, 2004 10:25 pm
Contact:

Post by Cobra {sfx} »

Ahar - thats much better :) cheers Jv, its lookin better already.

ive found a modified active mg42.scr that small sumo and someone else has changed, just need to link soldier 2 to that somehow.

All fun cheers m8

Cobra

ps thought id post it so other peeps know ... this works...

mg42:

local.static = spawn "statweapons/mg42_gun.tik" "targetname" "mg42"
local.static.origin = ( -355 -879 311)
local.static.angles = ( 0 90 0)
local.static solid
local.static firetype bullet

local.mg42B = spawn script_model
local.mg42B model "statweapons/mg42_bipod.tik"
local.mg42B.origin = ( -355 -879 311)
local.mg42B.angles = ( 0 90 0)
local.mg42B solid
Post Reply