|
Post by bartyrocks3 on Mar 1, 2016 13:33:03 GMT
Hello, i`m bartyrocks3 with Barty Games. I can`t seem to find any script for our newest game. Our programmer has just quit and I am taking on the role with my almost to nothing knowledge of code. If you could please help us out with the script, your name will be in the credits of our next game. Thank you so much.
|
|
|
Post by Power Supersport on Mar 1, 2016 16:10:11 GMT
Hunger system?
I can give you the simpliest example of how this can be... No knowledge of scripting means that it will be even harder to give you simplicity...
This is the basic... Now you have to tell me what the script needs to do when the hunger gets to 0... And how the hunger will regenerate...
float hunger; float maxHunger = 100; float hungerDecreaseSpeed = 0.02;
void Main() {
if (iInitializing()) { hunger = maxHunger; }
if (hunger > 0) hunger -= hungerDecreaseSpeed;
if (hunger <= 0) hunger = 0; }
|
|
|
Post by bartyrocks3 on Mar 1, 2016 19:32:32 GMT
First it`s not as low as you think it is. I understand the script. I just don`t know how to write it. I have used 3d rad for 2 years.
Next: the hunger will be replenished by eating food
and when it gets to zero you automatically lose. it goes black and says "you are dead" like DayZ.
|
|
|
Post by Power Supersport on Mar 2, 2016 9:51:45 GMT
I am sorry... I just meet up so many people that don't know a single line of scripting... And I try to explain as simple as I can...
So... Let me think...
Let's imagine that you eat with F key...
float hunger; float maxHunger = 100; float hungerDecreaseSpeed = 0.02; int time;
bool dead;
void Main() {
if (iInitializing()) { hunger = maxHunger; }
if (hunger > 0) hunger -= hungerDecreaseSpeed;
// When you die... if (hunger <= 0) { hunger = 0; dead = true; }
if (dead) { // Stuff that need to happen when you're dead... }
// When you eat... if (iKeyDown(iKeyCode("DIK_F"))) { time += 1; if (time == 1) { hunger += 10; } } else time = 0;
}
|
|
|
Post by bartyrocks3 on Mar 2, 2016 13:34:10 GMT
So, to set this up, I just link the 1st person character to this script?
|
|
|
Post by Power Supersport on Mar 2, 2016 14:09:30 GMT
If you really understand scripting you would notice that this script as it is can't do anything useful at the moment... There aren't any objects linked to it... Even if you link, there aren't any objects declared in the script... It just does some kind of calculations which we can't even use...
But... Why do you need to connect the 1stPerson camera to it? You didn't tell me that the character needs to stop or whatever... You just told me that you want a text to appear without blocking any controls...
You have to explain everything in detail... Really in detail... You have to tell me what EXACTLY the script needs to execute, so I can transform it for you...
For example: The character needs to stop, the text appears etc... And how you're gonna restart?
|
|
|
Post by bartyrocks3 on Mar 2, 2016 14:27:22 GMT
Ok, i`m new to this forum. I need a 1st person camera linked to it. I want it to display your hunger in the top right corner (count down from 100), when it gets to zero (take zero as a 1, I dont want it to kill you immediately, but like 10 seconds after.) a black screen shows up (sprite with text) and says "you are dead". After 10 seconds, it takes you to the main menu, where you have to restart. after 30 seconds, I want 1 hunger to go down. I am going to have another problem also. I need a save and load script. Just a simple one. Thanks. Look, i`m not trying to be a butt. I am just new to this programming and forum thing. I have seen the programmer in action and he did explain to me about coding before he quit. I not trying to get on your nerves or anything, but I just don`t understand. All of our games have been very simple racing games and we have never really gone out of this boundary. We picked 3d rad because of its wide community to help us with these things. We appreciate your help so much, and your name will be in the credits of this game.
|
|
|
Post by Power Supersport on Mar 2, 2016 15:07:17 GMT
Hey, dude... Don't worry... I just want to know what I need to do... Because I know how hard is to work with someone who doesn't understand scripting... And I've met dozens of people like this... And I have nothing against you... Just when someone wants something, I give it to him... then he doesn't understand what to do... And it becomes a big mess of misunderstanding... And that's why I wanted you to tell me everything in details... And you did... Now I am going to explain everything step by step and what do you need to do... Add a valuePrint and position it at the top right corner as you say... you can customize it as much as you want... The value is important... Add your sprite with the text "You are dead!"... Add a sprite with black image (completely black) and stretch it to cover the whole screen... Add a script WITHOUT connecting anything to it yet... If your main menu is in separate project, add an ExitFade too... We're ready with the necessary items... Let's go to scripting... float hunger; float maxHunger = 100; float hungerDecreaseSpeed = 0.02; // You have to play arround with this value until you get a good one... int [] time(4);
float deadOpacity;
bool dead;
void Main() {
if (iInitializing()) { hunger = maxHunger; }
if (hunger > 0) hunger -= hungerDecreaseSpeed;
// When you eat... if (iKeyDown(iKeyCode("DIK_F"))) { time[0] += 1; if (time[0] == 1) { hunger += 10; } } else time[0] = 0;
// When you die... if (hunger <= 0) { hunger = 0; dead = true; }
if (dead) { time[1] += 1; if (time[1] == 1) { iObjectStop(OBJ_0); }
deadOpacity = iFloatTendTo(deadOpacity, deadOpacity, 1, 0.05, 0);
if (time[1] == 600) { iObjectStart(OBJ_88); } } else time[1] = 0;
OUT_22 = hunger; OUT_44 = deadOpacity; OUT_66 = deadOpacity; } This whole script goes into the script object... IMPORTANT! Now connect: 1. Cam1stPerson 2. ValuePrint 3. Sprite Black 4. Sprite Text 5. ExitFade That's it for now... And a little question... How you're gonna regenerate hunger (how are you gonna eat the food)? I hope the script helped and tell me if you didn't understand something...
|
|
|
Post by bartyrocks3 on Mar 2, 2016 16:02:45 GMT
This is where the inventory system comes in. You have to pick up the food and press the key (f) to eat it. Then it deducts 1 from your inventory. It fills up 10 hunger. The inventory system I want is going to be so simple. Actually any kind of of inventory will work. Simple to advanced. Thank you for understanding and for the script.
|
|
|
Post by Power Supersport on Mar 2, 2016 16:16:56 GMT
You're welcome... I can do simple inventory system pretty easy... I mean for example a valuePrint showing how much food you have... And when you use one (F) it decreases the value and increases the hunger...
|
|
|
Post by bartyrocks3 on Mar 2, 2016 17:13:59 GMT
Is there some way you can do a script where you pick something up by pushing a key and then it adds it to your inventory? If there is, I would like that to be in the script for the inventory system if you don't mind
|
|