Detect when SANLA has been opened/closedTo detect when SANLA has been opened on the screen, use this little piece of code:
ctrlVisible 123882
This returns true or false depending on if a certain control of the SANLA dialog (defined in finmod\bin\resource.cpp) is visible or not. This particular control with the
idc 123882 is SANLA's text screen where messages are shown.
Maybe the easiest way to use this to your advantage is to create a trigger:
axis a = 0, axis b = 0
activation: repeatedly
type: switch
condition: ctrlVisible 123882
on activation: player groupChat "SANLA opened"
on deactivation: player groupChat "SANLA closed"Of course you can also do the check in a script.
From here on it should be easy to modify this to your needs.
Detect when SANLA coordinates have been sentBy checking when the
FDFtykistoState variable gets a value of 1 we will know that the user sent coordinates through SANLA, and the artillery team in the other end is available and they accepted the input the player typed to SANLA.
So, another trigger:
axis a = 0, axis b = 0
activation: repeatedly
type: switch
condition: FDFtykistoState == 1
on activation: player groupChat "Firing..."
on deactivation: player groupChat "Firing over"We can also easily check when the player has pressed the "LÄHETÄ" button (send) on the SANLA using the
ctrlText command. Create a trigger:
axis a = 0, axis b = 0
activation: repeatedly
type: switch
condition: ctrlText 123882 == "_"
on activation: player groupChat "Message sent"But this doesn't check for errors in the input nor if the artillery is available and does it have ammo so monitoring the
FDFtykistoState variable is a better way.
I guess you are thinking of an AI mortar soldier actually fire his mortar when the player uses the SANLA to tell him where to shoot and how many rounds. That's a bit more complicated than just monitoring the regular usage of SANLA what we just did.
You would probably need to delete the mortar round (which was just fired) after it has been flying some time and then
createVehicle new mortar rounds to the location where the player wanted them to drop (possibly combining a
setVelocity command to make the mortar round come in approximately accurate direction and angle compared to what it would have been in a real situation). This because I think it's near impossible to make an AI to shoot with the mortar and actually hit the desired target location. Please correct me if I'm wrong (which I am hoping to be).
I hope this helps you to get forward.