Special Hud thing
Special Hud thing
In my game I need a feature where a variable appears on the HUD, that keeps increasing over time. By pressing space (key map # 46 I think) you can decrease the variable. At a certain point if the variable isn't below a certain value, it plays one movie (and game over, consequently), if it is below the value, the game plays a different movie and continues the game. How can I do this?
Over 3 years (has it been that long?) and just now I noticed the day and month of my birthday were switched. Whoops!
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Special Hud thing
Alright, for this to work you'll need a timer.
Add a variable, called "INCREASETIMER" and a variable, called "TIMERAMOUNT"
Than in the script:
Get it? In the TIMERAMOUNT variable you put the ammount of pause time. You check than if the Space button is pressed and modify the attribute, called "name" with +5, but if space is not pressed (else), the attribute "name" decreases
Add a variable, called "INCREASETIMER" and a variable, called "TIMERAMOUNT"
Than in the script:
Code: Select all
if(INCREASETIMER < self.time)
{
if (IsKeyDown(46))
{
ModifyAttribute("name", 5, char "Player");
}
else
{
ModifyAttribute("name", -5, char "Player");
}
INCREASETIMER = self.time + TIMERAMOUNT;
} ]
Re: Special Hud thing
Allright! I do get how the script works (that's a good thing), but I put assign this to a pawn, add the variable "speed" into player.ini and the attribute.txt, and assign it accordingly in the script (and add a numeric hud thingy into hud.ini), but the attribute won't change.
Over 3 years (has it been that long?) and just now I noticed the day and month of my birthday were switched. Whoops!
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Special Hud thing
Put a
after the timer thing and see if it changes. If it changes, than it's your HUD description, if not, than paste the script here, I'll check it out
Code: Select all
debug(GetAttribute("name", "Player");
Re: Special Hud thing
Won't work oddly, here is the code:
Code: Select all
{
TIMERAMOUT [1]
Spawn[()
Console(true);
NewOrder(Keycheck);
]
Keycheck[()
if(INCREASETIMER < self.time)
{
if (IsKeyDown(46))
{
ModifyAttribute("speed", 5, char "Player");
}
else
{
ModifyAttribute("speed", -5, char "Player");
}
INCREASETIMER = self.time + TIMERAMOUNT;
}
debug(GetAttribute("speed", "Player");
RestartOrder()
]
}
Over 3 years (has it been that long?) and just now I noticed the day and month of my birthday were switched. Whoops!
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
- darksmaster923
- Posts: 1857
- Joined: Wed Jan 03, 2007 10:32 pm
- Location: Huntington Beach, California, USA
- Contact:
Re: Special Hud thing
You have
ModifyAttribute("speed", -5, char "Player");
Take out char.
so it would be
ModifyAttribute("speed", -5, "Player");
ModifyAttribute("speed", -5, char "Player");
Take out char.
so it would be
ModifyAttribute("speed", -5, "Player");
Herp derp.
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Special Hud thing
Oh, my bad I usually copy the commands from the manual and replace the parameter descriptions, cuz I can't remember them, and I haven't deleted the "char" before the EntityNameModifyAttribute("speed", -5, char "Player");
Re: Special Hud thing
Still won't work... the console won't show up, too. But just in case, here's the code:
Here is my hud.ini "speed" entry
The player.ini "speed" entry
And the attributes.txt "speed" entry
Code: Select all
{
TIMERAMOUT [1]
Spawn[ ()
{
Console(true);
NewOrder(Keycheck);
}]
Keycheck[ ()
{
if(INCREASETIMER < self.time)
{
if (IsKeyDown(46))
{
ModifyAttribute("speed", 5,"Player");
}
else
{
ModifyAttribute("speed", -5,"Player");
}
INCREASETIMER = self.time + TIMERAMOUNT;
}
debug(GetAttribute("speed", "Player");
RestartOrder()
}]
}
Code: Select all
[speed]
type = horizontal
frame = hud\hud_health_oxygen.bmp
framealpha = hud\a_hud_oxygen.bmp
indicator = hud\hud_health_oxygeni.bmp
indicatoralpha = hud\a_hud_oxygeni.bmp
framex = 10
framey = 10
indicatoroffsetx = 25
indicatoroffsety = 0
indicatorwidth = 160
flipindicator = true
active = true
[~speed]
type = numeric
framex = 10
framey = 10
indicatoroffsetx = 202
indicatoroffsety = 30
font = 7
width = 16
active = true
Code: Select all
; speed
[speed]
initial = 10
low = 0
high = 100
Code: Select all
speed
10
0
100
Over 3 years (has it been that long?) and just now I noticed the day and month of my birthday were switched. Whoops!
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Special Hud thing
Code: Select all
RestartOrder()
Re: Special Hud thing
Just tried it. Still won't work
I guess the ghost in my computer is acting up again
I guess the ghost in my computer is acting up again
Over 3 years (has it been that long?) and just now I noticed the day and month of my birthday were switched. Whoops!
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
- darksmaster923
- Posts: 1857
- Joined: Wed Jan 03, 2007 10:32 pm
- Location: Huntington Beach, California, USA
- Contact:
Re: Special Hud thing
If the console doesn't show up, then you're missing some important syntax but I can't find it
Herp derp.
Re: Special Hud thing
Try
The second order must be in LowLevel, or it will not be executed every frame, and it could become very inaccurate in its time measurements.
And also check if the StartOrder of the Pawn is 'Spawn'.
Also, in the Realityfactory.log is there a part where it says: 'Reader Script error'... (Just search inside the document)?
Code: Select all
{
TIMERAMOUT [1.0]
Spawn[ ()
{
Console(true);
LowLevel("Keycheck");
} ]
Keycheck[ ()
{
if(INCREASETIMER < self.time)
{
if (IsKeyDown(46))
{
ModifyAttribute("speed", 5,"Player");
}
else
{
ModifyAttribute("speed", -5,"Player");
}
INCREASETIMER = self.time + StringCopy(TIMERAMOUNT);
}
debug(GetAttribute("speed", "Player"));
} ]
}
And also check if the StartOrder of the Pawn is 'Spawn'.
Also, in the Realityfactory.log is there a part where it says: 'Reader Script error'... (Just search inside the document)?
Everyone can see the difficult, but only the wise can see the simple.
-----
-----
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Special Hud thing
I was checking for syntax mistakes, but didn't see that in the KeyCheck order there's a NewOrder() command, not LowLevel(). Anyway, now I can't see a reason why the script won't work
Re: Special Hud thing
Console shows up (it would help if I assigned the right script to it ) and I get this message:
What is that about?
Code: Select all
Pawn2 Spawn NewOrder
:12: Parse error near "" *
Over 3 years (has it been that long?) and just now I noticed the day and month of my birthday were switched. Whoops!
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56