Rifleman Posted March 2 Hi everyone, is it possible to pass a string to an ACS script? I have these two pieces of code and they work nicely together: Spoiler ZScript: override void Tick() { super.Tick(); FLineTraceData RemoteRay; double pz = height * 0.5 - floorclip + player.mo.AttackZOffset*player.crouchFactor; bool hit = LineTrace( angle, 1000, pitch, offsetz: pz, data: RemoteRay ); if(hit && RemoteRay.HitType == TRACE_HitActor && RemoteRay.HitActor.bISMONSTER == TRUE) { ACS_NamedExecute("EnemyHealthCheck", 0, RemoteRay.HitActor.health, RemoteRay.HitActor.SpawnHealth()); } else { ACS_NamedTerminate("EnemyHealthCheck", 0); } } ACS: script "EnemyHealthCheck" (int currentHealth, int spawnHealth) { str colour = "GREEN"; if(currentHealth < (spawnHealth / 3) * 2) colour = "YELLOW"; if(currentHealth < spawnHealth / 3) colour = "RED"; SetFont("BIGFONT"); HudMessage(d:currentHealth, s:" / ", d:spawnHealth; HUDMSG_PLAIN | HUDMSG_COLORSTRING, 0, colour, 0.5, 0.075, 0.1); SetFont("SMALLFONT"); HudMessage(s:"Enemy health:"; HUDMSG_PLAIN, 1, CR_WHITE, 0.5, 0.05, 0.1); } But I would like to replace the 'enemy health' string with monster name, but AFAIK A_NamedExecute() only accepts integers as arguments; is there a way? Or way around it? Thanks! 0 Quote Share this post Link to post
1 jaeden Posted March 3 You make an event handler and register it in Mapinfo's Gameinfo definition. (more on https://zdoom.org/wiki/Events_and_handlers) In the event handler you can override the RenderOverlay method, and from this method you can call functions of Screen, such as DrawText or DrawTexture, which... draw things like text or images on screen. 2 Quote Share this post Link to post
1 Kan3 Posted March 2 I don't think there is, unfortunately. The only way to do what you want is probably by doing everything in ZSCRIPT, which it should be easily possible, with Events 1 Quote Share this post Link to post
0 Rifleman Posted March 3 Well, I dunno how to do it with events, so I would be grateful for pointers/guide/WAD to learn from. I tried playing around with ZScript Status bar but can't crack it. In the meantime, I managed to partially resolve it by having the LineTrace HitActor call the script and then I use GetActorClass(). 0 Quote Share this post Link to post
Question
Rifleman
Hi everyone,
is it possible to pass a string to an ACS script? I have these two pieces of code and they work nicely together:
ZScript:
ACS:
But I would like to replace the 'enemy health' string with monster name, but AFAIK A_NamedExecute() only accepts integers as arguments; is there a way? Or way around it?
Thanks!
Share this post
Link to post
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.