Lost + found
Moderator: Moderators
-
BatteryAziz
- Moderator
- Posts: 82
- Joined: Tue Jun 15, 2010 4:44 pm
those lines you posted have a bad syntax ("local mycurtain" should be local.mycurtain) so the script probably didn't load and nothing happened. you'll know the script is running when you hear the ambient sound when you load the map. if there's no ambient sound, there's a typo somewhere in your script.
try this:
local.mycurtain = spawn script_model "model" "static/curtain.tik"
local.mycurtain.origin = (-615.75 -493.78 32.20)
local.mycurtain.angles = (9 90 0)
local.mycurtain.scale = 1.0
local.mycurtain notsolid
local.mycurtain nodamage
local.mycurtain show
i think animated .tik models won't show when using script_object, hence i suggest spawning a script_model instead. also to be sure, double-check if your origin coordinates are correct.
if it still doesn't work, narrow it down by trying to spawn some other model (ammo, machine gun, truck) and see if that works.
try this:
local.mycurtain = spawn script_model "model" "static/curtain.tik"
local.mycurtain.origin = (-615.75 -493.78 32.20)
local.mycurtain.angles = (9 90 0)
local.mycurtain.scale = 1.0
local.mycurtain notsolid
local.mycurtain nodamage
local.mycurtain show
i think animated .tik models won't show when using script_object, hence i suggest spawning a script_model instead. also to be sure, double-check if your origin coordinates are correct.
if it still doesn't work, narrow it down by trying to spawn some other model (ammo, machine gun, truck) and see if that works.
here's a working script....... you can see where I put in relation to the whole script. I had to change the upper last number to raise it out of the ground ( it's in the court yard just above ground.).... had yo change angle ( first number because it was laying flat not up and down ) you need to change the middle and last numbers to move it to the doorway you want it in and to get it to face the right direction...... do not change the first number or it will not stand upright....... making it harder to see and find. ( YOU ALSO NEED TO MAKE IT NOTSOLID OR YOU WON'T BE ABLE TO WALK THROUGH IT. You can forget about the "immune" stuff. just delete it. Doesn't work without bounding boxes.
// STALINGRAD
// ARCHITECTURE: ZIED, POWZER
// SCRIPTING: POWZER
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" "Stalingrad"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" "stuff"
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "mohdm6"
// call additional stuff for playing this map round based is needed
if(level.roundbased)
thread roundbasedthread
level waittill prespawn
//*** Precache Dm Stuff
exec global/DMprecache.scr
exec global/door_locked.scr::lock
level.script = maps/dm/mohdm6.scr
exec global/ambient.scr mohdm6
level waittill spawn
local.fix1 = spawn script_model
local.fix1 model static/curtain.tik
local.fix1.origin = ( -295.56 102.98 -82.91 )
local.fix1.angles = ( 0.00 -165.45 0.00 )
local.fix1.scale = 1.0
local.fix1 solid
local.fix1 nodamage
local.fix1 immune bullet
local.fix1 immune fast_bullet
local.fix1 immune bash
local.fix1 immune mg
local.fix1 immune explosion
local.fix1 immune grenade
end
//-----------------------------------------------------------------------------
roundbasedthread:
// Can specify different scoreboard messages for round based games here.
level waitTill prespawn
level waittill spawn
// STALINGRAD
// ARCHITECTURE: ZIED, POWZER
// SCRIPTING: POWZER
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" "Stalingrad"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" "stuff"
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "mohdm6"
// call additional stuff for playing this map round based is needed
if(level.roundbased)
thread roundbasedthread
level waittill prespawn
//*** Precache Dm Stuff
exec global/DMprecache.scr
exec global/door_locked.scr::lock
level.script = maps/dm/mohdm6.scr
exec global/ambient.scr mohdm6
level waittill spawn
local.fix1 = spawn script_model
local.fix1 model static/curtain.tik
local.fix1.origin = ( -295.56 102.98 -82.91 )
local.fix1.angles = ( 0.00 -165.45 0.00 )
local.fix1.scale = 1.0
local.fix1 solid
local.fix1 nodamage
local.fix1 immune bullet
local.fix1 immune fast_bullet
local.fix1 immune bash
local.fix1 immune mg
local.fix1 immune explosion
local.fix1 immune grenade
end
//-----------------------------------------------------------------------------
roundbasedthread:
// Can specify different scoreboard messages for round based games here.
level waitTill prespawn
level waittill spawn
so remember just change the upper last number to get altitude.... it's at -82 now... making it -62 will raise it....... and by the time you get it to the height of that door way you will not be in negative territory but positive ( no - sign. ) everything after that is with angles...... middle and las nubers only....... don't touch the 0.00..........
-
SilentAngel
- Captain
- Posts: 239
- Joined: Wed Mar 12, 2008 8:27 pm
A little help is needed!
Hi guys, since I do not remember anything about scripting I need help to fix this code:
let's suppose that I set ingame Model_coords as "111 222 333" and Model_angles as "0 0 0".
the console reports that local.origin[1][2], local.origin[1][3],local.angles[1][2] and local.angles[1][3] are NIL so I cannot cast them to float. I don't understand why they are NIL and not
local.origin[1][2] = 222
local.origin[1][3] = 333
local.angles[1][2] = 0
local.angles[1][3] = 0
Am I missing something?
Code: Select all
while(int(getcvar(InGameBuilder)) != 0)
{
if((getcvar(IGB_Display)) != "")
{
local.model = getcvar(IGB_Model)
local.origin = waitexec global/strings.scr::split_line getcvar(Model_coords) 1 " "
local.angles = waitexec global/strings.scr::split_line getcvar(Model_angles) 1 " "
local.o1 = float(local.origin[1][1])
local.o2 = float(local.origin[1][2])
local.o3 = float(local.origin[1][3])
local.v1 = float(local.angles[1][1])
local.v2 = float(local.angles[1][2])
local.v3 = float(local.angles[1][3])
//add the object..
local.obj = spawn script_model
local.obj model local.model
local.obj.origin = ( local.o1 local.o2 local.o3 )
local.obj.angles = ( local.v1 local.v2 local.v3 )
local.obj.scale = 1.0
local.obj solid
setcvar "IGB_Display" ""
setcvar "Model_coords" ""
setcvar "Model_angles" ""
}
wait 0.5
}
the console reports that local.origin[1][2], local.origin[1][3],local.angles[1][2] and local.angles[1][3] are NIL so I cannot cast them to float. I don't understand why they are NIL and not
local.origin[1][2] = 222
local.origin[1][3] = 333
local.angles[1][2] = 0
local.angles[1][3] = 0
Am I missing something?
-
SilentAngel
- Captain
- Posts: 239
- Joined: Wed Mar 12, 2008 8:27 pm
it's the one from Elgan:
Code: Select all
// ----------------------------------------------------------------------------------------------------------------------
// Used to split a line of words into a array of words. return with word count
// localinfo == line to split
// local.say = say to admins input detected or not, set 1 usualy
// local.spacer = What to use to split the line. If none is set then " " will be used.
// usage local.wordarray = waitexec global/strings.scr::split_line ( STRING STRING , CONSOLE FEEDBACK, STRING SPACER)
//
//eg
// local.wordarray = waitexec global/strings.scr::split_line "hello_mummy" 1 "_"
// local.wordarray is a const array
//
// local.wordarray[1] = array of words
// local.wordarray[2] word count
// local.wordarray[3] full string with " " spaces
//
// local.wordarray[1][1] is 'hello'
// local.wordarray[1][1] is 'mummy'
//
// local.wordarray[2] is 2 'two words'
//
// local.wordarray[3] is 'hello mummy'
// ----------------------------------------------------------------------------------------------------------------------
split_line local.info local.dont_say local.spacer:
local.wordcount = 1
if(local.spacer==NIL)
{
if(local.info[0] == "`")
{
local.spacer = "_"
local.start = 1
}
else if(local.info[0] == " " || local.info[0] == "")
{
local.spacer = " "
for(local.i = 0;local.i <= local.info.size;local.i++)
{
if(local.info[local.i] != " " && local.info[local.i] != "")
{
local.start = local.i
break
}
}
}
else
{
local.spacer = " "
local.start = 0
}
}
else
{
local.start = 0
local.altcheck = 1
}
for(local.i=local.start;local.i<=local.info.size - 1;local.i++)
{
if(local.info[local.i]!=local.spacer && local.info[local.i] != "`")
{
if(local.words[local.wordcount]==NIL)
{
local.words[local.wordcount]=""
}
local.words[local.wordcount] += local.info[local.i]
}
else
{
if(local.altcheck != 1)
{
if(local.spacer == "_" && local.info[local.i + 1] == "`") // if its like ui_hud 1. sud be ui_`hud so it knows:).
{
local.words[local.wordcount] += local.info[local.i]
}
else if(local.spacer == "_" && local.info[local.i ] != "`")
{
local.wordcount++
}
else if(local.spacer == " " && local.info[local.i ] == " ")
{
if(local.i != local.info.size - 1)
{
if(local.info[local.i + 1] != " " && local.info[local.i + 1] != NIL)
{
local.wordcount++
}
}
}
}
else
{
if(local.info[local.i ] == local.spacer)
{
local.wordcount++
}
}
}
}
if(local.spacer == "_")
{
local.actual = ""
for(local.i=3;local.i<=local.words.size;local.i++)
{
if(local.i < local.words.size)
{
local.space = " "
}
else
{
local.space = ""
}
local.actual += ( local.words[local.i] + local.space )
}
if(local.dont_say != 1)
{
//exec global/ac/console_feedback.scr ( "> Input detected: " + local.actual )
}
}
else
{
if(local.dont_say != 1)
{
//exec global/ac/console_feedback.scr ( "> Input detected: " + local.info)
local.actual = local.info
}
}
end ( local.words::local.wordcount::local.actual)
-
SilentAngel
- Captain
- Posts: 239
- Joined: Wed Mar 12, 2008 8:27 pm
If can help this is what shows the console:
Code: Select all
]set IGB_Model "static/indycrate.tik"
]set Model_coords "111 222 333"
]set Model_angles "0 0 0"
]set IGB_Display 1
getcvarModel_coords
getcvar
local.o2 = float(local.origin[1][2]) (global/igb.scr, 38)
local.o2 = ^
^~^~^ Script Error: Cannot cast 'NIL' to float
local.o3 = float(local.origin[1][3]) (global/igb.scr, 39)
local.o3 = ^
^~^~^ Script Error: Cannot cast 'NIL' to float
local.v2 = float(local.angles[1][2]) (global/igb.scr, 41)
local.v2 = ^
^~^~^ Script Error: Cannot cast 'NIL' to float
local.v3 = float(local.angles[1][3]) (global/igb.scr, 42)
local.v3 = ^
^~^~^ Script Error: Cannot cast 'NIL' to float
local.obj.origin = ( local.o1 local.o2 local.o3 ) (global/igb.scr, 47)
local.obj.origin = ^
^~^~^ Script Error: Cannot cast 'NIL' to float
local.obj.origin = ( local.o1 local.o2 local.o3 ) (global/igb.scr, 47)
local.obj^
^~^~^ Script Error: Cannot cast 'NIL' to vector
local.obj.angles = ( local.v1 local.v2 local.v3 ) (global/igb.scr, 48)
local.obj.angles = ^
^~^~^ Script Error: Cannot cast 'NIL' to float
local.obj.angles = ( local.v1 local.v2 local.v3 ) (global/igb.scr, 48)
local.obj^
^~^~^ Script Error: Cannot cast 'NIL' to vector
getcvarModel_coords
getcvar
local.o2 = float(local.origin[1][2]) (global/igb.scr, 38)
local.o2 = ^
^~^~^ Script Error: Cannot cast 'NIL' to float
local.o3 = float(local.origin[1][3]) (global/igb.scr, 39)
local.o3 = ^
^~^~^ Script Error: Cannot cast 'NIL' to float
local.v2 = float(local.angles[1][2]) (global/igb.scr, 41)
local.v2 = ^
^~^~^ Script Error: Cannot cast 'NIL' to float
local.v3 = float(local.angles[1][3]) (global/igb.scr, 42)
local.v3 = ^
^~^~^ Script Error: Cannot cast 'NIL' to float
local.obj.origin = ( local.o1 local.o2 local.o3 ) (global/igb.scr, 47)
local.obj.origin = ^
^~^~^ Script Error: Cannot cast 'NIL' to float
local.obj.origin = ( local.o1 local.o2 local.o3 ) (global/igb.scr, 47)
local.obj^
^~^~^ Script Error: Cannot cast 'NIL' to vector
local.obj.angles = ( local.v1 local.v2 local.v3 ) (global/igb.scr, 48)
local.obj.angles = ^
^~^~^ Script Error: Cannot cast 'NIL' to float
local.obj.angles = ( local.v1 local.v2 local.v3 ) (global/igb.scr, 48)
local.obj^
^~^~^ Script Error: Cannot cast 'NIL' to vector
-
SilentAngel
- Captain
- Posts: 239
- Joined: Wed Mar 12, 2008 8:27 pm
did this:
instead of this:

Code: Select all
local.coords = getcvar(Model_coords)
local.origin = waitexec global/strings.scr::split_line local.coords 1 " " Code: Select all
local.origin = waitexec global/strings.scr::split_line getcvar(Model_coords) 1 " " -
SilentAngel
- Captain
- Posts: 239
- Joined: Wed Mar 12, 2008 8:27 pm
Break all breakable windows
Someone have a idea to automatically break all windows on a stock map at start up?
-
BatteryAziz
- Moderator
- Posts: 82
- Joined: Tue Jun 15, 2010 4:44 pm
