Set Var WIFI_CONNECTED=0 If %PACTIVE !~ *,Wifi_State,*
Explanation: %PACTIVE is a Tasker built-in variable that has all active profile names in it. This If statement looks to see if your profile named "Wifi_State" does not match (!~) any of the names contained in the list. If it is not in the list, after the wait, then it sets you WIFI_CONNECTED=0. If it is in the list it does not set it.
The *, and ,* are needed for the search parameter to work. No spaces between them and the profile name.