Hi! Welcome to the forum for Platinum Arts Sandbox Free 3D Game Maker. I currently have the forums locked as I am attempting to properly update them.
In the meantime please join the new Discord Server!
If you have any questions please e-mail me through the Platinum Arts website.
In the meantime please join the new Discord Server!
If you have any questions please e-mail me through the Platinum Arts website.
swimming question
-
- Member
- Posts: 5
- Joined: December 9th, 2010, 8:57 pm
- Name: Nathan
swimming question
HI guys, I have an area in a map that consists of a lot of swimming. I was hopping that there was a way in 2.6 to put a time limit on how long you can be underwater until your character dies. If so can you let me know? thanks all.
-
- Support Team
- Posts: 2734
- Joined: January 13th, 2010, 12:42 pm
- Name: Timothy
- IRC Username: I use Steam
- Location: Looking over your shoulder...
- Contact:
Re: swimming question
Well, there are a couple of ways that is possible.
1) Code a timer for the water that eventually kills you if you don't get out quickly enough (kinda like the lava only it takes longer to die)
2) Make a level_trigger that automatically starts hurting you once you enter the water (although how and why this would work I'm not quite sure)
3) Make a level_trigger that starts taking away your "oxygen" as you enter the water and once you reach 0 oxygen you die (this one would be easiest)
There are probably more ideas, but those were the ones I came up with. I'll explain 3 in more detail.
3)
It sounds difficult, but it'd be rather simple. I can provide an example if you like.
1) Code a timer for the water that eventually kills you if you don't get out quickly enough (kinda like the lava only it takes longer to die)
2) Make a level_trigger that automatically starts hurting you once you enter the water (although how and why this would work I'm not quite sure)
3) Make a level_trigger that starts taking away your "oxygen" as you enter the water and once you reach 0 oxygen you die (this one would be easiest)
There are probably more ideas, but those were the ones I came up with. I'll explain 3 in more detail.
3)
Code: Select all
Have an GUI that shows how much Health and Oxygen you have. Set health at 100 and set oxygen at 100.
Have a level_trigger that takes away oxygen once you enter the water (just a little bit) Then have level_triggers in the water which are spaced out from each other. These will also deduct oxygen. Once your oxygen is all gone, the level_triggers will start taking away chunks of your health until you die.

Want a user bar like this one? PM Leo!
-
- Support Team
- Posts: 2458
- Joined: April 27th, 2010, 5:31 pm
- IRC Username: CP
Re: swimming question
if you're really good at coding, you could make a level trigger (like arc said) that creates a loop starting with 5 million and counts down, and when you get to 0, you "nap" (which is Cubescript for die or whatever).
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
-
- Support Team
- Posts: 2734
- Joined: January 13th, 2010, 12:42 pm
- Name: Timothy
- IRC Username: I use Steam
- Location: Looking over your shoulder...
- Contact:
Re: swimming question
Actually CP, mine would insure that you survive if you get out of the water in time as well as replenish your oxygen (that's something that could be added).
Otherwise once the 5 million counts down, you die whether you're in the water or not.
Otherwise once the 5 million counts down, you die whether you're in the water or not.

Want a user bar like this one? PM Leo!
-
- Support Team
- Posts: 2458
- Joined: April 27th, 2010, 5:31 pm
- IRC Username: CP
Re: swimming question
oops, yeah that's true...
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
-
- Support Team
- Posts: 2734
- Joined: January 13th, 2010, 12:42 pm
- Name: Timothy
- IRC Username: I use Steam
- Location: Looking over your shoulder...
- Contact:
Re: swimming question
Always look for alternate ways to do something 


Want a user bar like this one? PM Leo!
-
- Member
- Posts: 5
- Joined: December 9th, 2010, 8:57 pm
- Name: Nathan
Re: swimming question
Thank you guys, that really helps. And no, i am no good at coding, I have never done it before, so using sandbox is kind of a test/learning process for me. An example then would be more then welcome.
-
- Support Team
- Posts: 2734
- Joined: January 13th, 2010, 12:42 pm
- Name: Timothy
- IRC Username: I use Steam
- Location: Looking over your shoulder...
- Contact:
Re: swimming question
Okay:
I'm 98.9% sure this'll work (I just haven't had time to test it out ;D) Place this in your map config to have it work.
Arcones
Code: Select all
on_start = [
health = 100
oxygen = 200
]
"level_trigger_1" = [
health = (- $health 10 );
echo ( format "You now have %1 Health." $health );
if ( < $health 1 ) [
nap;
health = 100;
]
]
"level_trigger_2" = [
oxygen = (- $oxygen 10 );
echo ( format "You now have %1 Oxygen." $oxygen );
if ( < $oxygen 1 ) [ echo "You have run out of oxygen! You'll start losing health if you don't get out!" ];
if ( < $oxygen 1 ) [
health = (- $health 10 );
if ( < $health 1 ) [
nap;
health = 100;
]
]
]
newgui Inventory [
guibutton "Back" "cleargui 1"
guibar
guitext ( format "You have %1 health." $health )
guitext ( format "You have %1 oxygen." $oxygen )
]
newgui main [
guilist [
guilist [
guibutton "Inventory" "showgui Inventory"
]
]
guibar
@main
]
Arcones

Want a user bar like this one? PM Leo!
-
- Member
- Posts: 5
- Joined: December 9th, 2010, 8:57 pm
- Name: Nathan
Re: swimming question
Fantastic! I'll give this a try and let you know how it works.
Re: swimming question
Im a noob at all of this, can someone tell me where do I find the script to add this? Is it in a folder?
Thanks in advance
Thanks in advance