Post your scripting questions / solutions here
Moderator: Moderators
Elgan
Lieutenant General
Posts: 890 Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:
Post
by Elgan » Mon Dec 27, 2004 9:28 pm
Green Beret wrote: isnt there a way to activate a trigger using a gun.
as in shooting it to trigger it?
set the spanw flags for the trigger to 128
128 ( trigger no projectile)
144 ( trigger inc projectile)
HDL_CinC_Dragon
Brigadier General
Posts: 574 Joined: Mon Dec 22, 2003 8:32 pm
Post
by HDL_CinC_Dragon » Tue Dec 28, 2004 4:11 am
heres a question... can an MG42 be targeted by a trigger (MG bound to corner of building on a turret made by the mapper and when the trigger is pressed, the MG fires?
Green Beret
Major General
Posts: 746 Joined: Mon Apr 19, 2004 12:21 pm
Contact:
Post
by Green Beret » Tue Dec 28, 2004 4:41 am
probally hit control + k and connect the trigger to the mg42.make sure to connect in correct order.
im not positive this will work
lizardkid
Windows Zealot
Posts: 3672 Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT
Post
by lizardkid » Tue Dec 28, 2004 6:01 am
its easier to script it.
trigger, setthread, you know the drill..
Code: Select all
mgShootAtHim:
$mg aimat $victim
wait 1
$mg shootat $victim
wait 1
$mg aimat NULL
not totally sure it's shootat...
Moderator
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
Green Beret
Major General
Posts: 746 Joined: Mon Apr 19, 2004 12:21 pm
Contact:
Post
by Green Beret » Tue Dec 28, 2004 8:12 pm
probally $player,again not totally sure.
HDL_CinC_Dragon
Brigadier General
Posts: 574 Joined: Mon Dec 22, 2003 8:32 pm
Post
by HDL_CinC_Dragon » Thu Dec 30, 2004 8:16 pm
so would the thread be
Code: Select all
mg_ops:
$gunner waittill trigger
$mg aimat $player
wait .5 //I like fast results ;-)
$mg shootat $player
wait .5 //I like fast results ;-)
$mg aimat NULL
goto mg_ops
end
?
Rookie One.pl
Site Admin
Posts: 2752 Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:
Post
by Rookie One.pl » Sat Jan 01, 2005 4:25 pm
Well, assuming that $gunner is the trigger, it should work.
There's one thing - you shouldn't be using goto (I'm not even sure if there's such thing in MoH scripting...), have a while loop instead. And if you want fast results, change wait 5 to waitframe - can't get any faster than that without removing the waiting completely.
I would do it like this:
Code: Select all
mg_ops:
while(1) {
$gunner waittill trigger
$mg aimat $player
waitframe //now that's real fast!
$mg shootat $player
waitframe //hurry up!
$mg aimat NULL
}
end
Rookie One.pl
Site Admin
Posts: 2752 Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:
Post
by Rookie One.pl » Wed Jan 26, 2005 7:21 pm
I'm going to hijack the topic.
Is there a way to get the primary weapon the player's using? I tried $player.gun and $player.weapon, but they both return NIL...
bdbodger
Moderator
Posts: 2596 Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:
Post
by bdbodger » Wed Jan 26, 2005 10:48 pm
This will work
Code: Select all
mg_ops:
while(1) {
$gunner waittill trigger
local.player = parm.other
$mg setaimtarget local.player
$mg waittill ontarget
$mg startfiring
While(local.player istouching $gunner)
{
$mg setaimtarget local.player
waitframe
}
$mg stopfiring
}
end
Elgan
Lieutenant General
Posts: 890 Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:
Post
by Elgan » Thu Jan 27, 2005 12:32 am
wont that just make a mg fire:S?
well tname thing mg
Rookie One.pl
Site Admin
Posts: 2752 Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:
Post
by Rookie One.pl » Thu Jan 27, 2005 2:13 pm
I asked jv_map about this:
jv_map@mods-r-us.net wrote: you can do something like:
Code: Select all
$player[local.number] weaponcommand dual targetname ("playerweap" + local.number) // sets targetname of weapon player is holding
// then:
switch($("playerweap" + local.number).model)
{
case "models/weapons/m1_garand.tik":
// blablabla
break
// etc
}
P.S. don't do this every frame, it will cause tremendous lag (with a delay of say 0.5 I think there won't be a problem).