Page 1 of 1

tutorial: playerweapon P_flak88 to an auto fire enemy weapon

Posted: Mon Apr 07, 2003 12:37 am
by bdbodger
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

Posted: Mon Apr 07, 2003 3:31 am
by mohaa_rox
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. :wink:

But your method is good too. :wink:

Posted: Mon Apr 07, 2003 2:02 pm
by bdbodger
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

Posted: Mon Apr 07, 2003 2:10 pm
by mohaa_rox
You mean only for SH? I thought was for AA........:oops:

Posted: Tue Apr 08, 2003 1:40 am
by bdbodger
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
enemy_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
for this script you need to name the base the same name as the neb with base on the end $myneb $mynebbase

Posted: Wed Jun 25, 2003 2:22 pm
by bdbodger
Disregard this thread try viewtopic.php?p=25338#25338

we live we learn :lol: