need scripting help
			13 posts			 • Page 1 of 1		
	
need scripting help
long time ago I found this health bar on phunbox and I was going to use that scrip on one of my scenes but I can't find it anywhere now. Could some nice person make me that kind of script?? also I need scripted gun witch shoots killer bullets. I'll give credit when I finish the scene
			
		- someone666
 - Posts: 3
 - Joined: Mon Mar 22, 2010 8:21 pm
 
Re: need scripting help
could you explain the health bar??
			
		- Code: Select all
 (e)=>{scene.addcircle({radius := 0.05; color := [0.2, 0.2, 0.2, 1.0]; killer := true})}
- 
				

Rideg - Posts: 948
 - Joined: Tue Dec 15, 2009 5:17 pm
 - Location: Östersund, Sweden
 
Re: need scripting help
Well for a health bar there is a long process you need to do. 
I'll sum it up for an easyier version
Need advanced mode ON
Create a Variable
Press ~ to open up the console and type
Create a health bar in text place
Select all of the person, in airfrictionmult type
on the objects that the health bar represents in on collide write
For objects you want to damage the person makes their Controlleracc 23, for thing that you want to heal the person make their Controlleracc 21
Also for a better gun
Oncollide the bullets will fire towards the users mouse.
scene.addcircle({radius := 0.05; color := [0.2, 0.2, 0.2, 1.0];pos := e.pos; immortal := true; killer := true; vel := (app.Mousepos - e.pos) * 10})
							I'll sum it up for an easyier version
Need advanced mode ON
Create a Variable
Press ~ to open up the console and type
- Code: Select all
 Scene.my.Health = 100;
scene.my.alive = 2
Create a health bar in text place
- Code: Select all
 {"Health: " + scene.my.Health}
Select all of the person, in airfrictionmult type
- Code: Select all
 {scene.my.alive}
on the objects that the health bar represents in on collide write
- Code: Select all
 {e.other.controlleracc == 23}?{scene.my.health = scene.my.health - 1}:{}; {e.other.controlleracc == 21}?{scene.my.health = scene.my.health + 10; e.other.airfrictionmult = NaN}:{}; {scene.my.health < 1}?{scene.my.alive = scene.my.alive = NaN}:{}
For objects you want to damage the person makes their Controlleracc 23, for thing that you want to heal the person make their Controlleracc 21
Also for a better gun
Oncollide the bullets will fire towards the users mouse.
scene.addcircle({radius := 0.05; color := [0.2, 0.2, 0.2, 1.0];pos := e.pos; immortal := true; killer := true; vel := (app.Mousepos - e.pos) * 10})
Last edited by Mystery on Thu Mar 25, 2010 2:23 am, edited 3 times in total.									
			
		- 
				

Mystery - Posts: 2802
 - Joined: Thu Sep 03, 2009 1:16 pm
 - Location: Southern Australia
 
Re: need scripting help
i have a texture variety ammo bar in this scene (just look a little right and press F) which you could repurpose for whatever
			
		- Mr_Stabby
 - Posts: 155
 - Joined: Wed Dec 16, 2009 12:16 am
 
Re: need scripting help
Don't spam your scenes. That has little relevance to the topic.
			
		- 
				

Mystery - Posts: 2802
 - Joined: Thu Sep 03, 2009 1:16 pm
 - Location: Southern Australia
 
Re: need scripting help
what I ment with health bar was that you hit with something it and loses health and when it reach zero it dies
			
		- someone666
 - Posts: 3
 - Joined: Mon Mar 22, 2010 8:21 pm
 
Re: need scripting help
I edited my first post to include all of that, he will simply disappear. If you want anything fancier you'll need to do it your self, things get too complicated to explain.
			
		- 
				

Mystery - Posts: 2802
 - Joined: Thu Sep 03, 2009 1:16 pm
 - Location: Southern Australia
 
Re: need scripting help
my phun crashes every time I try to heal the personand person won't die when health reach zero
			
		- someone666
 - Posts: 3
 - Joined: Mon Mar 22, 2010 8:21 pm
 
Re: need scripting help
it's a bug in phun. you can't set an objects density to 0. it only works in algodoo.
you have to do it another way in phun for example airfrictionmult = NaN but you need air friction turned on for it to work.
			you have to do it another way in phun for example airfrictionmult = NaN but you need air friction turned on for it to work.

- 
				

KarateBrot - Posts: 825
 - Joined: Mon Aug 31, 2009 7:32 pm
 - Location: Germany
 
Re: need scripting help
Edited my first post for phun. 
But remember since this is the algodoo section you need to post you are using phun or we will assume you have algodoo.
			
		But remember since this is the algodoo section you need to post you are using phun or we will assume you have algodoo.
- 
				

Mystery - Posts: 2802
 - Joined: Thu Sep 03, 2009 1:16 pm
 - Location: Southern Australia
 
Re: need scripting help
I think you have to edit it again and change blah = nan to blah = NaN. i once wondered if you can also type NaN in without capital letters and it didn't work.
			
- 
				

KarateBrot - Posts: 825
 - Joined: Mon Aug 31, 2009 7:32 pm
 - Location: Germany
 
Re: need scripting help
Weird but thyme is supposed to not be capital sensitive. 
Changed it regardless.
			
		Changed it regardless.
- 
				

Mystery - Posts: 2802
 - Joined: Thu Sep 03, 2009 1:16 pm
 - Location: Southern Australia
 
Re: need scripting help
yeah i know but this value seems to be case sensitive. i dunno. didn't test it yet. it was in 1.6 last year when i typed it in
			
- 
				

KarateBrot - Posts: 825
 - Joined: Mon Aug 31, 2009 7:32 pm
 - Location: Germany
 
			13 posts			 • Page 1 of 1		
	Who is online
Users browsing this forum: No registered users and 6 guests


			


