Scripts / CampFire

Author
Message
SS slothman
9
Years of Service
User Offline
Joined: 5th Nov 2014
Location: UK
Posted: 9th Jan 2015 09:26
so i need an usable campfire that the player can light and put out.
has anyone got one or how could make one myself(bearing in mind i am new to coding).
PM
Avram
GameGuru TGC Backer
17
Years of Service
User Offline
Joined: 3rd Sep 2006
Location: Serbia
Posted: 9th Jan 2015 22:22
It should be easy to make a script where you can light and put out fire, along with sound/light/smoke effect. Unfortunately at this moment only particle system Reloaded supports is smoke as far as I know, so you can't have "real" burning fire, only smoke with sound (and optional light which would be turned on/off by the script )

SS slothman
9
Years of Service
User Offline
Joined: 5th Nov 2014
Location: UK
Posted: 10th Jan 2015 11:40
that would be fine,but how would do this????
i am new to coding.
PM
Avram
GameGuru TGC Backer
17
Years of Service
User Offline
Joined: 3rd Sep 2006
Location: Serbia
Posted: 10th Jan 2015 12:20
1) Learn LUA
2) Draw graph of problem/solution
3) Read from graph and write LUA code
4) ?????
5) Profit!

I'm kidding, I'm working right now, will try to make it later when I get to my desktop, where my Reloaded is installed (unless smallg or someone else makes it before me)

AuShadow
GameGuru TGC Backer
10
Years of Service
User Offline
Joined: 2nd Dec 2013
Location: Australia
Posted: 10th Jan 2015 13:18
SS slothman you have been asking for a few scripts now with no evidence of actually trying to write any, please show us that you are trying to learn and not just getting everyone else to do it all for you, there are some easy to follow tutorials you just need to find them.

PC Specs: Windows 7 home 64-bit, Amd 7900 3gb DDR5 graphics, 8gb DDR3 Ram, Intel i7 3.4ghz
SS slothman
9
Years of Service
User Offline
Joined: 5th Nov 2014
Location: UK
Posted: 10th Jan 2015 14:26
i have and it didnt work here is the code:

- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- Player Desrtoys obect by pressing E
-- By ss slothman

function object_destroy_main(e)
PlayerDX = g_Entity[e]['x'] - g_PlayerPosX;
PlayerDy = g_Entity[e]['y'] - g_PlayerPosY;
PlayerDZ = g_Entity[e]['z'] - g_PlayerPosZ;
PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDx)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));

if PlayerDist < 80 then
Prompt ("Press E to Destroy object");
if KeyPressE == 1 then
Destroy(e)
end
end
end

what is wrong with it??
PM
Angiel
9
Years of Service
User Offline
Joined: 21st Dec 2014
Location: Italy
Posted: 10th Jan 2015 14:54 Edited at: 10th Jan 2015 15:21
if KeyPressE == 1 then.........But does it work? (I have not had time to try, I'm busy with Unity)

I use:

if g_KeyPressE == 1 then



instead of using:

PlayerDX = g_Entity[e]['x'] - g_PlayerPosX;

PlayerDy = g_Entity[e]['y'] - g_PlayerPosY;

PlayerDZ = g_Entity[e]['z'] - g_PlayerPosZ;

PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDx)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));



I use (it's short):

PlayerDist =GetPlayerDistance (e);

sorry for my bad English, I write from Italy.
SS slothman
9
Years of Service
User Offline
Joined: 5th Nov 2014
Location: UK
Posted: 10th Jan 2015 15:26
thanks will try this out later.
PM
Avram
GameGuru TGC Backer
17
Years of Service
User Offline
Joined: 3rd Sep 2006
Location: Serbia
Posted: 10th Jan 2015 15:58
Please wrap your codes into tags when posting them, as not using these tags makes your posts un-readable (or not pleasant for reading at least).

The script you posted simply destroys the object when user press E [no light/smoke/sound]. It should work if you do what Angiel told you, though.

SS slothman
9
Years of Service
User Offline
Joined: 5th Nov 2014
Location: UK
Posted: 10th Jan 2015 17:30 Edited at: 10th Jan 2015 17:44
yes i know thats just a simple script that i put on to show certain people that i AM trying to learn lua.

so to do a campfire script i think i will need the following

1) a fire sound effect,what sound file types can i use for realoaded(.mp3,etc).



2)smoke,i dont really know where to start with this?????



3)Light,so i suppose i could use one of the ready made lights,would i set so it spawns when you press E,will that work?



also whats an entity index,cos i see a command: Spawn(entity index),could i use that for my camp fire script(to spawn a light).



EDIT: have found a fire effect sound on the store, ignore point 1).
PM
Avram
GameGuru TGC Backer
17
Years of Service
User Offline
Joined: 3rd Sep 2006
Location: Serbia
Posted: 10th Jan 2015 19:51
2) StartParticleEmitter(e) to start smoke, StopParticleEmitter(e) to stop it
3) ShowLight(e) ti show light, HideLight(e) to hide it

entity index is "e" which you get as an argument in your _main(e) function

The Next
TGC Web Engineer
16
Years of Service
User Offline
Joined: 3rd Dec 2007
Location: United Kingdom
Posted: 10th Jan 2015 22:41
@SS slothman

This is not a request board, I will allow this thread and your others for now, as you have shown evidence you have made an attempt to code yourself.

However in future please post your existing code in the first post you make and in corr
PM
SS slothman
9
Years of Service
User Offline
Joined: 5th Nov 2014
Location: UK
Posted: 11th Jan 2015 10:37
ok thanks for all the help,will do as The Next says in future.
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 11th Jan 2015 11:59
you cant spawn lights but you can hide & show them via your own script

-you need an entity to use as a fire
-apply the sound to sound slot 0
-place a light underneath it (adjust the range as required)
-insert the entity number of the light into my script

campfire.lua




life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 17th Jan 2015 12:55 Edited at: 17th Jan 2015 12:57
Or try this campfire who can hurt the player

Based on "campfire" script by smallg.







Smile today, tomorrow could be worse

http://bestradiolarry.ro/fpsarea

"The best forum, game software, operating system or web platform, it's that software which can give you most of the options and speed, not just amazing graphics."
perelect
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 7th Apr 2015 15:48
Im trying to get the light to work but I need help
Im using smallg's code

at line 6. I should change the = 2 to the name of the light? Right?

line 6. local lightnumber = 2

ie: local lightnumber = Light2 (name of my light is Light2)

I have already tried this but It didn't work the light. I also renamed the light to 2 . but that didn't work either.

I have the broken pallets with the campfire.lua and sound assigned that works but the light does not.
does the light need any properties changed?
the light has light1.lua assigned
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 7th Apr 2015 16:50
Quote: "ie: local lightnumber = Light2 (name of my light is Light2)"


As I can see lightnumber is a integer variable, does not string, so it is waiting for numerical value like 2.
You need the entity value.

entity value
When you place any entity in your map (even the player start marker), like now a light, so GG gives some entity value (number).
You need this number, so if this number is = 10, so... lightnumber =10.
You can see this entity value, down in GG status bar, when you place the light.

HTH

3com

Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 8.1 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
perelect
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 7th Apr 2015 18:37
Thanks that make sense now.
Thanks for the entity value (number). I have never noticed that before.
and the lights work.....
Thankyou
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 8th Apr 2015 18:23
You are welcome, glad you solve it.

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 8.1 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM

Login to post a reply

Server time is: 2024-05-23 23:06:10
Your offset time is: 2024-05-23 23:06:10