Question regarding laser scripting
			10 posts			 • Page 1 of 1		
	
Question regarding laser scripting
Hi. I'm looking for a way when a laser hits an object I can retrieve the information of the laser for example the fade distance etc. I can't figure it out for myself so I hope u guys have a solution for me.
			
		- Vytas
- Posts: 49
- Joined: Mon Oct 26, 2009 8:18 pm
Re: Question regarding laser scripting
e.laser.followed by whatever else is in the script menu of the laser.
			
		- 
				 
 standardtoaster
- Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: Question regarding laser scripting
Well I have one question remaining. Is there a way to get an reference too the laser object when the laser hits nothing. for example an object collides with another object and this way it activates the laser
			
		- Vytas
- Posts: 49
- Joined: Mon Oct 26, 2009 8:18 pm
Re: Question regarding laser scripting
Somewhat, yes.
Make a variable:
In the maxrays part of the laser script menu put:
In the onCollide of the objects put:
			
		Make a variable:
- Code: Select all
- scene.my.rays = 0
In the maxrays part of the laser script menu put:
- Code: Select all
- {scene.my.rays}
In the onCollide of the objects put:
- Code: Select all
- scene.my.rays = 1000
 //or any value higher than 0
- 
				 
 standardtoaster
- Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: Question regarding laser scripting
Ok that's all thank you.
			
		- Vytas
- Posts: 49
- Joined: Mon Oct 26, 2009 8:18 pm
Re: Question regarding laser scripting
I have a problem with the script I made. 
scene.my.laser1 controls how much rays my laser has got and that works. But I want it to switch on and off each time it collides with an object. So i made this:
Do u know what the problem is?
			
		scene.my.laser1 controls how much rays my laser has got and that works. But I want it to switch on and off each time it collides with an object. So i made this:
- Code: Select all
- (e) => {scene.my.laser1 = 1 ? {scene.my.laser1 = 0} : {scene.my.laser1 = 1}} // this doesn't work
 (e) => {true ? {scene.my.laser1 = 1} : {scene.my.laser1 = 0}} //this will activate the laser but not put it off with an other collide ofcourse.
Do u know what the problem is?
- Vytas
- Posts: 49
- Joined: Mon Oct 26, 2009 8:18 pm
Re: Question regarding laser scripting
Yup
			- Code: Select all
- (e) => {scene.my.laser1 == 1 ? {scene.my.laser1 = 0} : {scene.my.laser1 = 1}} // this works.
If you have a question, have a dollar and call somebody that cares.
No really just PM me if you have a problem
		No really just PM me if you have a problem

- 
				 
 Sniperkasa
- Posts: 493
- Joined: Tue Sep 01, 2009 5:34 pm
- Location: The bottom of a lake.
Re: Question regarding laser scripting
Ah I see what I did wrong I used the wrong operator.
			
		- Vytas
- Posts: 49
- Joined: Mon Oct 26, 2009 8:18 pm
Re: Question regarding laser scripting
`Yup, remember to use ==, not =..
= is when you declare an variable
			= is when you declare an variable
If you have a question, have a dollar and call somebody that cares.
No really just PM me if you have a problem
		No really just PM me if you have a problem

- 
				 
 Sniperkasa
- Posts: 493
- Joined: Tue Sep 01, 2009 5:34 pm
- Location: The bottom of a lake.
			10 posts			 • Page 1 of 1		
	Who is online
Users browsing this forum: No registered users and 5 guests





