mg42 by it's own
Moderator: Moderators
-
Krane
- Lieutenant General
- Posts: 782
- Joined: Sat May 31, 2003 4:18 pm
- Location: California, USA
- Contact:
mg42 by it's own
Is there any possible way to make the spotlight/gunner without a gunner? I mean, the mg42 shots at you by itself, w/o the AI there?
-
Krane
- Lieutenant General
- Posts: 782
- Joined: Sat May 31, 2003 4:18 pm
- Location: California, USA
- Contact:
Any tips?jv_map wrote:Definately...
Oh, btw, this is for MP...I'm havin a hard time trying to put the mg42/gunner/spotlight in MP, he don't shot at me at all...I'm using a jvbot, since regular AI don't work in MP (nope, the global/ai.scr don't produce any fx...)
Ok, I will. I had never realized the mg's at omaha shoot by themselfs...Mj wrote:check out the scripting for ohama beach
txs
I've made that for my map but without the spotlight, here it is:
and fire_mg is called by a number of trigger_multiple's across the map. That script also stops the mg firing once the person is dead and if it cannot see the target. I am currently try to work out how to get a spotlight to follow a player, not sure how at the moment.
What you be able to do however is spawn a dynamic light at the position of the player with something like:
then of course:
when you want to turn the light off. I am however, stuck on how to get a searchlight to follow a player (any help on that would be great
).
I hope this helps Krane,
Bilko.
ps some of this code was made by other people - credit to them
Code: Select all
fire_mg:
local.gun_name = $mg1
local.target = parm.other
while(local.target istouching self)
{
//Set target
local.gun_name setaimtarget local.target
local.gun_name waittill ontarget
wait 0.2
//Set Accuracy
local.range = 96 + randomint(128)
local.offset = 96 + randomint(128)
//Apply Random Aiming
if((randomint(100)) < 50)
local.gun_name rotateXup local.range
else
local.gun_name rotateXdown local.range
if((randomint(100)) < 50)
local.gun_name rotateYup local.offset
else
local.gun_name rotateYdown local.offset
//Gun Fire
if(local.gun_name cansee local.target) {
if(isAlive local.target) {
local.gun_name burstFireSettings 0.25 0.5 1 .25
local.gun_name maxYawOffset 55
local.gun_name bulletdamage 20
local.gun_name setaimtarget local.target
local.gun_name startfiring
$mg1 setaimtarget NULL
wait 1
} else {
local.gun_name stopfiring
$mg1 setaimtarget NULL
}
} else {
local.gun_name stopfiring
$mg1 setaimtarget NULL
}
}
$mg1 setaimtarget NULL
end
Code: Select all
local.light = spawn "fx/dummy.tik"
local.light.origin = local.target.origin
local.light light 1 1 1 200
Code: Select all
local.light light 1 1 1 0
I hope this helps Krane,
Bilko.
ps some of this code was made by other people - credit to them
-
Krane
- Lieutenant General
- Posts: 782
- Joined: Sat May 31, 2003 4:18 pm
- Location: California, USA
- Contact:
Sorry guys, not a single shot...
I placed a mg42 in my map, targetname turret. In my script:
main:
level waittill prespawn
thread setup_turret
level waittill spawn
end
setup_turret:
$turret setaimtarget $player
$turret startfiring
end
0...The weapon does not respond to anything...Well, I can use it...
What's wrong?
I placed a mg42 in my map, targetname turret. In my script:
main:
level waittill prespawn
thread setup_turret
level waittill spawn
end
setup_turret:
$turret setaimtarget $player
$turret startfiring
end
0...The weapon does not respond to anything...Well, I can use it...
What's wrong?
-
Krane
- Lieutenant General
- Posts: 782
- Joined: Sat May 31, 2003 4:18 pm
- Location: California, USA
- Contact:
Sorry, Biko, I didn't mean your method don't work. It's just not exactly what I want. I don't want trigger_targets, I want the mg to recognize a player and shoot at him!
So I started w/ Biko's modified script. I was simplifing the script until it was a simple script...nothing...
Then I tryed what jv said, simple commands...nothing...
A simple gun and a simple command...0
Edit: Wacko sended me a map w/ Biko's script...cool, but the trigger is activating the shooting.
Triggers can use commands like "istouching" etc...Can a mg do this by itself?
Or maybe I'll have to put a enormous trigger all over the map...
So I started w/ Biko's modified script. I was simplifing the script until it was a simple script...nothing...
Then I tryed what jv said, simple commands...nothing...
A simple gun and a simple command...0
Edit: Wacko sended me a map w/ Biko's script...cool, but the trigger is activating the shooting.
Triggers can use commands like "istouching" etc...Can a mg do this by itself?
Or maybe I'll have to put a enormous trigger all over the map...
-
nuggets
- General
- Posts: 1006
- Joined: Fri Feb 28, 2003 2:57 am
- Location: U-england-K (england in the UK) :P
- Contact:
thread it straight away and use
while (1)
{
for (local.i=1; local.i<=$player.size; local.i++)
{
if ($mg42 cansee $player[local.i] 140 768)
$mg42 setaimtarget $player[local.i]
$mg42 startfiring
wait 2
if (!($mg42 cansee $player[local.i] 140 768) || !(isAlive $player[local.i]))
{
$mg42 stopfiring
$mg42 setaimtarget NULL
}
}
wait 1
}
end
while (1)
{
for (local.i=1; local.i<=$player.size; local.i++)
{
if ($mg42 cansee $player[local.i] 140 768)
$mg42 setaimtarget $player[local.i]
$mg42 startfiring
wait 2
if (!($mg42 cansee $player[local.i] 140 768) || !(isAlive $player[local.i]))
{
$mg42 stopfiring
$mg42 setaimtarget NULL
}
}
wait 1
}
end
hope this helps, prob not cos it's all foreign 2 me :-/
hey, great, tvm!
I did:It seems that the mg did no stop firing when I was dead with ur script, now it does.
But there are still some questions:
What is this '140 768'? Is 140 fov in degrees? 768 max distance to player?
Is there anything where I can find information about 'bulletdamage' and 'burstfiresettings'? They're in the 'game modul classes', I know, but they seem to do nothing at the moment...
I did:
Code: Select all
fire_mg:
while (1)
{
for (local.i=1; local.i<=$player.size; local.i++)
{
if (($mg1 cansee $player[local.i] 140 768) && (isAlive $player[local.i]))
{
$mg1 burstFireSettings 0.25 0.5 1 .25
$mg1 bulletdamage 1
$mg1 setaimtarget $player[local.i]
$mg1 startfiring
wait 2
}
else
{
$mg1 stopfiring
$mg1 setaimtarget NULL
}
}
wait 1
}
endBut there are still some questions:
What is this '140 768'? Is 140 fov in degrees? 768 max distance to player?
Is there anything where I can find information about 'bulletdamage' and 'burstfiresettings'? They're in the 'game modul classes', I know, but they seem to do nothing at the moment...
-
Krane
- Lieutenant General
- Posts: 782
- Joined: Sat May 31, 2003 4:18 pm
- Location: California, USA
- Contact:
Ok, me and Wacko (more Wacko than me...) have this thing working. The problem is that the mg doesn't turn to the player properly. It keeps shooting "sideways"...
Actual script:
Actual script:
Is there a way to make the mg stick on the player 100%?main:
level waittill prespawn
level waittill spawn
thread prep_mg
thread activate_mg
end
//***************************************************************
prep_mg:
$mg_origin bind $mg_housing
$mg1 glue $mg_origin
$mg1 setPlayerUsable 0
$mg1 maxYawOffset 10
$mg1 pitchCaps -10 10 0
$mg1 turnspeed 50
$mg1 bulletdamage 1
$mg1 burstFireSettings 0.25 0.5 1 .25
level.mg_enemy="axis"
end
activate_mg:
while (1)
{
for (local.i=1; local.i<=$player.size; local.i++)
{
if (($mg1 cansee $player[local.i] 140 768) && (isAlive $player[local.i]) && $player[local.i].dmteam==level.mg_enemy)
{
$mg_housing rotatey 0
local.origin=$mg1.origin
$mg1 unglue $mg_origin
$mg1.origin=local.origin
$mg1 setaimtarget $player[local.i]
$mg1 startfiring
wait 2
}
else
{
$mg1 stopfiring
$mg1 glue $mg_origin
$mg1 setaimtarget NULL
$mg_housing rotatey 50
}
}
wait 1
}
end
mg_enemy:
$mg_trigger nottriggerable
if (level.mg_enemy=="allies")
{
$mg_switch anim turnon
level.mg_enemy="axis"
$mg playsound click
}
else
{
$mg_switch anim turnoff
level.mg_enemy="allies"
$mg playsound click
}
iprintln level.mg_enemy " is to be killed"
wait .5
$mg_trigger triggerable
end
hehehe, the housing is my bad english and it's a case around the mg that ought to rotate together with the mg, stop when the mg sees an enemy and starts rotating again when the 'target' is dead or not to be seen anymore.
But, Krane will do a new model instead, so we won't need a 'housing' and, errrm the topic is solved so far...
thanks m8
But, Krane will do a new model instead, so we won't need a 'housing' and, errrm the topic is solved so far...
thanks m8



