Page 2 of 2
Posted: Fri Jun 17, 2005 3:42 pm
by wacko
err, still some difficulties:
Code: Select all
level.radar_light[local.i] = spawn script_object "scale" "0.5" "model" "fx/corona_red.tik"
is working
Code: Select all
level.radar_light[local.i] = spawn script_object "scale" "0.5"
level.radar_light[local.i].model = fx/corona_red.tik
isn't

Code: Select all
level.radar_light[local.i] = spawn script_object "scale" "0.5"
level.radar_light[local.i].model = "fx/corona_red.tik"
neither, btw
Posted: Fri Jun 17, 2005 4:07 pm
by Elgan
Code: Select all
level.radar_light[local.i] = spawn script_object "scale" "0.5"
level.radar_light[local.i] model = "fx/corona_red.tik"
no dot
Posted: Fri Jun 17, 2005 4:25 pm
by lizardkid
to make it simpler (and i know for sure that original line works) just do this.
Code: Select all
level.radar.light[local.i] = spawn fx/corona_red.tik "scale" "2.5"
that's the original line put into the array.
Posted: Fri Jun 17, 2005 7:10 pm
by wacko
regarding the spawning, the only lines I made kinda working are:
main:
level waittill spawn
thread the_radar_setup
thread the_radar
end
the_radar_setup:
level.map_x_min = -1664
level.map_x_max = 1664
level.map_y_min = -1664
level.map_y_max = 1664
level.radar_x_min = -320
level.radar_x_max = -256
level.radar_y_min = 256
level.radar_y_max = 320
level.map_x_size = (level.map_x_max - level.map_x_min)
level.map_y_size = (level.map_y_max - level.map_y_min)
level.radar_x_size = (level.radar_x_max - level.radar_x_min)
level.radar_y_size = (level.radar_y_max - level.radar_y_min)
level.radar_x_cen = level.radar_x_size / 2 + level.radar_x_min
level.radar_y_cen = level.radar_y_size / 2 + level.radar_y_min
level.final_x_pos = (level.map_x_size / level.radar_x_size)
level.final_y_pos = (level.map_y_size / level.radar_y_size)
level.clock = 0
end
the_radar:
while (1)
{
for (local.i=1;local.i<=$player.size;local.i++)
{
if(level.radar_light[local.i] == NIL || level.radar_light[local.i] == NULL)
{
switch ($player[local.i].dmteam)
{
case "allies":
level.radar_light[local.i] = spawn script_object "scale" "0.25" "model" "fx/corona_blue.tik"
goto switchend
case "axis":
level.radar_light[local.i] = spawn script_object "scale" "0.25" "model" "fx/corona_red.tik"
goto switchend
default:
level.radar_light[local.i] = spawn script_object "scale" "0.25" "model" "fx/corona_white.tik"
goto switchend
}
switchend:
}
if ((isAlive $player[local.i]) && (($player[local.i].dmteam == "allies") || ($player[local.i].dmteam == "axis") || ($player[local.i].dmteam == "freeforall")))
{
//floor offset---------------------------------------------------
level.radar_light[local.i].xoffset = 64
level.radar_light[local.i].yoffset = 0
if ($player[local.i].origin[2]<144)
{
level.radar_light[local.i].xoffset = 0
level.radar_light[local.i].yoffset = -64
}
if ($player[local.i].origin[2]>400)
{
level.radar_light[local.i].xoffset = 0
level.radar_light[local.i].yoffset = 0
}
//floor offset---------------------------------------------------
level.radar_light[local.i].origin = (($player[local.i].origin[0] / level.final_x_pos + level.radar_x_cen + level.radar_light[local.i].xoffset) (($player[local.i].origin[1] / level.final_y_pos) + level.radar_y_cen + level.radar_light[local.i].yoffset) 335)
wait .1
}
else
{
level.radar_light[local.i] remove
}
}
wait .1
if(level.radar_light.size >= 1 && level.radar_light.size > $player.size)
{
level.radar_light= waitthread take_extra_radars
}
}
end
take_extra_radars:
local.players = $player.size
for(local.i = level.radar_light.size;local.i > local.players;local.i--)
{
level.radar_light[local.i] remove
}
if(local.players >= 1)
{
for(local.i=1;local.i <= local.players;local.i++)
{
local.temp_array[local.i] = level.radar_light[local.i]
}
end local.temp_array
}
end
Everything else caused lots of errors in the console and not much more... Another typo? Maybe, but the way it is now, is ok 4 me.
Nevertheless, the whole script seems to be somehow buggy. I'm quite sure that sometimes corona wasn't changed when the player changed his team

And the coronas appear as soon as the players have chosen their team (i.e. before selecting a weapon and still being able to fly around).
Posted: Fri Jun 17, 2005 7:39 pm
by Elgan
what are the erros u get in console?
Posted: Fri Jun 17, 2005 7:54 pm
by wacko
Elgan wrote:what are the erros u get in console?
atm, i think i get none but with
Code: Select all
level.radar_light[local.i] = spawn fx/corona_red.tik "scale" "0.25"
I get s/th like
Code: Select all
Script error: You must specify an explicit classname for misc object tik models
and
Code: Select all
!*!*!* 'models/fx/corona_red.tik' was spawned as an Object at (0,0,0). Should be made into a static model or script model (# here is a #counting up)
But does this matter? Using
Code: Select all
level.radar_light[local.i] = spawn script_object "scale" "0.25" "model" "fx/corona_blue.tik"
is fine for me, isn't it?!
Posted: Fri Jun 17, 2005 8:09 pm
by Elgan
Code: Select all
level.radar_light[local.i] = spawn script_object "scale" "0.25" "model" "fx/corona_blue.tik"
sud be ok
but to sure it all just use script model and it will be happy
Code: Select all
level.radar_light[local.i] = spawn script_model "scale" "0.25" "model" "fx/corona_blue.tik"
Posted: Fri Jun 17, 2005 9:33 pm
by wacko
Elgan wrote:Code: Select all
level.radar_light[local.i] = spawn script_object "scale" "0.25" "model" "fx/corona_blue.tik"
sud be ok
Well, err, yes, that's what I said (tried to

). Problem rather seem to be all those if clauses, arrays, for-loops... Maybe I should add some more "wait .1" to give it a bit more time?
Elgan wrote:but to sure it all just use script model and it will be happy
Code: Select all
level.radar_light[local.i] = spawn script_model "scale" "0.25" "model" "fx/corona_blue.tik"
Huh? Don't see a difference to above

Posted: Fri Jun 17, 2005 10:14 pm
by Elgan
script_model not script_object
Posted: Fri Jun 17, 2005 10:22 pm
by wacko
Elgan wrote:script_model not script_object

omg, my eyes... i can't ... i don't ... i'm blind
Posted: Sat Jun 18, 2005 3:25 am
by bdbodger
switch ($player[local.i].dmteam)
{
case "allies":
level.radar_light[local.i] = spawn script_object "scale" "0.25" "model" "fx/corona_blue.tik"
goto switchend
case "axis":
level.radar_light[local.i] = spawn script_object "scale" "0.25" "model" "fx/corona_red.tik"
goto switchend
default:
level.radar_light[local.i] = spawn script_object "scale" "0.25" "model" "fx/corona_white.tik"
goto switchend
}
switchend:
}
The proper way to use a switch statement is like this useing label: or case #:
Code: Select all
switch (selection) statement
============================
Standard usage
--------------
switch (expr)
{
label1:
statement
...
statement
break
label2:
statement
...
statement
break
case 0:
statement
...
statement
break
case 1:
statement
...
statement
break
default:
statement
...
statement
break
}
The break ends the switch and goes to the next line after it , goto is very sloppy
Posted: Sat Jun 18, 2005 7:52 am
by wacko

, how could I? Thanks, m8.
bdbodger wrote:... goto is very sloppy
sloppy would mean, that the script err sometimes will and sometimes won't execute it?
Ok, then. I'm quite happy with the script now, after all the help I got
I've put everything into
that same pk3 and u can do whatever u like with it. Thanks for all the help again!!
Btw, I changed the Subject of this thread. It was supposed to be top secret, well it isn't anymore anyway

Posted: Sat Jun 18, 2005 8:50 am
by Rookie One.pl
Goto is an obsolete thingy - it origins from old programming languages.
And apparently you can use strings in case statements.
Posted: Sat Jun 18, 2005 1:41 pm
by bdbodger
Yes you can use strings or numbers
case 0:
or
allies:
or for some other test like testing for player model or JV's bots , this sample checked the player model then used the bot models but not the scripts
Code: Select all
switch(self.model)
{
models/player/allied_airborne.tik:
local.ent = human/multiplayer_allied_airborne_soldier.tik
break
models/player/allied_pilot.tik:
local.ent = human/multiplayer_allied_pilot.tik
break
models/player/allied_sas.tik:
local.ent = human/multiplayer_allied_oss_man.tik
break
switch and break go together goto is just ugly the same goes for while loops
Posted: Sat Jun 18, 2005 9:22 pm
by ViPER
Cool. YOU ARE HERE! LOL
need more peeps to check this out. "king of the map room" great idea!
CAUTION!! look out for teamspeak users working in pairs. lol