YAY! Problem time!!!!!!!!
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
- chaoscentral
- Posts: 677
- Joined: Sun Feb 27, 2005 4:32 pm
- Location: Revere, MA
- Contact:
YAY! Problem time!!!!!!!!
ok... I got two problems now. First things first... BRIDGES!
How do I make em. I've screwed around and cant figure it out. Dont say RTM or RTFW, I live there so I always read it.
Second, I need help with this script. I'm making a vending machine that gives you heath for the first 3 times you use it. Then after that it displays "they ran out". Now I'm pretty good with ACS, but I cant get it to work. It either always works, or youcan only use it once. If you want the script let me know ill post it. Thanks in advance for any help.
How do I make em. I've screwed around and cant figure it out. Dont say RTM or RTFW, I live there so I always read it.
Second, I need help with this script. I'm making a vending machine that gives you heath for the first 3 times you use it. Then after that it displays "they ran out". Now I'm pretty good with ACS, but I cant get it to work. It either always works, or youcan only use it once. If you want the script let me know ill post it. Thanks in advance for any help.
- chaoscentral
- Posts: 677
- Joined: Sun Feb 27, 2005 4:32 pm
- Location: Revere, MA
- Contact:
Code: Select all
int i;
script 999 OPEN
{
i = 0;
}
script 255 (void)
{
If(i == 0) {
GiveInventory("HealthBonus", 5);
Print(s: "You got a snack!");
i++;
}
If(i == 1) {
GiveInventory("HealthBonus", 5);
Print(s: "You got another snack!");
i++;
}
If(i == 2) {
GiveInventory("HealthBonus", 5);
Print(s: "You got another snack!");
i++;
}
If(i >= 3) {
Print(s: "They ran out!");
}
}
Try declaring the variable inside the script so it's a script variable, like
[edit]
Crap, didn't work, I'm trying out an idea, I'll get back on this
Code: Select all
#include "zcommon.acs"
script 255 (void)
{
int i = 0;
If(i == 0) {
GiveInventory("HealthBonus", 5);
Print(s: "You got a snack!");
i++;
}
If(i == 1) {
GiveInventory("HealthBonus", 5);
Print(s: "You got another snack!");
i++;
}
If(i == 2) {
GiveInventory("HealthBonus", 5);
Print(s: "You got another snack!");
i++;
}
If(i >= 3) {
Print(s: "They ran out!");
}
}
Crap, didn't work, I'm trying out an idea, I'll get back on this
Finally got a good working way to do it:
Code: Select all
#include "zcommon.acs"
int i = 0;
script 254 (void)
{
acs_execute(255,0);
acs_execute(256,0);
acs_execute(257,0);
acs_execute(258,0);
}
script 255 (void)
{
If(i == 0) {
GiveInventory("HealthBonus", 5);
Print(s: "You got a snack!");
i++;
}
}
script 256 (void)
{
If(i == 1) {
GiveInventory("HealthBonus", 5);
Print(s: "You got another snack!");
i++;
}
}
script 257 (void)
{
If(i == 2) {
GiveInventory("HealthBonus", 5);
Print(s: "You got another snack!");
i++;
}
}
script 258 (void)
{
If(i >= 3) {
Print(s: "They ran out!");
}
}
-
- Posts: 937
- Joined: Mon Oct 04, 2004 9:16 pm
- chaoscentral
- Posts: 677
- Joined: Sun Feb 27, 2005 4:32 pm
- Location: Revere, MA
- Contact:
- chaoscentral
- Posts: 677
- Joined: Sun Feb 27, 2005 4:32 pm
- Location: Revere, MA
- Contact:

AFAIK it should be equal to the initial script. And the initial script doesn't work because:
Code: Select all
script 255 (void)
{
If(i == 0) {
GiveInventory("HealthBonus", 5);
Print(s: "You got a snack!");
i++; //now i is 1
}
If(i == 1) { //so it's true
GiveInventory("HealthBonus", 5);
Print(s: "You got another snack!");
i++; //now i is 2
}
If(i == 2) { //so it's true
GiveInventory("HealthBonus", 5);
Print(s: "You got another snack!");
i++; //now i is 3
}
If(i >= 3) { //so it's true
Print(s: "They ran out!");
}
}
- Doomguy0505
- Posts: 625
- Joined: Tue Mar 29, 2005 4:53 am
- Contact:
Code: Select all
script 255 (void)
{
If(i == 0) {
GiveInventory("HealthBonus", 5);
Print(s: "You got a snack!");
i++; //now i is 1
terminate;
}
If(i == 1) { //so it's true
GiveInventory("HealthBonus", 5);
Print(s: "You got another snack!");
i++; //now i is 2
terminate;
}
If(i == 2) { //so it's true
GiveInventory("HealthBonus", 5);
Print(s: "You got another snack!");
i++; //now i is 3
terminate;
}
If(i >= 3) { //so it's true
Print(s: "They ran out!");
terminate;
}
}
This is better, isn't it?
But I think chaoscentral uses LK873's script (and doesn't need our answers)

Code: Select all
//not tested
script 255 (void)
{
if(i == 0) {
GiveInventory("HealthBonus", 5);
Print(s: "You got a snack!");
i++;
}
else if(i == 1 || i == 2) {
GiveInventory("HealthBonus", 5);
Print(s: "You got another snack!");
i++;
}
else {
Print(s: "They ran out!");
}
}