Local.player lights

Post your scripting questions / solutions here

Moderator: Moderators

Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Local.player lights

Post by Barttje »

can someone help me:

Code: Select all

switch ( local.player )
{
	case 1:
		local.player light 0 1 0 200
	case 2:
		local.player light 0 0 1 200
	case 3:
		local.player light 1 0 0 200
}
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

whats the problem? :roll:

but you need to do this, regardless.

Code: Select all

switch ( local.player ) 
{ 
   case 1: 
      local.player light 0 1 0 200 
         break;
   case 2: 
      local.player light 0 0 1 200 
         break;
   case 3: 
      local.player light 1 0 0 200 
         break;
}
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

For the switch statement to work local.player would have to be a number for the case 1 case 2 case 3 to work and you can't assign light to a number only an object . We need to see more of the script to give you any help .
Image
GiffE1118
Warrant Officer
Posts: 137
Joined: Fri Aug 05, 2005 12:14 am
Contact:

Post by GiffE1118 »

lizardkid wrote:whats the problem? :roll:

but you need to do this, regardless.

Code: Select all

switch ( local.player ) 
{ 
   case 1: 
      local.player light 0 1 0 200 
         break;
   case 2: 
      local.player light 0 0 1 200 
         break;
   case 3: 
      local.player light 1 0 0 200 
         break;
}
post your whole script

if that is your whole script then ur missing alot

are you trying to make it so that a player lights up after triggering something or in its own thread.

u need to define local.player

something like this

Code: Select all

for (local.i = 0; local.i < $player.size; local.i++)
{
$player[local.i] light 0 0 0 0
}
that is if you want all players to glow

if your using a trigger use parm.other

if you are try to have it so his status changes (or does something in a loop) use self

eg

Code: Select all

for (local.i = 0; local.i < $player.size; local.i++)
{
if($player[local.i].health <= 100)
{
$player[local.i] thread make_me_glow
}
}
end

make_me_glow:
self light 0 1 0 200
wait 30
self light 0 0 0 0
end
thats just different ways to define a player, self, $player[local.i], and parm.other those are the most commonly used
www.95thDivision.com
Image

BOTTOM 125th Poster! lol
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Post by Barttje »

its a trigger, if you walk into it than you are getting differend color...

i have the trigger script but the colors are not doing it if i walk into the trigger... :?
so can someone help me
User avatar
ViPER
General
Posts: 1058
Joined: Fri Jan 14, 2005 5:48 pm
Location: California
Contact:

Post by ViPER »

Looks like GiffE1118 gave you the answer, post the whole script if not.
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Post by Barttje »

Code: Select all

local.trigCR = spawn trigger_multiple 
local.trigCR.origin = ( -990 -3010 -57 ) 
local.trigCR setsize ( -10 -10 -10 ) ( 10 10 10 ) 
local.trigCR setthread Peace_room 
local.trigCR message "***!You are now in CRAZY PEACE ROOM for 30 seconds!***" 
local.trigCR wait 0 
local.trigCR delay 0 




Peace_room: 
self waittill trigger 
local.player=parm.other 
if (local.player.isTrigger1==1) 
end 

local.player = parm.other 
local.player tele ( -2120 -3005 -120 ) 
$player stopwatch 30 
switch ( local.player )
{
	case 1:
		local.player light 0 1 0 200
	case 2:
		local.player light 0 0 1 200
	case 3:
		local.player light 1 0 0 200
}
local.player takeall 
wait 5
local.player stufftext "say Oh no, i'm getting crazy..!"
wait 25 
local.player respawn 
//if (local.player.health <= 0)
end 
GiffE1118
Warrant Officer
Posts: 137
Joined: Fri Aug 05, 2005 12:14 am
Contact:

Post by GiffE1118 »

like bdbodger using switch like that won do crud

unless u mean $player.size other than that u cant use it like that

are you trying to make the lights flicker? so he looks like hes going crazy?

try

Code: Select all

local.trigCR = spawn trigger_multiple 
local.trigCR.origin = ( -990 -3010 -57 ) 
local.trigCR setsize ( -10 -10 -10 ) ( 10 10 10 ) 
local.trigCR setthread Peace_room 
local.trigCR message "***!You are now in CRAZY PEACE ROOM for 30 seconds!***" 
local.trigCR wait 0 
local.trigCR delay 0 




Peace_room: 
self waittill trigger 
local.player = parm.other 
if (local.player.isTrigger1==1) 
end 

local.player = parm.other 
local.player tele ( -2120 -3005 -120 ) 
parm.other stopwatch 30  //$player is not defined use parm.other aka local.player
local.counter = 30
while(local.counter !=0)
{
local.counter -= 1
wait .25
      local.player light 0 1 0 200
wait .25
      local.player light 0 0 1 200
wait .25
      local.player light 1 0 0 200
wait .25
}

local.player takeall 
wait 5 
local.player stufftext "say Oh no, i'm getting crazy..!" 
wait 25 
local.player respawn 
//if (local.player.health <= 0) 
end 
and yes i did answer your question just not in full

the code above should make the player after triggering change colors really fast and stoner like for 30 seconds then it will take all his guns, make him say "Oh no, i'm getting crazy..!" then 25 secs later he will respawn

BUT, u do need to learn how to do this so

while is a looping command (keeps rececking as longs as the statement in the () are true or 1) hence why while(1) loops for ever. Loops need a wait in them. doesnt have to be long but like a waitframe will stop it from being a crashing script.

So in the example above it is saying in english:

while the counter does not equa ( != )l 0. then do this....
the counter was predefined to 3 above the loop and in the loops it subtracts 1. now to make it a second i had 4 X .25 waits between each wait was a different color he changed to.

Now onto the switch command

The switch command is basically a whole bunch of IF's
If you have taken geonmetry you would have learned about conditional statements.

IF's are a conditional statement that means this in geometry:

If ___Q_____, Then _____P____ .

Q is the hypothesis and P is the conclusion

so...

Code: Select all

if(local.player.isghey==1)
{    <---- These as bdogger taught me on TMT Starts And ends the statement
then do this
}
Now on to switch

Switch is when you want to test the same variable for different things

so

Code: Select all

switch ( local.message ) 
{ 
   case "1": 
      println "You NEED to have beaks
      break
   case "2": 
      println "after each of these"
      break
   case "3": 
      println "to stop it from checking the rest"
      break
}


The For Command means for as long as....
its like while but checks wats inside the () in a certain order

Now you were using:

Code: Select all

$player
That cant do anything

you can only use a defined player

Look at my other post to learn ways to define a player

self <------ When a player threads something he becomes self

eg...

Code: Select all

$player[local.i] thread blah
parm.other <----- Is a player that sets off a trigger

eg

Code: Select all

local.player = parm.other
$player[local.i] <------ Works in conjunction with the for command as show in my other post

good luck with your mod i hope this helps
www.95thDivision.com
Image

BOTTOM 125th Poster! lol
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Post by Barttje »

Thank you very much Giffe, but the trigger is doing someting weirt...

if i go into the trigger than the light are going filker they do that 30 seconds afther that the stopwatch is going and the time is going in... :? so i have to wait 60 seconds > that must be 30 seconds... :?:

(BTW about that - local.player.health <= 0 - how did i say that if you are going die, the trigger stops with stopwatch and no flikker anymore.. :D )

tnx
GiffE1118
Warrant Officer
Posts: 137
Joined: Fri Aug 05, 2005 12:14 am
Contact:

Post by GiffE1118 »

Code: Select all

local.trigCR = spawn trigger_multiple 
local.trigCR.origin = ( -990 -3010 -57 ) 
local.trigCR setsize ( -10 -10 -10 ) ( 10 10 10 ) 
local.trigCR setthread Peace_room 
local.trigCR message "***!You are now in CRAZY PEACE ROOM for 30 seconds!***" 
local.trigCR wait 0 
local.trigCR delay 0 




Peace_room: 
self waittill trigger 
local.player = parm.other 
if (local.player.isTrigger1==1) 
end 

local.player = parm.other 
local.player tele ( -2120 -3005 -120 ) 

//wait 30  // ???? is this what you are thinking of it will only delay the flicker from starting

local.counter = 30
parm.other stopwatch 30  //$player is not defined use parm.other aka local.player

while(local.counter !=0 [color=yellow]&& IsAlive local.player[/color])
{
local.counter -= 1
wait .25
      local.player light 0 1 0 200
wait .25
      local.player light 0 0 1 200
wait .25
      local.player light 1 0 0 200
wait .25
}

local.player takeall 
wait 5 
local.player stufftext "say Oh no, i'm getting crazy..!" 
wait 25 
local.player respawn 
//if (local.player.health <= 0) 
end 
try that

i moved the code around a bit but i dont see why it doesnt go while the stop watch is going. i also added the command

the way you use this is:

IsAlive local.player
^ ^
| ------------What ever you ideantified the player as and who.
---------------------- Command comes first

adding a wait wont do anything but delay the flickering from starting
www.95thDivision.com
Image

BOTTOM 125th Poster! lol
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Post by Barttje »

ive tried it, but now whole the map doesn't work :( :( :( :|
GiffE1118
Warrant Officer
Posts: 137
Joined: Fri Aug 05, 2005 12:14 am
Contact:

Post by GiffE1118 »

Bartjerambo wrote:ive tried it, but now whole the map doesn't work :( :( :( :|
lol oopps i had one of those damn bb codes in there

now try

Code: Select all

local.trigCR = spawn trigger_multiple 
local.trigCR.origin = ( -990 -3010 -57 ) 
local.trigCR setsize ( -10 -10 -10 ) ( 10 10 10 ) 
local.trigCR setthread Peace_room 
local.trigCR message "***!You are now in CRAZY PEACE ROOM for 30 seconds!***" 
local.trigCR wait 0 
local.trigCR delay 0 




Peace_room: 
self waittill trigger 
local.player = parm.other 
if (local.player.isTrigger1==1) 
end 

local.player = parm.other 
local.player tele ( -2120 -3005 -120 ) 

//wait 30  // ???? is this what you are thinking of it will only delay the flicker from starting 

local.counter = 30 
parm.other stopwatch 30  //$player is not defined use parm.other aka local.player 

while(local.counter != 0 && IsAlive local.player) 
{ 
local.counter -= 1 
wait .25 
      local.player light 0 1 0 200 
wait .25 
      local.player light 0 0 1 200 
wait .25 
      local.player light 1 0 0 200 
wait .25 
} 

local.player takeall 
wait 5 
local.player stufftext "say Oh no, i'm getting crazy..!" 
wait 25 
local.player respawn 
//if (local.player.health <= 0) 
end 
if u looked into the script u would have easily saw that. but i figure ur only after the code not the knowledge
www.95thDivision.com
Image

BOTTOM 125th Poster! lol
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Post by Barttje »

The script is doing it, but its the same as what is write befor...:

Thank you very much Giffe, but the trigger is doing someting weirt...

if i go into the trigger than the light are going filker they do that 30 seconds afther that the stopwatch is going and the time is going in... so i have to wait 60 seconds > that must be 30 seconds...
GiffE1118
Warrant Officer
Posts: 137
Joined: Fri Aug 05, 2005 12:14 am
Contact:

Post by GiffE1118 »

well im stumped i cant see anything wrong with it
www.95thDivision.com
Image

BOTTOM 125th Poster! lol
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

what are some of the console errors? is the script doing anything or has it failed entirely?
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Post Reply