need scripting help

About advanced scenes, and the Thyme scripting language used in Algodoo.

need scripting help

Postby someone666 » Mon Mar 22, 2010 8:28 pm

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

Postby Rideg » Mon Mar 22, 2010 10:53 pm

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})}
<-- Killer Ballz
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: need scripting help

Postby Mystery » Tue Mar 23, 2010 11:59 am

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
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.
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia

Re: need scripting help

Postby Mr_Stabby » Tue Mar 23, 2010 3:58 pm

i have a texture variety ammo bar in this scene (just look a little right and press F) which you could repurpose for whatever

Rating: rated 5.5
Filesize: 51.54 kB
Comments: 5
Ratings: 2
download
Mr_Stabby
 
Posts: 155
Joined: Wed Dec 16, 2009 12:16 am

Re: need scripting help

Postby Mystery » Wed Mar 24, 2010 8:26 am

Don't spam your scenes. That has little relevance to the topic.
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia

Re: need scripting help

Postby someone666 » Wed Mar 24, 2010 10:08 am

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

Postby Mystery » Wed Mar 24, 2010 11:49 am

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.
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia

Re: need scripting help

Postby someone666 » Wed Mar 24, 2010 10:49 pm

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

Postby KarateBrot » Thu Mar 25, 2010 12:09 am

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.
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: need scripting help

Postby Mystery » Thu Mar 25, 2010 1:13 am

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.
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia

Re: need scripting help

Postby KarateBrot » Thu Mar 25, 2010 2:04 am

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.
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: need scripting help

Postby Mystery » Thu Mar 25, 2010 2:24 am

Weird but thyme is supposed to not be capital sensitive.
Changed it regardless.
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia

Re: need scripting help

Postby KarateBrot » Thu Mar 25, 2010 4:23 pm

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
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 4 guests