Spawned Weapons, Scripting and Destruction
Moderator: Moderators
Spawned Weapons, Scripting and Destruction
I've been working with the stock maps, and adding new features like wire, mortars etc.
I'm having trouble with the static weapons. I've placed some flak88's but when they're destroyed, they disappear instead of leaving a destroyed version behind.
Note I'm only doing this through the script, not mapping. I'd appreciate it if someone can clue me in? Keep it simple, because I'm not as good at scripting as I should be.
Thanks in advance.
I'm having trouble with the static weapons. I've placed some flak88's but when they're destroyed, they disappear instead of leaving a destroyed version behind.
Note I'm only doing this through the script, not mapping. I'd appreciate it if someone can clue me in? Keep it simple, because I'm not as good at scripting as I should be.
Thanks in advance.
-
Sgt.Pepper
- Sergeant
- Posts: 69
- Joined: Tue Feb 25, 2003 5:41 pm
- Location: Canada
Ok, how would that be applied to the original flak script? Here's the flak script:
//Flak On Crossroads - Allied
local.flakcannon = spawn models/statweapons/P_flak88.tik
local.flakcannon.origin = ( -223.97 -2653.97 240.13 )
local.flakcannon.angle = 271
local.flakcannon.scale = 1
local.flakcannon yawCenter 450
local.flakcannon maxYawoffset 50
local.flakcannon bulletDamage 30
Would we add something like:
local.flakcannon exec global/vehicles_thinkers.scr
//Flak On Crossroads - Allied
local.flakcannon = spawn models/statweapons/P_flak88.tik
local.flakcannon.origin = ( -223.97 -2653.97 240.13 )
local.flakcannon.angle = 271
local.flakcannon.scale = 1
local.flakcannon yawCenter 450
local.flakcannon maxYawoffset 50
local.flakcannon bulletDamage 30
Would we add something like:
local.flakcannon exec global/vehicles_thinkers.scr
Na just copy the code into your own thread 
//Flak On Crossroads - Allied
local.flakcannon = spawn models/statweapons/P_flak88.tik
local.flakcannon.origin = ( -223.97 -2653.97 240.13 )
local.flakcannon.angle = 271
local.flakcannon.scale = 1
local.flakcannon yawCenter 450
local.flakcannon maxYawoffset 50
local.flakcannon bulletDamage 30
local.flakcannon thread mypflakthread
(....)
end
mypflakthread:
self waittill death
self setaimtarget NULL
self playsound explode_flak88
radiusdamage self.origin 200 200
self thread global/vehicles_thinkers.scr::spawn_fx models/fx/fx_tank_explosion.tik
local.damaged = thread global/vehicles_thinkers.scr::spawn_damaged models/statweapons/flak88_d.tik
self remove
end
//Flak On Crossroads - Allied
local.flakcannon = spawn models/statweapons/P_flak88.tik
local.flakcannon.origin = ( -223.97 -2653.97 240.13 )
local.flakcannon.angle = 271
local.flakcannon.scale = 1
local.flakcannon yawCenter 450
local.flakcannon maxYawoffset 50
local.flakcannon bulletDamage 30
local.flakcannon thread mypflakthread
(....)
end
mypflakthread:
self waittill death
self setaimtarget NULL
self playsound explode_flak88
radiusdamage self.origin 200 200
self thread global/vehicles_thinkers.scr::spawn_fx models/fx/fx_tank_explosion.tik
local.damaged = thread global/vehicles_thinkers.scr::spawn_damaged models/statweapons/flak88_d.tik
self remove
end
-
Sgt.Pepper
- Sergeant
- Posts: 69
- Joined: Tue Feb 25, 2003 5:41 pm
- Location: Canada
Ok we've done that, but it seems to leave behind a destroyed flak88 on the map.
Example, on the crossroads map, we've put a flak88 at each end, and when you destroy them, they work as they should. But under the bridge in the water is a destroyed cannon?
The script doesn't even have those coordinates... weird.
Example, on the crossroads map, we've put a flak88 at each end, and when you destroy them, they work as they should. But under the bridge in the water is a destroyed cannon?
The script doesn't even have those coordinates... weird.
-
Sgt.Pepper
- Sergeant
- Posts: 69
- Joined: Tue Feb 25, 2003 5:41 pm
- Location: Canada
Did I see that you where useing the p_flakk88.tik that is a spearhead gun isn't it ? In spearhead there is a global script for the destoyed models you use it like this
the last part of that is the destroyed model you want to use . You can use this script for the flakk too just use p_flak88_d.tikSteps in Radiant:
1. Make a turret weapon in Radiant
2. Give the weapon a $targetname
3. Give it a health
4. if you want it to block when it gets destroyed? have it target the collision geometry
Steps in your script:
1. In your main script you need to add right after level waittill spawn
The $targetname of the weapon followed by the following thread
Ei. Lets say we have called a player mountable turret $targetname gun1
The script would read
$gun1 thread global/stationaryweapons.scr::MountedStationaryWeapon statweapons/P_aagun_d.tik
-
Sgt.Pepper
- Sergeant
- Posts: 69
- Joined: Tue Feb 25, 2003 5:41 pm
- Location: Canada
Ok, with the changed line we're still have the destoryed gun appear. Let me copy it out to make sure that I've got it right. I put the dash in there to indicate that the next line should be a continuation of the previous line.
mypflakthread:
self waittill death
self setaimtarget NULL
self playsound explode_flak88
radiusdamage self.origin 200 200
self thread global/vehicles_thinkers.scr::spawn_fx models/fx/fx_tank_explosion.tik
waitthread global/vehicles_thinkers.scr::spawn_damaged models/statweapons/flak88_d.tik -self.angles self.origin
self remove
end
mypflakthread:
self waittill death
self setaimtarget NULL
self playsound explode_flak88
radiusdamage self.origin 200 200
self thread global/vehicles_thinkers.scr::spawn_fx models/fx/fx_tank_explosion.tik
waitthread global/vehicles_thinkers.scr::spawn_damaged models/statweapons/flak88_d.tik -self.angles self.origin
self remove
end
-
TheShiznaeSpe
- Major
- Posts: 304
- Joined: Wed Feb 05, 2003 11:45 pm
- Location: US
- Contact:
