OK so look at this picture I will tell you what to put in each block
first put a command block at the end of the summoning that says /setbock <X of redstone (X) in picture> <Y of redstone (X) in picture> <Z of redstone (X) in picture> minecraft:redstone_block
put the X Y and Z somewhere no one will see this will be the redstone block (X) in the picture
for 1 have a repeating command block that is needs redstone says
/kill @e[type=Pig,x=<X of one corner>
y=<Y of one corner>,z=<Z of one corner>,dx=<distance on X from one corner to the other>,
dy=<distance on Y from one corner to the other>,
dz=<distance on Z from one corner to the other>
replace all with the actual distance of the X/Y/Z
for 2 have a chain command block off of that that is always active and conditional that says
/setblock <X of behind 1st Lamp> <Y of behind 1st Lamp> <Z of behind 1st Lamp> minecraft:redstone_block
once again replace all with the actual X/Y/Z
Have command block 3 be chain always active and conditional and have this command/setbock <X of wool> <Y of wool> <Z of wool> minecraft:redstone_block
now in command block 4 make it put this command /setbock <X of redstone (X) in picture>
<Y of redstone (X) in picture> <Z of redstone (X) in picture> minecraft:redstone_block
Now set the X Y and Z to whare you put the redstone block earlier
5 is the same as one
6 is conditional always active and chain/setblock <X of behind 2nd Lamp> <Y of behind 2nd Lamp> <Z of behind 2nd Lamp> minecraft:redstone_block
now you need a reset button make it go into a impulse needs redstone unconditional and make it say /setbock <X of wool> <Y of wool> <Z of wool> minecraft:air
Now copy this for the other goal
now you should be done hopefuly this works by the way what is your server's IP?