[ACS] question about hud messages images and activation

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[ACS] question about hud messages images and activation

#1

Post by FranckyFox2468 » Fri Dec 16, 2016 4:18 pm

Okay this is gonna be a tricky one (or perhaps not i'm not sure), but i am currently figuring out how to make the item shop of my mod provide enough information to the player so he knows what the hell he is buying and if he has this items and what upgrades he has or not.

So my idea was to make a script activated by a floor that displays the image for either if he has this item or not and displays the prices and stuff and disappears once the player leaves the floor in question. But problem is i have no clue how to proceed. Either i end up with a hud message that stays here and dissappears after a few seconds or stays forever without leaving the screen. I was expecting to make the floor activator loop the script for as long as the player stays here but apparently its not how it works.

Can you guys help? ??? (I'm kinda bad at ACS so sorry if this sounds like a really dumb question)
Last edited by FranckyFox2468 on Sat Dec 17, 2016 5:41 pm, edited 1 time in total.

Catastrophe
Retired Staff / Community Team Member
Posts: 2558
Joined: Sat Jun 02, 2012 2:44 am

[ACS] Re: question about hud messages images and activation

#2

Post by Catastrophe » Fri Dec 16, 2016 6:13 pm

Either i end up with a hud message that stays here and dissappears after a few seconds or stays forever without leaving the screen.
When you do a hudmessage, set an ID that's not 0 and set the time to 0. To make it go away, simply print the message again with the same ID and set the msg to a blank space, like this: " ", and the time to something low like 0.1

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[ACS] Re: question about hud messages images and activation

#3

Post by FranckyFox2468 » Fri Dec 16, 2016 10:00 pm

Okay, but what if i wanna make it so it automatically switches once the item as been purchased to a "sold" version of the image?

Catastrophe
Retired Staff / Community Team Member
Posts: 2558
Joined: Sat Jun 02, 2012 2:44 am

[ACS] Re: question about hud messages images and activation

#4

Post by Catastrophe » Fri Dec 16, 2016 10:35 pm

FranckyFox2468 wrote:Okay, but what if i wanna make it so it automatically switches once the item as been purchased to a "sold" version of the image?
Just print a message with the same id as the message you want to disappear.

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[ACS] Re: question about hud messages images and activation

#5

Post by FranckyFox2468 » Sat Dec 17, 2016 12:21 am

okay but how do i make so the process is automatic without delay? Like update the info the moment it happens? Cause i only want the message to display while the player is around the vendor of the specific item and it updates the ammounts and pictures the moment you buy the thing in question and fades out the moment you go somewhere else

EDIT: I think i may have figured something, but i need to figure how to make a script break the loop of another script. Ima try to make a hudmessage that loops very rapidly and stops once another sector is hit

EDIT 2: Okay i think i solved it, thanks for the help!

EDIT 3: Nevermind, my idea was to make a sector with another sector inside of it. The exterior sector would terminate the script and the inner sector would execute it. Problem is that the inner sector's script only executes once i have touched another face/corner of it instead of working directly. Executealways and executewithresult makes the loop never go away despite telling it to stop, im running outta ideas :(

Here's the script in question:

Code: Select all

#include "zcommon.acs"
script 1 (void)
{
	SetFont("BIGFONT");
	HudMessage(s:"you currently own ",
			d:CheckInventory("Shell"),
			s:" of these!";
		HUDMSG_PLAIN, 1, CR_YELLOW, 0.1, 0.1, 0.1);
		delay(1);
		Restart;		
}
It works pretty well, but problem is either it doesn't start correctly or simply won't stop

Post Reply