Barrels

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
martijn_NL
Map Reviewer
Posts: 156
Joined: Mon Apr 14, 2003 5:33 pm
Location: The Netherlands
Contact:

Barrels

Post by martijn_NL »

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

local.distance = vector_length (local.self.origin - $player.origin) (global/barrel.scr, 115)
local.distance = vector_length (local.self.origin ^

^~^~^ Script Error: binary '-' applied to incompatible types 'vector' and 'NIL'

local.distance = vector_length (local.self.origin - $player.origin) (global/barrel.scr, 115)
local.distance = ^

^~^~^ Script Error: Cannot cast 'NIL' to vector

if (local.distance <= local.check_distance) //*** inner distance check (global/barrel.scr, 120)
if (local.distance ^

^~^~^ Script Error: binary '<=' applied to incompatible types 'NIL' and 'float'

else if (local.distance <= local.outter_distance) //*** outter distance check (global/barrel.scr, 131)
else if (local.distance ^

^~^~^ Script Error: binary '<=' applied to incompatible types 'NIL' and 'float'

^~^~^ No explosive launch barrels in the level!!
So i hope someone know a solution for this
Mapping 4 life
SlasherZ
Colonel
Posts: 433
Joined: Fri Jul 11, 2003 12:55 pm
Contact:

Post by SlasherZ »

you can just make a func_barrel and hit n and mess with the properties
User avatar
martijn_NL
Map Reviewer
Posts: 156
Joined: Mon Apr 14, 2003 5:33 pm
Location: The Netherlands
Contact:

Post by martijn_NL »

thanks it worked at last
Mapping 4 life
perv
Private
Posts: 5
Joined: Thu Sep 25, 2003 7:08 am
Location: Kent, UK
Contact:

Post by perv »

You fancy sharing it???

Been looking to add exp barrels to stock maps for months!!!!

ty
You can discover what your enemy fears most by observing the means he uses to frighten you.

Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Make your barrel a func_barrel and don't forget to use

key: barreltype
Value: gas // or water or oil
perv
Private
Posts: 5
Joined: Thu Sep 25, 2003 7:08 am
Location: Kent, UK
Contact:

Post by perv »

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!!

Here Is what I have done so far:

Code: Select all

// DESTROYED VILLAGE

main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "DeVaStAtEd ViLLaGe"
setcvar "g_obj_alliedtext2" "Mod by ]-[ss Pervyboy"
setcvar "g_obj_alliedtext3" "perv@pervyboy.com"
setcvar "g_obj_axistext1" "www."
setcvar "g_obj_axistext2" "herbalistsnipersquad"
setcvar "g_obj_axistext3" ".co.uk"

setcvar "g_scoreboardpic" "mohdm2"

	level waittill prespawn

	//*** Precache Dm Stuff
	exec global/DMprecache.scr

	exec global/door_locked.scr::lock
	level.script = maps/dm/mohdm2.scr
	exec global/ambient.scr mohdm2
	exec global/dm2dog.scr

	level waittill spawn
	exec global/dead_bodies_and_blood.scr::setup 1 1 30 1	

	thread kris
	thread tiger
	thread plane
	thread hello
	thread welcome
	thread teamnumber
	thread pulsating_fog

	local.fire5 = spawn script_model
	local.fire5 model "models/emitters/fireandsmoke.tik"	// 
	local.fire5.origin = ( -2202 -701 240)
	local.fire5.angles = (0 90 0)

	local.breath = spawn script_model
	local.breath model "emitters/ddaysmoke2.tik" //Smoke from the plane crash
	local.breath.origin = ( -2600 1430 340 )
	local.breath.angle = (0 0 0)

	local.tigertank_d = spawn models/vehicles/fockwulf_d.tik	//plane crashed
	local.tigertank_d.origin = ( -2600 1430 340 )
	local.tigertank_d.angle = 90
	local.tigertank_d solid

	local.fockwulffire = spawn script_model 
	local.fockwulffire model "models/emitters/fireandsmoke.tik"	//plane crashed
	local.fockwulffire.origin = ( -2600 1530 370 )
	local.fockwulffire.angle = 270
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 :wink:
You can discover what your enemy fears most by observing the means he uses to frighten you.

Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

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 :P :lol: but you can get away with just an exploder and exploderfire same set #
Post Reply