In many barrels u have got barrels then can be blown when u shoot at it.
I wanted that all so. I maked a barrel and maked it a script model and gave it a targetname: explosive_barrel. I added this line to my script:
exec global/barrel.scr
I shoot at the barrel but id did not explode.
I looked in the console and it said that the code of barrel.scr was not good.
local.self waittill death (global/barrel.scr, 96)
local.self ^
^~^~^ Script Error: invalid waittill death for 'ScriptSlave'
^~^~^ Add the following line to the *_precache.scr map script:
cache models/fx/barrel_gas_destroyed.tik
local.distance = vector_length (local.self.origin - $player.origin) (global/barrel.scr, 115)
local.distance = vector_length (local.self.origin - $player^
^~^~^ Script Error: Field 'origin' applied to NULL listener
I feel I am getting close, but need a little n00b help! I'll show you waht I am doing and how I understand it to work. It may help you realise why I am having trouble doing it!!
Now my understanding is that I can spawn a barrel or crate or whatever, and then add some extra lines below it to make it explode, or by a line like this:
'exec global/exploder.scr'
Under the level waittil spawn line.
Where am I going wrong??
ty for your time btw
You can discover what your enemy fears most by observing the means he uses to frighten you.
an exploder for the global/exploder.scr should have a script object targetname exploder or maybe a script model targetnamed exploder . In radiant you would make bits and pieces for fly out of the explosion and make them script objects and target name them exploderchunks then you would make scipt origins for where the chunks are going to land and have the chunks target the script origins . Then you would make a script model targetname exploderfire and give it a model name that is the explosion you wanted . Give all them the same key:#set and the same value: like 1 or something . Not easy to do this just scripting .
For a barrel you spawn a func_barrel then give it a key: setsize and then the size you want to use and a key barreltype and a value of either gas water or oil . but to do this is not good because you can't say what shader to use for the texture . I never tried it but maybe you can give the func_barrel a model . I don't think so but I never tried it .
maybe if you spawn a script_model and targetname it exploder I think there maybe a crate model and spawned a script_model for the exploderfire you could do that much anyway but you need to do this before you exec global/exploder at the beginning of you script . If for the exploderfire you used models/fx/fx_tank_explosion.tik it spawns chunks or gibs something like chunks anyway . The other chunks would be hard to script and they won't have textures anyway except maybe the black texture with yellow lines maybe . If your going to do that much maybe try and make the chucks script models too and spawn the script origins to target the chunks to but you can get away with just an exploder and exploderfire same set #