|
Post by Red Moon Entertainment on Dec 14, 2016 15:01:27 GMT
Even I think the title say it all, I'm not sure on how to make a lifebar. Then I'm not sure on how to make a fall damage when you hit the ground too hard. I'd like to make hunger/drought and stamina bars (with hunger/drought bar I mean a unique bar for food and liquids, like The Forest).
I'll be very happy if you can help me ^_^
|
|
|
Post by NicusorN5 on Dec 14, 2016 17:29:17 GMT
You can do it using some timers and Counters ^ ^
|
|
|
Post by Red Moon Entertainment on Dec 14, 2016 19:48:19 GMT
Thx What to do about the fall damage?
|
|
|
Post by kulu on Dec 15, 2016 7:50:38 GMT
For the fall damage you can use an "event on contact" . the event on contact starts another event if the contact between two rigid bodys is detected. you can also set the 'event on contact" to start when a specific amount of force is detected eg. a contact force less than 100 will do nothing, and a contact force that is more than 100 will trigger another event eg. a counter event.
|
|
|
Post by Red Moon Entertainment on Dec 16, 2016 14:05:28 GMT
Very grateful! Thx to all you two!
|
|
|
Post by Red Moon Entertainment on Dec 17, 2016 20:17:45 GMT
I'm having some problem with the EventOnValue (to die when you have 0 health). You know that the Counters "decide" the inital value of the ValuePrints. So, when you look at a ValuePrint in the editor it writes 0 as value. e. g. Health 0 So what to do? PS: I made all you two suggested and they worked. Thx again
|
|
|
Post by NicusorN5 on Dec 18, 2016 8:49:09 GMT
You better use a script that looks like this (UNTESTED):
int HP = 100 ; //Defines player's HP float ForceIntensity = 100; //Defines the falling force enought to damage the player void KillPlayer() { //What happends if player dies } vois Main() { if (EventOnContact force > ForceIntesity) { HP -= ForceIntensity / 10 //Decreases the player Hp if (Hp =< 0) //I'm not sure if i wrotten this line correctly { KillPlayer(); } } }
|
|
|
Post by Red Moon Entertainment on Dec 18, 2016 12:27:26 GMT
What does the script means by killPlayer? I was trying to make an event or a script that bring you to another project when you die.
However thx, I'll try to play around this script.
|
|
|
Post by Red Moon Entertainment on Dec 19, 2016 17:06:08 GMT
UP
|
|
|
Post by GH Games on Dec 19, 2016 19:55:44 GMT
What does the script means by killPlayer? I was trying to make an event or a script that bring you to another project when you die. However thx, I'll try to play around this script. To answer both of those in one based of the script that NicusorN5 just provided here are my alterations... First of all, the KillPlayer refers to the
void KillPlayer() { //What happends if player dies } part of the script.
To make another project load when the player dies, just alter the OBJ_XX in the following...
int HP = 100 ; //Defines player's HP float ForceIntensity = 100; //Defines the falling force enought to damage the player void KillPlayer() { //Player dies, this happens iObjectStart(OBJ_XX); //This is the ExitFade object linking to the death project } void Main() { if (EventOnContact force > ForceIntesity) { HP -= ForceIntensity / 10 //Decreases the player Hp if (Hp =< 0) //I'm not sure if i wrotten this line correctly { KillPlayer(); } } } I think this is right (just the parts I've altered) but correct me if I'm wrong I'm still quite new to scripting
|
|
|
Post by Red Moon Entertainment on Dec 21, 2016 20:47:10 GMT
Thx a lot grasshopper I'll try it as soon as I can!
|
|
|
Post by GH Games on Dec 22, 2016 13:04:20 GMT
No worries bro let me know if it works
|
|
|
Post by Red Moon Entertainment on Dec 22, 2016 13:55:56 GMT
I'm sorry, but I think there's something wrong here (line 10): if (EventOnContact force > ForceIntesity)
Have I to change something with a value?
What objects have I to link to this script?
|
|
|
Post by GH Games on Dec 23, 2016 11:41:16 GMT
Yea you need to change some of the words to Objects. So for example on line 10... if (IN_XX > ForceIntensity) //If the Default Force is Greater than 100 do what's in the if's {} Where the IN_XX is your EventOnContact's "Contact Force" and the number 100 is the Default Force. I think that's right. Make sure you check the "Use contact force bounds" in the EventOnContact Object for this to work. As far as what you need to link the Script to goes, I think the only thing you need it to be linked to is the EventOnContact. Again... I think. You will need to relate your Cam1stPerson or whatever your using with the EventOnContact as well as the two RigidBodies you want to Monitor. Once you've done this it should be active. I'm going to test the Script out and see if it works. If it does, happy days... if not, I'll tinker with it. If you can't get this to work you might want to try the EventOnProximity Object. You might be able to acheive the same or similar thing with that
|
|