I'm trying to convert one of my old ACS Scripts to ZScript. Basically there's a custom keybinding that when a player presses it, the script grabs the actor in front of the players crosshair or in the area (using ACSs PickActor method) and if it's an actor of a certain type, something happens. Basically i'm looking for a Zscript equivalent to PickActor. I checked the docs, source code and this thread right here which I thought would have my answer:
viewtopic.php?t=55073&hilit=Zscript+A_P ... rt=240#top
Basically I'm creating a NetworkProcess for a custom keypress and if you are standing in front of a Sygil (custom Actor class), stuff happens. Here is the code I have tried to adapt from that thread
Problem is nothing happens. I'm not really sure where to start debugging either. I know it returns a double, but what of? What is linetarget exactly? How can I view what its returning, console.printf doesn't work becasue it can't be converted to a string. Obviously measuring it against a string won't work, but I'm kind of flying blind here.
viewtopic.php?t=55073&hilit=Zscript+A_P ... rt=240#top
Basically I'm creating a NetworkProcess for a custom keypress and if you are standing in front of a Sygil (custom Actor class), stuff happens. Here is the code I have tried to adapt from that thread
Code:
override void NetworkProcess(ConsoleEvent e) {if (e.Name == "pray") {double useDist = 64.f,vDist = 35.f;// Replacement for A_PickActorFTranslatedLineTarget t;players[0].mo.AimLineAttack(players[0].mo.Angle,useDist,t,vDist,ALF_FORCENOSMART | ALF_CHECKCONVERSATION | ALF_PORTALRESTRICT);bool isSygil = (t.linetarget!= null && t.linetarget is "Sygil");if(isSygil){// do stuff}}}
Statistics: Posted by loydthebartender — Tue Aug 06, 2024 5:50 pm