Spawn things in stock maps (not new)

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
|NSC|-Steelie-NS*LR*
Sergeant
Posts: 54
Joined: Mon Dec 27, 2004 11:24 am
Location: The Netherlands
Contact:

Spawn things in stock maps (not new)

Post by |NSC|-Steelie-NS*LR* »

Hi there,

I've seen this on the Rjukan Project's site:

// Spawn a script model and give it a targetname
local.flak = spawn script_model "targetname" "flak88"
// Set the model to be drawn/used
local.flak model "statweapons/flak88turret.tik"
// Set where it should be
local.flak.origin = ( -100.0 .0 0.0 )
// Set where it should point at
local.flak.angles = ( 0.0 0.0 0.0 )
// Set how big it should be
local.flak.scale = 1.0

It says 'local.flak', but how do you know what to put there if you wanna, for example, put a wardrobe in it? where do you got that 'local thingy' from? Maybe I'm a n00b, but please answer! :lol:
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Re: Spawn things in stock maps (not new)

Post by Rookie One.pl »

|NSC|-Steelie-NS*LR* wrote:local.flak = spawn script_model "targetname" "flak88"
This line tells you what local.flak is. ;)
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

local.flak is just a varaiable name you can call it local.noob if you want , it is just used to set the values like what model to use . A local variable is local to the thread it is used in when the thread ends it is forgotten unlike a level variable . If he had used level.flak then in another thread he could have used level.flak remove for example and it would be removed you can't do that with a local variable except from the thread it is in unless you pass the value to a new thread like this

start:

local.noob = spawn script_model
....
....
bla bla
....
thread mythread local.noob

end

mythread local.incoming:

local.incoming remove

end

you see that only the value was passed not the variable name local.noob and local.incoming are the same thing , in the second thread local.noob does not exist the game will say it is NIL if you try to use it .
Image
User avatar
|NSC|-Steelie-NS*LR*
Sergeant
Posts: 54
Joined: Mon Dec 27, 2004 11:24 am
Location: The Netherlands
Contact:

Post by |NSC|-Steelie-NS*LR* »

k, thanx
Post Reply