how to convert the playerweapon P_flak88 to an automaticly fireing enemy weapon
/////////////////////////////////////////////////
the base for the flak88
///////////////////////////////////////////////////
step1:
extract models/statweapons/p_flak88.tik and rename it to myflak88base.tik
step2:
change this "classname FixedTurret" to this "classname animate"
step3:
remove or comment out this "spawnturret 0 "statweapons/P_flak88_cannon.tik" // Cannon attached to the vehicle"
step4:
remove this
client
{
//cache models/statweapons/P_flak88_cannon.tik
}
step5:
change this
/*QUAKED turretweapon_german_flak88 (0.0 .0 0.0) (-55 -55 0) (55 55 128)
Flak 88
*/
to this
/*QUAKED turretweapon_german_myflak88base (0.0 .0 0.0) (-55 -55 0) (55 55 128)
Flak 88
*/
/////////////////////////////////////////////////////
the flak88 cannon
/////////////////////////////////////////////////
step1:
extract /models/statweapons/p_flak88_cannon and rename it to my_flak88.tik
step2:
add this to the bottom of your tik
/*QUAKED turretweapon_german_myflak88 (0.5 .25 0.25) (-32 -32 0) (32 32 128)
Big gun - Boom boom.
*/
///////////////////////
Put the tiks into your pk3 in the models/statweapon directory and open mohradiant your gun will now the there and useable
///////////////////////////////////////
the script
//////////////////////////////////////////
$myflak88 thread flak88_start
flak88_start:
self turnspeed 10
self exec global/vehicles_thinkers.scr::enemy_flak_think
wait 1
level.playertanktarget = $player//or use script to set target
end
tutorial: playerweapon P_flak88 to an auto fire enemy weapon
Moderator: Moderators
Actually, it's pretty easy and i used it for my flak firing in my test map for driving tanks.
Just give it a targetname of "flak" and
$flak thread global/vehicles_thinkers.scr::enemy_flak_think
Make a collisionent for the flak using "Tank Metal" texture from common. Make it real nice and make it a script object. Give it a targetname of flak_mask. Then go back to your flak, giving it a "target" of "flak_mask". Put the collisionent into the air or under terrain.
That is easier.
But your method is good too.
Just give it a targetname of "flak" and
$flak thread global/vehicles_thinkers.scr::enemy_flak_think
Make a collisionent for the flak using "Tank Metal" texture from common. Make it real nice and make it a script object. Give it a targetname of flak_mask. Then go back to your flak, giving it a "target" of "flak_mask". Put the collisionent into the air or under terrain.
That is easier.
But your method is good too.
Live to map, not map to live.
-mohaa_rox, .map
moderator
-mohaa_rox, .map
moderator
sorry mohaa_rox but when I do it your way nothing happens it is only when I do it my way that it works at least for the p_flak88.tik although there is another flak88mm from mohaa that you can use that works . You can use my method for the neberwerfer and aagun too . when I do use the P_flak88.tik it is useable as a player weapon but won't work for me useing the vehicle_thinkers script
I guess I should have said for spearhead sorry . Also the nebelwerfer will need a custom script because it has 6 barrels and the vehicle_thinkers script for the flak uses the flak destroyed model only thing is there is only a model for the snow nebelwerfer so you have to use it
for this script you need to name the base the same name as the neb with base on the end $myneb $mynebbaseenemy_neb_think:
self rendereffects "-shadow"
self solid
self.health = 100
self takedamage
self removeondeath 0
if (self.target)
{
self.collisionent = self.target
//self.collisionent hide
}
level waittill spawn
while ( (level.playertanktarget == 0) || (level.playertanktarget == NIL) )
wait 1
if (level.sightdistance == NIL)
level.sightdistance = 16000
self setaimtarget level.playertanktarget
thread enemy_neb_attack
local.attack_thread = parm.previousthread
self waittill death
//self stopFiring
self setaimtarget NULL
self show
self playsound explode_flak88
local.attack_thread delete
//radiusdamage self.origin level.bomb_damage level.bomb_explosion_radius
radiusdamage self.origin 200 200
self thread spawn_fx models/fx/fx_tank_explosion.tik
local.base = self.targetname+"base"
$(local.base) remove
local.damaged = thread spawn_damaged models/statweapons/nebelwerfer_w_d.tik
self remove
end
enemy_neb_attack:
while (isAlive self)
{
if !(vector_within level.playertanktarget.origin self.origin level.sightdistance)
{
// println "z: " self " is not firing because of range"
wait 1
}
else if (!(sighttrace level.playertanktarget.origin (self.origin + (0 0 64)) 1))
{
// println "z: " self " is not firing because of sight trace"
wait 1
}
else
{
println "z: " self " on target, waitting 3 secs to fire"
wait 3
local.barrel= randomint(6)+1
local.fire = "fire_"+local.barrel
self anim local.fire
wait 3
}
}
end
spawn_damaged local.model:
local.damaged = spawn script_model model local.model
local.damaged.origin = self.origin + ( 0 0 -32 )
local.damaged.angles = self.angles
local.damaged notsolid
end local.damaged
spawn_fx local.fx:
local.temp = spawn script_model model local.fx
local.temp notsolid
local.temp.origin = self.origin
local.temp anim start
local.temp notsolid
wait 5
local.temp remove
end